#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta_util>
#include <hamsandwich>
#define PLUGIN "Furien Shop Menu"
#define VERSION "1.1"
#define AUTHOR "ORION"
#define IsPlayer(%0) ( 1 <= %0 <= g_iMaxPlayers )
new g_iMaxPlayers;
new bool:superknife [ 33 ];
new v_superknife [ 66 ] = "models/fastcs_furien/v_superknife.mdl"; // Aici pui locatia modelului !
new const PICK_AMMO[] = "items/9mmclip1.wav";
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd( "say shop", "ShopCmd");
register_clcmd( "say /shop", "ShopCmd");
register_clcmd( "say_team shop", "ShopCmd");
register_clcmd( "say_team /shop", "ShopCmd");
register_event("DeathMsg", "eDeath", "a")
register_event ( "CurWeapon", "CurrWeapon", "be", "1=1" );
RegisterHam ( Ham_TakeDamage, "player", "Player_TakeDamage" );
g_iMaxPlayers = get_maxplayers ( );
// Add your code here...
}
public eDeath ( ) {
if ( superknife [ read_data ( 2 ) ] ) {
superknife [ read_data ( 2 ) ] = false;
}
}
public plugin_precache ( ) {
//Super-Knife
precache_model ( v_superknife );
precache_sound(PICK_AMMO);
}
public client_disconnect ( id ) {
superknife[ id ] = false;
}
public CurrWeapon ( id ) {
if ( superknife [ id ] && get_user_weapon ( id ) == CSW_KNIFE ) {
set_pev ( id, pev_viewmodel2, v_superknife );
}
}
public ShopCmd(id) {
new iMoney = cs_get_user_money(id);
switch(get_user_team(id))
{
case 1:
{
new Titlu[101];
formatex(Titlu, 100, "\wFurien Shop^n\yBanii Tai:\r%d$", iMoney);
new ShopMenu = menu_create(Titlu, "weaponshandler");
if(iMoney < 10000) {
menu_additem(ShopMenu, "Super Knife \d10000$", "1", 0);
}
else
{
menu_additem(ShopMenu, "Super Knife \y10000$", "1", 0);
}
if(iMoney < 4000) {
menu_additem(ShopMenu, "HE Grenade \d4000$", "2", 0);
}
else
{
menu_additem(ShopMenu, "HE Grenade \y4000$", "2", 0);
}
if(iMoney < 3000) {
menu_additem(ShopMenu, "50 \wHP \d3000$", "3", 0);
}
else
{
menu_additem(ShopMenu, "50 \wHP \y3000$", "3", 0);
}
if(iMoney < 3000) {
menu_additem(ShopMenu, "50\w AP \d3000$", "4", 0);
}
else
{
menu_additem(ShopMenu, "50\w AP \y3000$", "4", 0);
}
menu_setprop(ShopMenu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, ShopMenu, 0);
}
case 2:
{
new Titlu[101];
formatex(Titlu, 100, "\yAnti-Furien Shop^n\yBanii Tai:\r%d$", iMoney);
new ShopMenu = menu_create( Titlu, "weaponshandler");
if(iMoney < 300) {
menu_additem(ShopMenu, "Defuse KIT \d300$", "1", 0);
}
else
{
menu_additem(ShopMenu, "Defuse KIT \y300$", "1", 0);
}
if(iMoney < 4000) {
menu_additem(ShopMenu, "He Grenade \d4000$", "2", 0);
}
else
{
menu_additem(ShopMenu, "He Grenade \y4000$", "2", 0);
}
if(iMoney < 3000) {
menu_additem(ShopMenu, "50 \wHP \d3000$", "3", 0);
}
else
{
menu_additem(ShopMenu, "50 \wHP \y3000$", "3", 0);
}
if(iMoney < 3000) {
menu_additem(ShopMenu, "50\w AP \d3000$", "4", 0);
}
else
{
menu_additem(ShopMenu, "50\w AP \y3000$", "4", 0);
}
menu_setprop(ShopMenu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, ShopMenu, 0);
}
}
return 1;
}
public weaponshandler(id, ShopMenu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(ShopMenu);
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo(ShopMenu, item, access, data,5, iName, 63, callback);
new key = str_to_num(data);
switch(key)
{
case 1:
{
switch(get_user_team(id))
{
case 1:
{
if(superknife[ id ]) {
ColorChat(id, "^x04[Shop]^x01 Ai deja Super-Knife.");
return 1;
}
else
{
new iMoney = cs_get_user_money(id) - 10000;
if(iMoney < 0) {
ColorChat(id, "^x04[Shop]^x01 Nu ai suficienti bani pentru Super-Knife.");
}
else
{
emit_sound(id, CHAN_ITEM, PICK_AMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
superknife[ id ] = true;
CurrWeapon(id);
cs_set_user_money(id, iMoney);
}
}
}
case 2:
{
new iMoney = cs_get_user_money(id) - 300;
if(iMoney < 0) {
ColorChat(id, "^x04[Shop]^x01 Nu ai suficienti bani pentru Defuse-Kit.");
}
else
{
emit_sound(id, CHAN_ITEM, PICK_AMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
fm_give_item ( id, "item_thighpack" );
cs_set_user_money(id, iMoney);
}
}
}
}
case 2:
{
switch(get_user_team(id))
{
case 1:
{
new iMoney = cs_get_user_money(id) - 4000;
if(iMoney < 0) {
ColorChat(id, "^x04[Shop]^x01 Nu ai suficienti bani bani pentru He Grenade.");
}
else
{
emit_sound(id, CHAN_ITEM, PICK_AMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
fm_give_item ( id, "weapon_hegrenade" );
cs_set_user_money(id, iMoney);
}
}
case 2:
{
new iMoney = cs_get_user_money(id) - 4000;
if(iMoney < 0) {
ColorChat(id, "^x04[Shop]^x01 Nu ai suficienti bani pentru He Grenade.");
}
else
{
emit_sound(id, CHAN_ITEM, PICK_AMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
fm_give_item ( id, "weapon_hegrenade" );
cs_set_user_money(id, iMoney);
}
}
}
}
case 3:
{
switch(get_user_team(id))
{
case 1:
{
new iMoney = cs_get_user_money(id) - 3000;
if(iMoney < 0) {
ColorChat(id, "^x04[Shop]^x01 Nu ai suficienti bani pentru HP.");
}
else
{
new iHealth = get_user_health(id);
if(iHealth >= 250) {
ColorChat(id, "^x04[Shop]^x01 Ai atins limita maxima de HP.");
}
else
{
emit_sound(id, CHAN_ITEM, PICK_AMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
fm_set_user_health(id, iHealth + 50);
cs_set_user_money(id, iMoney);
}
}
}
case 2:
{
new iMoney = cs_get_user_money(id) - 3000;
if(iMoney < 0) {
ColorChat(id, "^x04[Shop]^x01 Nu ai suficienti bani pentru HP.");
}
else
{
new iHealth = get_user_health(id);
if(iHealth >= 250) {
ColorChat(id, "^x04[Shop]^x01 Ai atins limita maxima de HP.");
}
else
{
emit_sound(id, CHAN_ITEM, PICK_AMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
fm_set_user_health(id, iHealth + 50);
cs_set_user_money(id, iMoney);
}
}
}
}
}
case 4:
{
switch(get_user_team(id))
{
case 1:
{
new iMoney = cs_get_user_money(id) - 3000;
if(iMoney < 0) {
ColorChat(id, "^x04[Shop]^x01 Nu ai suficienti bani pentru AP.");
}
else
{
new iArmor = get_user_armor(id);
if(iArmor >= 300) {
ColorChat(id, "^x04[Shop]^x01 Ai atins limita maxima de AP.");
}
else
{
emit_sound(id, CHAN_ITEM, PICK_AMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
fm_set_user_armor(id, iArmor + 50);
cs_set_user_money(id, iMoney);
}
}
}
case 2:
{
new iMoney = cs_get_user_money(id) - 3000;
if(iMoney < 0) {
ColorChat(id, "^x04[Shop]^x01 Nu ai suficienti bani pentru AP.");
}
else
{
new iArmor = get_user_armor(id);
if(iArmor >= 300) {
ColorChat(id, "^x04[Shop]^x01 Ai atins limita maxima de AP.");
}
else
{
emit_sound(id, CHAN_ITEM, PICK_AMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
fm_set_user_armor(id, iArmor + 50);
cs_set_user_money(id, iMoney);
}
}
}
}
}
}
menu_destroy(ShopMenu);
return PLUGIN_HANDLED;
}
public Player_TakeDamage ( iVictim, iInflictor, iAttacker, Float:fDamage, iDamageBits ) {
if ( IsPlayer ( iAttacker ) ) {
if( iInflictor == iAttacker && superknife [ iAttacker ] && is_user_alive( iAttacker ) && get_user_weapon( iAttacker ) == CSW_KNIFE && get_user_team( iAttacker ) == 1 ) {
SetHamParamFloat( 4, fDamage * 2.0);
return HAM_HANDLED;
}
}
return HAM_IGNORED;
}
stock ColorChat(const id, const input[], any:...) {
new count = 1, players[32];
static msg[191];
vformat(msg, 190, input, 3);
replace_all(msg, 190, "!x04", "^4");
replace_all(msg, 190, "!x01", "^1");
replace_all(msg, 190, "!x03", "^3");
if(id) players[0] = id;
else get_players(players, count, "ch"); {
for(new i = 0; i < count; i++) {
if(is_user_connected(players[i])) {
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/