PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta>
#include <engine>
#define NORMAL DontChange
#define GREEN DontChange
#define TEAM_COLOR DontChange
#define RED Red
#define BLUE Blue
#define GREY Grey
#define ColorChat client_print_color
#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )
#define Ham_Player_ResetMaxSpeed Ham_Item_PreFrame
#pragma semicolon 1
enum _:Colors {
DontChange,
Red,
Blue,
Grey
};
new const g_prefix[] = "[Base Builder Shop]";
new const g_ModelSuperKnife[] = "models/base_builder/v_super_knife.mdl";
new const g_ModelSuperDeagle[] = "models/base_builder/v_golden_deagle.mdl";
new bool:g_bHasSuperKnife[33],
bool:g_bHasSuperSpeed[33],
bool:g_bHasSuperM249[33],
bool:g_bHasSuperAWP[33],
bool:g_bHasSuperDeagle[33],
bool:g_bHasGunsKit[33];
new g_iMaxPlayers;
new g_pCvarCostSuperCut,
g_pCvarCostLowGrav,
g_pCvarQuantityLowGrav,
g_pCvarCostSpeed,
g_pCvarQuantitySpeed,
g_pCvarQuantityHealthCT,
g_pCvarCostHealthCT,
g_pCvarCostHE,
g_pCvarCostFlash,
g_pCvarCostSmoke,
g_pCvarCostSuperM249,
g_pCvarCostSuperAWP,
g_pCvarCostSuperDeagle,
g_pCvarCostKitGuns,
g_pCvarQuantityHealthT1,
g_pCvarCostHealthT1,
g_pCvarQuantityHealthT2,
g_pCvarCostHealthT2,
g_pCvarCostInvisinsibilite,
g_pCvarTimeInvisinsibilite;
public plugin_init()
{
register_clcmd("say /MoneyShop", "ShowShop");
register_clcmd("say_team /MoneyShop", "ShowShop");
// Cvars Mixtes
g_pCvarCostSuperCut = register_cvar("shopbb_supercut", "10000");
g_pCvarCostLowGrav = register_cvar("shopbb_grav", "8000");
g_pCvarQuantityLowGrav = register_cvar("shopbb_quant_grav", "0.7");
g_pCvarCostSpeed = register_cvar("shopbb_speed", "8000");
g_pCvarQuantitySpeed = register_cvar("shopbb_quantity_speed", "400.0");
// Cvars CT
g_pCvarQuantityHealthCT = register_cvar("shopbb_vie_ct", "150");
g_pCvarCostHealthCT = register_cvar("shopbb_prix_vie_ct", "5000");
g_pCvarCostHE = register_cvar("shopbb_he", "2500");
g_pCvarCostFlash = register_cvar("shopbb_flash", "2500");
g_pCvarCostSmoke = register_cvar("shopbb_smoke", "2500");
g_pCvarCostSuperM249 = register_cvar("shopbb_super_m249", "10000");
g_pCvarCostSuperAWP = register_cvar("shopbb_super_awp", "8000");
g_pCvarCostSuperDeagle = register_cvar("shopbb_super_deagle", "8000");
g_pCvarCostKitGuns = register_cvar("shopbb_kit_guns", "12000");
// Cvars T
g_pCvarQuantityHealthT1 = register_cvar("shopbb_health_t1", "2000");
g_pCvarCostHealthT1 = register_cvar("shopbb_prix_health_t1", "8000");
g_pCvarQuantityHealthT2 = register_cvar("shopbb_health_t2", "5000");
g_pCvarCostHealthT2 = register_cvar("shopbb_prix_health_t2", "16000");
g_pCvarCostInvisinsibilite = register_cvar("shopbb_invins", "12000");
g_pCvarTimeInvisinsibilite = register_cvar("shopbb_time_invins", "5.0");
RegisterHam(Ham_Spawn, "player", "Player_Spawn_Post", 1);
RegisterHam(Ham_TakeDamage, "player", "ham_TakeDamage_Pre");
RegisterHam(Ham_Item_Deploy, "weapon_knife", "ham_ItemDeploy_Post_KNI", 1);
RegisterHam(Ham_Item_Deploy, "weapon_deagle", "ham_ItemDeploy_Post_DGL", 1);
RegisterHam(Ham_Player_ResetMaxSpeed, "player", "Player_ResetMaxSpeed", 1);
g_iMaxPlayers = get_maxplayers();
}
public client_putinserver( id )
{
g_bHasSuperKnife[id] = false;
g_bHasSuperSpeed[id] = false;
g_bHasSuperM249[id] = false;
g_bHasSuperAWP[id] = false;
g_bHasSuperDeagle[id] = false;
g_bHasGunsKit[id] = false;
}
public ShowShop(id)
{
if ( is_user_alive(id) )
{
new Text[64];
if(cs_get_user_team(id) == CS_TEAM_T)
{
new menu1 = menu_create("\y[\rZombie Shop\y]", "ZombieShop");
formatex(Text, charsmax(Text), "\wSpeed \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSpeed));
menu_additem(menu1, Text, "0");
formatex(Text, charsmax(Text), "\wJump \y[\r%d $\y]", get_pcvar_num(g_pCvarCostLowGrav));
menu_additem(menu1, Text, "1");
formatex(Text, charsmax(Text), "\wSuper Knife \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSuperCut));
menu_additem(menu1, Text, "2");
formatex(Text, charsmax(Text), "\w+%d HP \y[\r%d $\y]", get_pcvar_num(g_pCvarQuantityHealthT1), get_pcvar_num(g_pCvarCostHealthT1));
menu_additem(menu1, Text, "3");
formatex(Text, charsmax(Text), "\w+%d HP \y[\r%d $\y]", get_pcvar_num(g_pCvarQuantityHealthT2), get_pcvar_num(g_pCvarCostHealthT2));
menu_additem(menu1, Text, "4");
formatex(Text, charsmax(Text), "\wInvincible \y[\r%d $\y]", get_pcvar_num(g_pCvarCostInvisinsibilite));
menu_additem(menu1, Text, "5");
menu_setprop(menu1, MPROP_EXITNAME, "Quitter");
menu_display(id, menu1);
}
else if(cs_get_user_team(id) == CS_TEAM_CT)
{
new menu2 = menu_create ("\y[\rBase Builder Shop\y]", "BaseBuilderShop");
formatex(Text, charsmax(Text), "\wSuper Knife \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSuperCut));
menu_additem(menu2, Text, "0");
formatex(Text, charsmax(Text), "\wSpeed \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSpeed));
menu_additem(menu2, Text, "1");
formatex(Text, charsmax(Text), "\wJump \y[\r%d $\y]", get_pcvar_num(g_pCvarCostLowGrav));
menu_additem(menu2, Text, "2");
formatex(Text, charsmax(Text), "\w+%d HP \y[\r%d $\y]", get_pcvar_num(g_pCvarQuantityHealthCT), get_pcvar_num(g_pCvarCostHealthCT));
menu_additem(menu2, Text, "3");
formatex(Text, charsmax(Text), "\wGrenade \y[\r%d $\y]", get_pcvar_num(g_pCvarCostHE));
menu_additem(menu2, Text, "4");
formatex(Text, charsmax(Text), "\wFlash \y[\r%d $\y]", get_pcvar_num(g_pCvarCostFlash));
menu_additem(menu2, Text, "5");
formatex(Text, charsmax(Text), "\wSmoke \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSmoke));
menu_additem(menu2, Text, "6");
formatex(Text, charsmax(Text), "\wM249 Guns \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSuperM249));
menu_additem(menu2, Text, "7");
formatex(Text, charsmax(Text), "\wAWP Guns \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSuperAWP));
menu_additem(menu2, Text, "8");
formatex(Text, charsmax(Text), "\wDeagle Guns \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSuperDeagle));
menu_additem(menu2, Text, "9");
formatex(Text, charsmax(Text), "\wMp4a1 Guns \y[\r%d $\y]", get_pcvar_num(g_pCvarCostKitGuns));
menu_additem(menu2, Text, "10");
formatex(Text, charsmax(Text), "\wAK47 Gold \y[\r16000 $\y]");
menu_additem(menu2, Text, "11");
menu_display(id, menu2);
}
}
}
public ZombieShop(id, menu1, item)
{
if (item == MENU_EXIT || !is_user_alive(id) || cs_get_user_team(id) != CS_TEAM_T)
{
menu_destroy(menu1);
return PLUGIN_HANDLED;
}
new iMoney = cs_get_user_money(id);
switch(item)
{
case 0:
{
if ( iMoney >= get_pcvar_num(g_pCvarCostSpeed))
{
cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSpeed));
g_bHasSuperSpeed[id] = true;
set_user_maxspeed(id, get_pcvar_float(g_pCvarQuantitySpeed));
client_print_color(id, DontChange, "^4%s ^1You just bought the ^3Super Speed^1!", g_prefix);
}
else
{
client_print_color(id, DontChange, "^4%s ^1You do not have enough'^3argent^1!", g_prefix);
}
}
case 1:
{
if ( iMoney >= get_pcvar_num(g_pCvarCostLowGrav))
{
cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostLowGrav));
set_user_gravity(id, get_pcvar_float(g_pCvarQuantityLowGrav));
client_print_color(id, DontChange, "^4%s ^1You just bought the ^3Low Gravity^1!", g_prefix);
}
else
{
client_print_color(id, DontChange, "^4%s ^1You do not have enough'^3argent^1!", g_prefix);
}
}
case 2:
{
if ( iMoney >= get_pcvar_num(g_pCvarCostSuperCut))
{
cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSuperCut));
g_bHasSuperKnife[id] = true;
client_print_color(id, DontChange, "^4%s ^1You just bought the ^3Super Cut^1!", g_prefix);
}
else
{
client_print_color(id, DontChange, "^4%s ^1You do not have enough'^3argent^1!", g_prefix);
}
}
case 3:
{
if ( iMoney >= get_pcvar_num(g_pCvarCostHealthT1))
{
cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostHealthT1));
set_user_health(id, get_user_health(id) + get_pcvar_num(g_pCvarQuantityHealthT1));
client_print_color(id, DontChange, "^4%s ^1You just bought the ^3%d HP^1!", g_prefix, get_pcvar_num(g_pCvarQuantityHealthT1));
}
else
{
client_print_color(id, DontChange, "^4%s ^1You do not have enough'^3argent^1!", g_prefix);
}
}
case 4:
{
if ( iMoney >= get_pcvar_num(g_pCvarCostHealthT2))
{
cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostHealthT2));
set_user_health(id, get_user_health(id) + get_pcvar_num(g_pCvarQuantityHealthT2));
client_print_color(id, DontChange, "^4%s ^1You just bought the ^3%d HP^1!", g_prefix, get_pcvar_num(g_pCvarQuantityHealthT2));
}
else
{
client_print_color(id, DontChange, "^4%s ^1You do not have enough'^3argent^1!", g_prefix);
}
}
case 5:
{
if ( iMoney >= get_pcvar_num(g_pCvarCostInvisinsibilite))
{
cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(g_pCvarCostInvisinsibilite));
set_user_godmode(id, 1);
set_task(0.0 + get_pcvar_float(g_pCvarTimeInvisinsibilite), "RemoveGodMode", id);
client_print_color(id, DontChange, "^4%s ^1You just bought the'^3invincibilite^1 pour^3 quelques secondes^1!", g_prefix);
}
else
{
client_print_color(id, DontChange, "^4%s ^1You do not have enough'^3argent^1!", g_prefix);
}
}
}
menu_destroy(menu1);
return PLUGIN_HANDLED;
}
public RemoveGodMode(id)
{
set_user_godmode(id, 0);
client_print_color(id, DontChange, "^4%s ^1Tu n'es plus invincible!", g_prefix);
}
public BaseBuilderShop(id, menu2, item)
{
if (item == MENU_EXIT || !is_user_alive(id) || cs_get_user_team(id) != CS_TEAM_CT)
{
menu_destroy(menu2);
return PLUGIN_HANDLED;
}
new iMoney = cs_get_user_money(id);
switch(item)
{
case 0:
{
if ( iMoney >= get_pcvar_num(g_pCvarCostSuperCut))
{
cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSuperCut));
g_bHasSuperKnife[id] = true;
client_print_color(id, DontChange, "^4%s ^1You just bought the ^3Super Cut^1!", g_prefix);
}
else
{
client_print_color(id, DontChange, "^4%s ^1You do not have enough'^3argent^1!", g_prefix);
}
}
case 1:
{
if ( iMoney >= get_pcvar_num(g_pCvarCostSpeed))
{
cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSpeed));
g_bHasSuperSpeed[id] = true;
set_user_maxspeed(id, get_pcvar_float(g_pCvarQuantitySpeed));
client_print_color(id, DontChange, "^4%s ^1You just bought the ^3Super Speed^1!", g_prefix);
}
else
{
client_print_color(id, DontChange, "^4%s ^1You do not have enough'^3argent^1!", g_prefix);
}
}
case 2:
{
if ( iMoney >= get_pcvar_num(g_pCvarCostLowGrav))
{
cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostLowGrav));
set_user_gravity(id, get_pcvar_float(g_pCvarQuantityLowGrav));
client_print_color(id, DontChange, "^4%s ^1You just bought the ^3Low Gravity^1!", g_prefix);
}
else
{
client_print_color(id, DontChange, "^4%s ^1You do not have enough'^3argent^1!", g_prefix);
}
}
case 3:
{
if ( iMoney >= get_pcvar_num(g_pCvarCostHealthCT))
{
cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostHealthCT));
set_user_health(id, get_user_health(id) + get_pcvar_num(g_pCvarQuantityHealthCT));
client_print_color(id, DontChange, "^4%s ^1You just bought the ^3%d HP^1!", g_prefix, get_pcvar_num(g_pCvarQuantityHealthCT));
}
else
{
client_print_color(id, DontChange, "^4%s ^1You do not have enough'^3argent^1!", g_prefix);
}
}
case 4:
{
if ( iMoney >= get_pcvar_num(g_pCvarCostHE))
{
cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostHE));
give_item(id, "weapon_hegrenade");
client_print_color(id, DontChange, "^4%s ^1You just bought the ^3HE^1!", g_prefix);
}
else
{
client_print_color(id, DontChange, "^4%s ^1You do not have enough'^3argent^1!", g_prefix);
}
}
case 5:
{
if ( iMoney >= get_pcvar_num(g_pCvarCostFlash))
{
cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostFlash));
give_item(id, "weapon_flashbang");
client_print_color(id, DontChange, "^4%s ^1You just bought the ^3Flash^1!", g_prefix);
}
else
{
client_print_color(id, DontChange, "^4%s ^1You do not have enough'^3argent^1!", g_prefix);
}
}
case 6:
{
if ( iMoney >= get_pcvar_num(g_pCvarCostSmoke))
{
cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSmoke));
give_item(id, "weapon_smokegrenade");
client_print_color(id, DontChange, "^4%s ^1You just bought the ^3Smoke^1!", g_prefix);
}
else
{
client_print_color(id, DontChange, "^4%s ^1You do not have enough'^3argent^1!", g_prefix);
}
}
case 7:
{
if ( iMoney >= get_pcvar_num(g_pCvarCostSuperM249))
{
cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSuperM249));
give_item(id, "weapon_m249");
cs_set_user_bpammo(id, CSW_M249, 200);
g_bHasSuperM249[id] = true;
client_print_color(id, DontChange, "^4%s ^1You just bought the ^3Super M249^1!", g_prefix);
}
else
{
client_print_color(id, DontChange, "^4%s ^1You do not have enough'^3argent^1!", g_prefix);
}
}
case 8:
{
if ( iMoney >= get_pcvar_num(g_pCvarCostSuperAWP))
{
cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSuperAWP));
give_item(id, "weapon_awp");
cs_set_user_bpammo(id, CSW_AWP, 30);
g_bHasSuperAWP[id] = true;
client_print_color(id, DontChange, "^4%s ^1You just bought the ^3Super AWP^1!", g_prefix);
}
else
{
client_print_color(id, DontChange, "^4%s ^1You do not have enough'^3argent^1!", g_prefix);
}
}
case 9:
{
if ( iMoney >= get_pcvar_num(g_pCvarCostSuperDeagle))
{
cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSuperDeagle));
give_item(id, "weapon_deagle");
cs_set_user_bpammo(id, CSW_DEAGLE, 35);
g_bHasSuperDeagle[id] = true;
client_print_color(id, DontChange, "^4%s ^1You just bought the ^3Super Deagle^1!", g_prefix);
}
else
{
client_print_color(id, DontChange, "^4%s ^1You do not have enough'^3argent^1!", g_prefix);
}
}
case 10:
{
if ( iMoney >= get_pcvar_num(g_pCvarCostKitGuns))
{
cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostKitGuns));
give_item(id, "weapon_deagle");
give_item(id, "weapon_m4a1");
give_item(id, "weapon_hegrenade");
cs_set_user_bpammo(id, CSW_DEAGLE, 35);
cs_set_user_bpammo(id, CSW_M4A1, 90);
g_bHasGunsKit[id] = true;
client_print_color(id, DontChange, "^4%s ^1You just bought the ^3Kit Guns^1!", g_prefix);
}
else
{
client_print_color(id, DontChange, "^4%s ^1You do not have enough ^3argent^1!", g_prefix);
}
}
case 11:
{
client_cmd(id, "say /goldenak");
}
}
menu_destroy(menu2);
return PLUGIN_HANDLED;
}
public Player_Spawn_Post( id )
{
if(is_user_alive(id))
{
//client_print(id, print_chat, "Server have /shop to zombie or survivor");
g_bHasSuperKnife[id] = false;
g_bHasSuperSpeed[id] = false;
g_bHasSuperM249[id] = false;
g_bHasSuperAWP[id] = false;
g_bHasSuperDeagle[id] = false;
g_bHasGunsKit[id] = false;
}
}
public client_disconnect(id)
{
g_bHasSuperKnife[id] = false;
g_bHasSuperSpeed[id] = false;
g_bHasSuperM249[id] = false;
g_bHasSuperAWP[id] = false;
g_bHasSuperDeagle[id] = false;
g_bHasGunsKit[id] = false;
}
public plugin_precache()
{
precache_model(g_ModelSuperKnife);
precache_model(g_ModelSuperDeagle);
}
public ham_TakeDamage_Pre(victim, inflictor, attacker, Float:damage, damage_bits)
{
if( !IsPlayer( attacker ) || !is_user_alive( attacker ) || inflictor != attacker )
{
return;
}
if ( g_bHasSuperKnife[attacker] && get_user_weapon(attacker) == CSW_KNIFE )
{
SetHamParamFloat( 4, damage * 231 );
}
if ( g_bHasSuperM249[attacker] && get_user_weapon(attacker) == CSW_M249 )
{
SetHamParamFloat( 4, damage * 2 );
}
if ( g_bHasSuperAWP[attacker] && get_user_weapon(attacker) == CSW_AWP )
{
SetHamParamFloat( 4, damage * 2 );
}
if ( g_bHasSuperDeagle[attacker] && get_user_weapon(attacker) == CSW_DEAGLE )
{
SetHamParamFloat( 4, damage * 4 );
}
if ( g_bHasGunsKit[attacker] && ( get_user_weapon(attacker) == CSW_M4A1 || CSW_DEAGLE ) )
{
SetHamParamFloat( 4, damage * 2 );
}
}
public ham_ItemDeploy_Post_KNI(weapon_ent)
{
static owner;
owner = get_pdata_cbase(weapon_ent, 41, 4);
if(is_user_alive(owner) && g_bHasSuperKnife[owner])
{
set_pev(owner, pev_viewmodel2, g_ModelSuperKnife);
}
}
public ham_ItemDeploy_Post_DGL(weapon_ent)
{
static owner;
owner = get_pdata_cbase(weapon_ent, 41, 4);
if(is_user_alive(owner) && ( g_bHasSuperDeagle[owner] || g_bHasGunsKit[owner] ) )
{
set_pev(owner, pev_viewmodel2, g_ModelSuperDeagle);
}
}
public Player_ResetMaxSpeed(id)
{
if( is_user_alive(id) && get_user_maxspeed(id) != -1.0 && g_bHasSuperSpeed[id])
{
set_user_maxspeed(id, get_pcvar_float(g_pCvarQuantitySpeed));
}
}
stock const g_szTeamName[Colors][] =
{
"UNASSIGNED",
"TERRORIST",
"CT",
"SPECTATOR"
};
stock client_print_color(id, iColor=DontChange, const szMsg[], any:...)
{
if( id && !is_user_connected(id) )
{
return 0;
}
if( iColor > Grey )
{
iColor = DontChange;
}
new szMessage[192];
if( iColor == DontChange )
{
szMessage[0] = 0x04;
}
else
{
szMessage[0] = 0x03;
}
new iParams = numargs();
if(id)
{
if( iParams == 3 )
{
copy(szMessage[1], charsmax(szMessage)-1, szMsg);
}
else
{
vformat(szMessage[1], charsmax(szMessage)-1, szMsg, 4);
}
if( iColor )
{
new szTeam[11];
get_user_team(id, szTeam, charsmax(szTeam));
Send_TeamInfo(id, id, g_szTeamName[iColor]);
Send_SayText(id, id, szMessage);
Send_TeamInfo(id, id, szTeam);
}
else
{
Send_SayText(id, id, szMessage);
}
}
return 1;
}
stock Send_TeamInfo(iReceiver, iPlayerId, szTeam[])
{
static iTeamInfo = 0;
if( !iTeamInfo )
{
iTeamInfo = get_user_msgid("TeamInfo");
}
message_begin(iReceiver ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, iTeamInfo, .player=iReceiver);
write_byte(iPlayerId);
write_string(szTeam);
message_end();
}
stock Send_SayText(iReceiver, iPlayerId, szMessage[])
{
static iSayText = 0;
if( !iSayText )
{
iSayText = get_user_msgid("SayText");
}
message_begin(iReceiver ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, iSayText, .player=iReceiver);
write_byte(iPlayerId);
write_string(szMessage);
message_end();
}