PHP Code:
native hnsxp_get_user_xp(client);
native hnsxp_set_user_xp(client, xp);
stock hnsxp_add_user_xp(client, xp)
{
return hnsxp_set_user_xp(client, hnsxp_get_user_xp(client) + xp);
}
stock hnsxp_sub_user_xp(client, xp)
{
return hnsxp_set_user_xp(client, hnsxp_get_user_xp(client) - xp);
}
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fun>
#include <cstrike>
#include <colorchat>
#define PLUGIN "[HB] VIP Mod"
#define AUTHOR "HBxander, Larcyn"
#define VERSION "1.4"
#define clantac "^x04[HB]"
new g_iMoney[33];
new awp_cost;
new deagle_cost;
new shotgun_cost;
new fiveseven_cost;
new hegren_cost;
new respawn_cost;
new colt_cost;
new xp_amount;
new xp_cost;
new hp_amount;
new hp_cost;
new scout_cost;
new frost_cost;
new price;
new bought_respawn;
new bought_xp;
new bought_hp;
new bool:gbConnected[33];
new bool:got_access[33]
public plugin_init()
{
register_clcmd("say /vip", "vip_shop");
register_clcmd("say /buyvip", "buy_vip");
register_clcmd("say_team /vip", "vip_shop");
register_clcmd("say_tean /buyvip", "buy_vip");
//weapons price
awp_cost = register_cvar("vip_awpcost", "16000");
deagle_cost = register_cvar("vip_dglcost", "12000");
shotgun_cost = register_cvar("vip_m3cost", "12000");
fiveseven_cost = register_cvar("vip_fivesevencost", "8000");
colt_cost = register_cvar("vip_coltcost", "8000");
scout_cost = register_cvar("vip_scoutcost", "3000");
//grenades price
hegren_cost = register_cvar("vip_hegrencost", "8000");
frost_cost = register_cvar("vip_frostcost", "12000");
//items price
respawn_cost = register_cvar("vip_respawncost", "10000");
hp_cost = register_cvar("vip_hpcost", "6000");
xp_cost = register_cvar("vip_xpcost", "6000");
//item amount
xp_amount = register_cvar("vip_xpamount", "10");
hp_amount = register_cvar("vip_hpamount", "25");
//clantac
price = register_cvar ("vip_price", "2000");
}
public vip_shop(id)
{
new MainMenu = menu_create("\r[HB] VIP Mod by Larcyn^n^nMain Menu", "MainMenu_Handle");
menu_addblank(MainMenu, 0);
menu_additem(MainMenu, "\wWeapon Menu", "\r1", 0);
menu_additem(MainMenu, "\wItem Menu", "\r2", 0);
menu_additem(MainMenu, "\wGrenades Menu", "\r3", 0);
menu_setprop(MainMenu, MPROP_EXIT, MEXIT_ALL);
if ( got_access[id] )
{
menu_display(id, MainMenu, 0);
}
}
public MainMenu_Handle(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
new key = str_to_num(data);
switch(key)
{
case 1:
{
weapon_Menu(id);
}
case 2:
{
item_Menu(id);
}
case 3:
{
grenades_Menu(id);
}
}
return PLUGIN_CONTINUE;
}
public grenades_Menu(id)
{
new buy_hegren[60];
new buy_frost[60];
formatex(buy_hegren, sizeof(buy_hegren) - 1, "\wHeGrenade \r[Amount: \w1\r] \r[$\y%i\r]", get_pcvar_num(hegren_cost));
formatex(buy_frost, sizeof(buy_frost) - 1, "\wFrostGrenade \r[Amount: \w1\r] \r[$\y%i\r]", get_pcvar_num(frost_cost));
new gren_Menu = menu_create("\r[HB] VIP Mod by Larcyn^n^nItem Menu", "ItemMenu_Handle");
menu_additem(gren_Menu, buy_hegren, "\r1", 0);
if ( cs_get_user_team(id) == CS_TEAM_T )
{
menu_additem(gren_Menu, buy_frost, "\r2", 0);
}
menu_setprop(gren_Menu, MPROP_EXIT, MEXIT_ALL);
{
menu_display(id, gren_Menu, 0);
}
}
public GrenadesMenu_Handle(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
new key = str_to_num(data);
switch(key)
{
case 1:
{
if ( cs_get_user_money(id) < get_pcvar_num(hegren_cost) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You dont have enough money to buy`x04 He Grenade^x03!", clantac);
return PLUGIN_HANDLED;
}
if ( !is_user_alive(id) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You need to be alive!", clantac);
return PLUGIN_HANDLED;
}
if ( user_has_weapon(id, CSW_HEGRENADE) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You already own the^x04 He Grenade^x03!", clantac);
return PLUGIN_HANDLED;
}
new name[32];
get_user_name(id, name, 32);
cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(hegren_cost));
cs_set_weapon_ammo( give_item(id, "weapon_hegren"), 0);
cs_set_user_bpammo(id, CSW_HEGRENADE, (cs_get_user_bpammo(id, CSW_HEGRENADE) + 1));
ColorChat(0, GREY, "%s VIP Mod:^x03 %s bought the^x04 He Grenade^x03 [^x04$%i^x03]", clantac, name, get_pcvar_num(hegren_cost));
}
case 2:
{
if ( cs_get_user_money(id) < get_pcvar_num(frost_cost) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You dont have enough money to buy`x04 Frost Grenade^x03!", clantac);
return PLUGIN_HANDLED;
}
if ( !is_user_alive(id) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You need to be alive!", clantac);
return PLUGIN_HANDLED;
}
if ( user_has_weapon(id, CSW_SMOKEGRENADE) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You already own the^x04 Frost Grenade^x03!", clantac);
return PLUGIN_HANDLED;
}
new name[32];
get_user_name(id, name, 32);
cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(frost_cost));
cs_set_weapon_ammo( give_item(id, "weapon_sgren"), 0);
cs_set_user_bpammo(id, CSW_SMOKEGRENADE, (cs_get_user_bpammo(id, CSW_SMOKEGRENADE) + 1));
ColorChat(0, GREY, "%s VIP Mod:^x03 %s bought the^x04 Frost Grenade^x03 [^x04$%i^x03]", clantac, name, get_pcvar_num(frost_cost));
}
}
return PLUGIN_CONTINUE;
}
public TaskRespawn(id)
{
if ( cs_get_user_money(id) < get_pcvar_num(respawn_cost) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You dont have enough money to buy this item!", clantac);
return PLUGIN_HANDLED;
}
if ( bought_respawn == 1 )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You have already bought respawn this round!", clantac);
return PLUGIN_HANDLED;
}
if ( is_user_alive(id) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You cannot buy respawn while your alive!", clantac);
return PLUGIN_HANDLED;
}
new name[32];
get_user_name(id, name, 32);
cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(respawn_cost) );
ExecuteHamB(Ham_CS_RoundRespawn, id);
ColorChat(0, GREY, "%s VIP Mod:^x03 %s bought ^x04respawn^x03!", clantac, name);
bought_respawn = 1;
return PLUGIN_HANDLED;
}
public weapon_Menu(id)
{
new buy_awp[60];
new buy_deagle[60];
new buy_shotgun[60];
new buy_colt[60];
new buy_fiveseven[60];
new buy_scout[60];
formatex(buy_awp, sizeof(buy_awp) - 1, "\wAWP \r[Bullets: \w1\r] \r[$\y%i\r]", get_pcvar_num(awp_cost));
formatex(buy_deagle, sizeof(buy_deagle) - 1, "\wDeagle \r[Bullets: \w1\r] \r[$\y%i\r]", get_pcvar_num(deagle_cost));
formatex(buy_shotgun, sizeof(buy_shotgun) - 1, "\wShotGun \r[Bullets: \w1\r] \r[$\y%i\r]", get_pcvar_num(shotgun_cost));
formatex(buy_colt, sizeof(buy_colt) - 1, "\wColt \r[Bullets: \w1\r] \r[$\y%i\r]", get_pcvar_num(colt_cost));
formatex(buy_fiveseven, sizeof(buy_fiveseven) - 1, "\wFiveSeven \r[Bullets: \w2\r] \r[$\y%i\r]", get_pcvar_num(fiveseven_cost));
formatex(buy_scout, sizeof(buy_scout) - 1, "\wScout \r[Bullets: \w0\r] \r[$\y%i\r]", get_pcvar_num(scout_cost));
new wep_Menu = menu_create("\r [HB] VIP Mod by Larcyn^n^nWeapon Menu", "wepMenu_Handle");
menu_additem(wep_Menu, buy_awp, "\r1", 0);
menu_additem(wep_Menu, buy_deagle, "\r2", 0);
menu_additem(wep_Menu, buy_shotgun, "\r3", 0);
menu_additem(wep_Menu, buy_colt, "\r4", 0);
menu_additem(wep_Menu, buy_fiveseven, "\r5", 0);
menu_additem(wep_Menu, buy_scout, "\r6", 0);
menu_setprop(wep_Menu, MPROP_EXIT, MEXIT_ALL);
{
menu_display(id, wep_Menu, 0);
}
}
public wepMenu_Handle(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
new key = str_to_num(data);
switch(key)
{
case 1:
{
if ( cs_get_user_money(id) < get_pcvar_num(awp_cost) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You dont have enough money to buy this item!", clantac);
return PLUGIN_HANDLED;
}
if ( !is_user_alive(id) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You need to be alive!", clantac);
return PLUGIN_HANDLED;
}
if ( user_has_weapon(id, CSW_AWP) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You already own this weapon!", clantac);
return PLUGIN_HANDLED;
}
new name[32];
get_user_name(id, name, 32)
cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(awp_cost) );
cs_set_weapon_ammo( give_item(id, "weapon_awp"), 1);
ColorChat(0, GREY, "%s VIP Mod:^x03 %s bought the^x04 AWP^x03 [^x04$%i^x03]", clantac, name, get_pcvar_num(awp_cost));
}
case 2:
{
if ( cs_get_user_money(id) < get_pcvar_num(deagle_cost) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You dont have enough money to buy this item!", clantac);
return PLUGIN_HANDLED;
}
if ( !is_user_alive(id) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You need to be alive!", clantac);
return PLUGIN_HANDLED;
}
if ( user_has_weapon(id, CSW_DEAGLE) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You already own this weapon!", clantac);
return PLUGIN_HANDLED;
}
new name[32];
get_user_name(id, name, 32)
cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(deagle_cost));
cs_set_weapon_ammo( give_item(id, "weapon_deagle"), 1);
ColorChat(0, GREY, "%s VIP Mod:^x03 %s bought the^x04 Deagle^x03 [$%i]", clantac, name, get_pcvar_num(deagle_cost));
}
case 3:
{
if ( cs_get_user_money(id) < get_pcvar_num(shotgun_cost) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You dont have enough money to buy this item!", clantac);
return PLUGIN_HANDLED;
}
if ( !is_user_alive(id) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You need to be alive!", clantac);
return PLUGIN_HANDLED;
}
if ( user_has_weapon(id, CSW_M3) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You already own this weapon!", clantac);
return PLUGIN_HANDLED;
}
new name[32];
get_user_name(id, name, 32);
cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(shotgun_cost));
cs_set_weapon_ammo( give_item(id, "weapon_shotgun"), 1);
ColorChat(0, GREY, "%s VIP Mod:^x03 %s bought the^x04 ShotGun^x03 [^x04$%i^x03]", clantac, name, get_pcvar_num(shotgun_cost));
}
case 4:
{
if ( cs_get_user_money(id) < get_pcvar_num(colt_cost) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You dont have enough money to buy this item!", clantac);
return PLUGIN_HANDLED;
}
if ( !is_user_alive(id) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You need to be alive!", clantac);
return PLUGIN_HANDLED;
}
if ( user_has_weapon(id, CSW_M4A1) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You already own this weapon!", clantac);
return PLUGIN_HANDLED;
}
new name[32];
get_user_name(id, name, 32);
cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(colt_cost));
cs_set_weapon_ammo( give_item(id, "weapon_m4a1"), 1);
ColorChat(0, GREY, "%s VIP Mod:^x03 %s bought the^x04 Colt^x03 [^x04$%i^x03]", clantac, name, get_pcvar_num(colt_cost));
}
case 5:
{
if ( cs_get_user_money(id) < get_pcvar_num(fiveseven_cost) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You dont have enough money to buy this item!", clantac);
return PLUGIN_HANDLED;
}
if ( !is_user_alive(id) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You need to be alive!", clantac);
return PLUGIN_HANDLED;
}
if ( user_has_weapon(id, CSW_FIVESEVEN) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You already own this weapon!", clantac);
return PLUGIN_HANDLED;
}
new name[32];
get_user_name(id, name, 32);
cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(fiveseven_cost));
cs_set_weapon_ammo( give_item(id, "weapon_fiveseven"), 2 );
ColorChat(0, GREY, "%s VIP Mod:^x03 %s bought the^x04 FiveSeven^x03 [^x04$%i^x03]", clantac, name, get_pcvar_num(fiveseven_cost));
}
case 6:
{
if ( cs_get_user_money(id) < get_pcvar_num(scout_cost) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You dont have enough money to buy this item!", clantac);
return PLUGIN_HANDLED;
}
if ( !is_user_alive(id) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You need to be alive!", clantac);
return PLUGIN_HANDLED;
}
if ( user_has_weapon(id, CSW_SCOUT) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You already own this weapon!", clantac);
return PLUGIN_HANDLED;
}
new name[32];
get_user_name(id, name, 32);
cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(scout_cost));
cs_set_weapon_ammo( give_item(id, "weapon_scout"), 0);
ColorChat(0, GREY, "%s VIP Mod:^x03 %s bought the^x04 Scout^x03 [^x04$%i^x03]", clantac, name, get_pcvar_num(scout_cost));
}
}
return PLUGIN_CONTINUE;
}
public item_Menu(id)
{
new buy_respawn[60];
new buy_xp[60];
new buy_hp[60];
formatex(buy_respawn, sizeof(buy_respawn) - 1, "\wRespawn \r[$\y%i\r]", get_pcvar_num(respawn_cost));
formatex(buy_xp, sizeof(buy_xp) - 1, "\w%i XP \y[$\y%i\r]", get_pcvar_num(xp_amount), get_pcvar_num(xp_cost));
formatex(buy_hp, sizeof(buy_hp) - 1, "\w%i HP \r[$\y%i\r]", get_pcvar_num(shotgun_cost));
new ite_Menu = menu_create("\r[HB] VIP Mod by Larcyn^n^nItem Menu", "ItemMenu_Handle");
menu_additem(ite_Menu, buy_respawn, "\r1", 0);
menu_additem(ite_Menu, buy_xp, "\r2", 0);
menu_additem(ite_Menu, buy_hp, "\r3", 0);
menu_setprop(ite_Menu, MPROP_EXIT, MEXIT_ALL);
{
menu_display(id, ite_Menu, 0);
}
}
public ItemMenu_Handle(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
new key = str_to_num(data);
switch(key)
{
case 1:
{
set_task(0.2, "TaskRespawn", id);
}
case 2:
{
if ( cs_get_user_money(id) < get_pcvar_num(xp_cost) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You dont have enough money to buy this item!", clantac);
return PLUGIN_HANDLED;
}
if ( bought_xp == 1 )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You have already bought^x04 XP^x03 this round!", clantac);
return PLUGIN_HANDLED;
}
new name[32];
get_user_name(id, name, 32);
cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(xp_cost));
hnsxp_add_user_xp(id, get_pcvar_num(xp_amount));
ColorChat(0, GREY, "%s VIP Mod:^x03 %s bought^x04 %i^x03 more XP!", clantac, name, get_pcvar_num(xp_amount));
bought_xp = 1;
}
case 3:
{
if ( cs_get_user_money(id) < get_pcvar_num(hp_cost) )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You dont have enough money to buy this item!", clantac);
return PLUGIN_HANDLED;
}
if ( bought_hp == 1 )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You have already bought^x04 HP^x03 this round!", clantac);
return PLUGIN_HANDLED;
}
new name[32];
get_user_name(id, name, 32);
cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(hp_cost));
ColorChat(0, GREY, "%s VIP Mod:^x03 %s bought^x04 %i^x03 more HP!", clantac, name, get_pcvar_num(hp_amount));
new health = get_user_health(id);
health += get_pcvar_num(hp_amount);
}
}
return PLUGIN_CONTINUE;
}
public client_authorized(id)
{
gbConnected[id] = true;
if ( access(id, ADMIN_LEVEL_A) )
{
got_access[id] = true;
}
}
public client_disconnect(id)
{
gbConnected[id] = false;
if ( got_access[id] )
{
got_access[id] = false;
}
}
public client_putinserver(id)
{
set_task(5.0, "Task_LogonMessage", id);
g_iMoney[ id ] = -1;
}
public FwdPlayerSpawn(id)
{
if( !gbConnected[id] )
return HAM_IGNORED;
bought_respawn = 0;
bought_xp = 0;
bought_hp = 0;
return HAM_HANDLED;
}
public Task_LogonMessage(id)
{
ColorChat(id, GREY, "%s VIP Mod:^x03 Checking status for^x04 VIP^x03...", clantac);
if ( got_access[id] )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 Logged in as^x04 VIP^x03!", clantac);
ColorChat(id, GREY, "%s VIP Mod:^x03 Type^x04 /vip^x03,^x04 /vipshop^x03 or^x04 /vshop^x03 to use^x04 VIP^x03!", clantac);
}
else
{
ColorChat(id, GREY, "%s VIP Mod:^x03 Error logging in as^x04 VIP^x03!", clantac);
ColorChat(id, GREY, "%s VIP Mod:^x03 Reason: You havent bought^x04 VIP^x03 yet!", clantac);
ColorChat(id, GREY, "%s VIP Mod:^x03 Buy VIP by typing ^x04/buyvip^x03!", clantac);
}
}
public buy_vip (id)
{
new name[32];
get_user_name(id, name, 32);
if ( got_access [id] )
{
ColorChat(id, GREY, "%s VIP Mod:^x03 You are already a VIP!", clantac);
}
else
{
hnsxp_set_user_xp(id, hnsxp_get_user_xp(id) - get_pcvar_num(price));
set_user_flags(id, ADMIN_LEVEL_A);
ColorChat(0, GREY, "%s VIP Mod:^x03 %s bought^x04 VIP^x03!", clantac, name);
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang1030{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang1030{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang1030{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang1030{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/