#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fun>
#include <cstrike>
#include <colorchat>
#define PLUGIN "HideNSeek VIP Mod"
#define AUTHOR "HBxander"
#define VERSION "1.4"
new vipinfo[] = "vip_info.txt";
new vipprices[] = "vip_price.txt";
static const COLOR[] = "^x04"
new enable_Weapons;
new enable_Items;
new enable_Grenades;
new g_iMoney[33];
new clantac;
new awp_cost;
new deagle_cost;
new shotgun_cost;
new fiveseven_cost;
new hegren_cost;
new respawn_cost;
new colt_cost;
new hp_amount;
new hp_cost;
new scout_cost;
new frost_cost;
new bought_respawn;
new bought_hp;
new gMaxPlayers;
new bool:gbConnected[33];
new bool:got_access[33]
public plugin_init()
{
register_clcmd("say /vip", "show_VIPHowTo");
register_clcmd("say /vips", "print_vips");
register_clcmd("say /vs", "vip_shop");
register_clcmd("say /vipshop", "vip_shop");
register_clcmd("say /vshop", "vip_shop");
register_clcmd("say_team /vs", "vip_shop");
register_clcmd("say_team /vipshop", "vip_shop");
register_clcmd("say_team /vshop", "vip_shop");
//enable stuff
enable_Weapons = register_cvar("vip_weapons", "1");
enable_Items = register_cvar("vip_items", "1");
enable_Grenades = register_cvar("vip_grenades", "1");
//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"); hp_amount = register_cvar("vip_hpamount", "25");
//clantac
clantac = register_cvar("vip_clantac", "YourClanTac");
gMaxPlayers = get_maxplayers();
}
public vip_shop(id)
{
new MainMenu = menu_create("\rVIP Mod^n^nMain Menu", "MainMenu_Handle");
menu_additem(MainMenu, "\wInfo", "\r1", 0);
menu_additem(MainMenu, "\wPrices", "\r2", 0);
menu_addblank(MainMenu, 0);
if ( get_pcvar_num(enable_Weapons) == 1 )
{
menu_additem(MainMenu, "\wWeapon Menu", "\r3", 0);
}
if ( get_pcvar_num(enable_Items) == 1 )
{
menu_additem(MainMenu, "\wItem Menu", "\r4", 0);
}
if ( get_pcvar_num(enable_Grenades) == 1 )
{
menu_additem(MainMenu, "\wGrenades Menu", "\r5", 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:
{
show_motd(id, vipinfo, "VIP Info");
}
case 2:
{
show_motd(id, vipprices, "VIP Prices");
}
case 3:
{
weapon_Menu(id);
}
case 4:
{
item_Menu(id);
}
case 5:
{
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("\rVIP Mod^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, GREEN, "[%s] VIP Mod:^x01 You dont have enough money to buy`x04 He Grenade^x01!", clantac);
return PLUGIN_HANDLED;
}
if ( !is_user_alive(id) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 You need to be^x04 alive^x01!", clantac);
return PLUGIN_HANDLED;
}
if ( user_has_weapon(id, CSW_HEGRENADE) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 You already own the^x04 He Grenade^x01!", 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, GREEN, "[%s] VIP Mod:^x01 '%s' bought the^x04 He Grenade^x01 [$%i]", clantac, name, get_pcvar_num(hegren_cost));
}
case 2:
{
if ( cs_get_user_money(id) < get_pcvar_num(frost_cost) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 You dont have enough money to buy`x04 Frost Grenade^x01!", clantac);
return PLUGIN_HANDLED;
}
if ( !is_user_alive(id) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 You need to be ^x04alive^x01!", clantac);
return PLUGIN_HANDLED;
}
if ( user_has_weapon(id, CSW_SMOKEGRENADE) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 You already own the^x04 Frost Grenade^x01!", 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, GREEN, "[%s] VIP Mod:^x01 '%s' bought the^x04 Frost Grenade^x01 [$%i]", 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, GREEN, "[%s] VIP Mod:^x01 You dont have enough money to buy this item!", clantac);
return PLUGIN_HANDLED;
}
if ( bought_respawn == 1 )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 You have already bought respawn this round!", clantac);
return PLUGIN_HANDLED;
}
if ( is_user_alive(id) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 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, GREEN, "[%s] VIP Mod:^x01 '%s' bought respawn!", 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("\rVIP Mod^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, GREEN, "[%s] VIP Mod:^x01 You dont have enough money to buy this item!", clantac);
return PLUGIN_HANDLED;
}
if ( !is_user_alive(id) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 You need to be alive!", clantac);
return PLUGIN_HANDLED;
}
if ( user_has_weapon(id, CSW_AWP) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 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, GREEN, "[%s] VIP Mod:^x01 '%s' bought the^x04 AWP^x01 [$%i]", clantac, name, get_pcvar_num(awp_cost));
}
case 2:
{
if ( cs_get_user_money(id) < get_pcvar_num(deagle_cost) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 You dont have enough money to buy this item!", clantac);
return PLUGIN_HANDLED;
}
if ( !is_user_alive(id) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 You need to be alive!", clantac);
return PLUGIN_HANDLED;
}
if ( user_has_weapon(id, CSW_DEAGLE) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 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, GREEN, "[%s] VIP Mod:^x01 '%s' bought the^x04 Deagle^x01 [$%i]", clantac, name, get_pcvar_num(deagle_cost));
}
case 3:
{
if ( cs_get_user_money(id) < get_pcvar_num(shotgun_cost) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 You dont have enough money to buy this item!", clantac);
return PLUGIN_HANDLED;
}
if ( !is_user_alive(id) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 You need to be alive!", clantac);
return PLUGIN_HANDLED;
}
if ( user_has_weapon(id, CSW_M3) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 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, GREEN, "[%s] VIP Mod:^x01 '%s' bought the^x04 ShotGun^x01 [$%i]", clantac, name, get_pcvar_num(shotgun_cost));
}
case 4:
{
if ( cs_get_user_money(id) < get_pcvar_num(colt_cost) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 You dont have enough money to buy this item!", clantac);
return PLUGIN_HANDLED;
}
if ( !is_user_alive(id) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 You need to be alive!", clantac);
return PLUGIN_HANDLED;
}
if ( user_has_weapon(id, CSW_M4A1) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 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, GREEN, "[%s] VIP Mod:^x01 '%s' bought the^x04 Colt^x01 [$%i]", clantac, name, get_pcvar_num(colt_cost));
}
case 5:
{
if ( cs_get_user_money(id) < get_pcvar_num(fiveseven_cost) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 You dont have enough money to buy this item!", clantac);
return PLUGIN_HANDLED;
}
if ( !is_user_alive(id) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 You need to be alive!", clantac);
return PLUGIN_HANDLED;
}
if ( user_has_weapon(id, CSW_FIVESEVEN) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 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, GREEN, "[%s] VIP Mod:^x01 '%s' bought the^x04 FiveSeven^x01 [$%i]", clantac, name, get_pcvar_num(fiveseven_cost));
}
case 6:
{
if ( cs_get_user_money(id) < get_pcvar_num(scout_cost) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 You dont have enough money to buy this item!", clantac);
return PLUGIN_HANDLED;
}
if ( !is_user_alive(id) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 You need to be alive!", clantac);
return PLUGIN_HANDLED;
}
if ( user_has_weapon(id, CSW_SCOUT) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 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, GREEN, "[%s] VIP Mod:^x01 '%s' bought the^x04 Scout^x01 [$%i]", 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_hp, sizeof(buy_hp) - 1, "\w%i HP \r[$\y%i\r]", get_pcvar_num(shotgun_cost));
new ite_Menu = menu_create("\rVIP Mod^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 3:
{
if ( cs_get_user_money(id) < get_pcvar_num(hp_cost) )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 You dont have enough money to buy this item!", clantac);
return PLUGIN_HANDLED;
}
if ( bought_hp == 1 )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 You have already bought^x04 HP^x01 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, GREEN, "[%s] VIP Mod:^x01 '%s' bought^x04 %i^x01 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_hp = 0;
return HAM_HANDLED;
}
public show_VIPHowTo(id)
{
show_motd(id, "extras/ultimate_vip.motd", "How To Get VIP");
}
public Task_LogonMessage(id)
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 Checking status for^x04 VIP^x01...", clantac);
if ( got_access[id] )
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 Error logging in as^x04 VIP^x01!", clantac);
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 Reason: You havent bought^x04 VIP^x01 yet!", clantac);
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 Type^x04 /vip^x01 to see how to buy^x04 VIP^x01!", clantac);
}
else
{
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 Logged in as^x04 VIP^x01!", clantac);
ColorChat(id, GREEN, "[%s] VIP Mod:^x01 Type^x04 /vs^x01 or^x04 /vshop^x01 to use^x04 VIP^x01!", clantac);
ColorChat(0, GREEN, "[%s] VIP Mod:^x01 A new^x04 VIP^x01 has logged in! - Type^x04 /vips^x01 to see all^x04 VIPs^x01!", clantac);
}
}
F_Print(id, const sMsg[], any:...)
{
static i; i = id ? id : get_User();
if ( !i ) return;
new sMessage[256];
new len = formatex(sMessage, sizeof(sMessage) - 1, "^x04^x03 ");
vformat(sMessage[len], sizeof(sMessage) - 1 - len, sMsg, 3);
sMessage[192] = '^0';
static msgid_SayText;
if ( !msgid_SayText ) msgid_SayText = get_user_msgid("SayText");
new const team_Names[][] =
{
"",
"TERRORIST",
"CT",
"SPECTATOR"
};
new sTeam = get_user_team(i);
team_Info(i, id, team_Names[0]);
message_begin(id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, msgid_SayText, _, id);
write_byte(i);
write_string(sMessage);
message_end();
team_Info(i, id, team_Names[sTeam]);
}
team_Info(receiver, sender, sTeam[])
{
static msgid_TeamInfo;
if ( !msgid_TeamInfo ) msgid_TeamInfo = get_user_msgid("TeamInfo");
message_begin(sender ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, msgid_TeamInfo, _, sender);
write_byte(receiver);
write_string(sTeam);
message_end();
}
get_User()
{
for ( new id = 1; id <= gMaxPlayers; id++ )
{
if ( gbConnected[id] )
{
return id;
}
}
return 0;
}
public print_vips(id2)
{
new vipnames[33][32]
new message[256]
new id, count, x, len
for(id = 1 ; id <= gMaxPlayers ; id++)
if(is_user_connected(id))
if( got_access[id] )
get_user_name(id, vipnames[count++], 31)
len = format(message, 255, "%s VIPs ONLINE: ",COLOR)
if(count > 0) {
for(x = 0 ; x < count ; x++) {
len += format(message[len], 255-len, "%s%s ", vipnames[x], x < (count-1) ? ", ":"")
if(len > 96 ) {
F_Print(id2, message)
len = format(message, 255, "%s ",COLOR)
}
}
F_Print(id2, message)
}
else {
len += format(message[len], 255-len, "No VIPs online.")
F_Print(id2, message);
}
new info_ifnot[64];
format(info_ifnot, 63, "%s Contact Server Admin -- %s", COLOR)
F_Print(id2, info_ifnot);
}