PHP Code:
#include <amxmodx>
#include <colorchat>
#include <fun>
#include <cstrike>
#define VIP_FLAG ADMIN_LEVEL_H
#pragma semicolon 1
new const szCmds[][] = { "say /vip", "say_team /vip" };
new bool:Vip[33], g_maxplayers, MainMenu, WeaponsMenu, HealthMenu;
new const szGuns[][] = { "weapon_ak47", "weapon_m4a1", "weapon_famas", "weapon_galil", "weapon_m249", "weapon_g3sg1", "weapon_awp" };
const WEAPON_BITSUM = ((1<<CSW_SCOUT) | (1<<CSW_XM1014) | (1<<CSW_MAC10) | (1<<CSW_AUG) | (1<<CSW_UMP45) | (1<<CSW_SG550) | (1<<CSW_P90) | (1<<CSW_FAMAS) | (1<<CSW_AWP) | (1<<CSW_MP5NAVY) | (1<<CSW_M249) | (1<<CSW_M3) | (1<<CSW_M4A1) | (1<<CSW_TMP) | (1<<CSW_G3SG1) | (1<<CSW_SG552) | (1<<CSW_AK47) | (1<<CSW_GALI));
new const szGunsNames[][] = { "AK47", "M4A1", "Famas", "Galil", "M249", "G3SG1", "AWP" };
new const iCenaPuske[] = { 2300, 2000, 2000, 2700, 8000, 7000, 3000 };
new const iCenaHP[] = { 1500, 2500, 3000, 4000};
new const iHealth[] = { 50, 100, 150, 200 };
new const szMainMenuItems[][] = { "\rWeapons Shop", "\yHealth Shop" };
new const szHealthMenuItems[][] = { "\y+50 HP \rCena: \w1500$", "\y+100 HP \rCena: \w2500$", "\y+150 HP \rCena: \w3000$", "\y+200 HP \rCena: \w4000$" };
new const szWeaponsMenuItems[][] = {
"\yAK47 Cena: \w2300$", "\yM4A1 Cena: \w2000$", "\yFAMAS Cena: \w2000$", "\yGALIL Cena: \w2700$",
"\yM249 \r(MASINKA) \yCena: \w8000$", "\yG3SG1 \r(RAFALNI SNIPER) \yCena: \w7000$", "\yAWP Cena: \w3000$"
};
public plugin_init()
register_plugin("VIP BB", "1.0", "Cs-Pr0.");
register_message(get_user_msgid( "ScoreAttrib" ),"VipScoreboard");
register_event("DeathMsg", "Death", "a");
register_clcmd("say /vipshop", "VipShopCmd");
set_task(120.0, "reklama", _, _, _, "b");
g_maxplayers = get_maxplayers();
for(new i = 0; i < sizeof szCmds; i++) register_clcmd(szCmds[i], "cjenovnikCmd");
MainMenu = menu_create("VIP Shop", "VipShopHandler");
for(new i = 0; i < sizeof szMainMenuItems; i++) menu_additem(MainMenu, szMainMenuItems[i]);
WeaponsMenu = menu_create("\rWeapons Shop", "WeaponsMenuHandler");
for(new x = 0; x < sizeof szWeaponsMenuItems; x++) menu_additem(WeaponsMenu, szWeaponsMenuItems[x]);
HealthMenu = menu_create("\rHealth Shop", "HealthMenuHandler");
for(new z = 0; z < sizeof szHealthMenuItems; z++) menu_additem(HealthMenu, szHealthMenuItems[z]);
}
public client_putinserver(id) if(get_user_flags(id) & VIP_FLAG) Vip[id] = true;
public client_disconnect(id) if(Vip[id]) Vip[id] = false;
public VipScoreboard() {
new i = get_msg_arg_int(1);
if(is_user_alive(i) && Vip[i]) set_msg_arg_int(2, ARG_BYTE, get_msg_arg_int(2)|4);
}
public Death(id) {
new attacker = read_data(1);
if(attacker > g_maxplayers || !Vip[attacker] || !is_user_alive(attacker)) return;
set_user_health(attacker, get_user_health(attacker) + 20);
}
public VipShopCmd(id) if(Vip[id] && is_user_alive(id)) menu_display(id, MainMenu);
public VipShopHandler(id, menu, item) {
if(item == MENU_EXIT) return PLUGIN_HANDLED;
switch(item) {
case 0: menu_display(id, WeaponsMenu);
case 1: menu_display(id, HealthMenu);
}
return PLUGIN_HANDLED;
}
public WeaponsMenuHandler(id, menu, item) {
if(item == MENU_EXIT) return PLUGIN_HANDLED;
new iMoney = cs_get_user_money(id);
new szText[200];
if(iMoney < iCenaPuske[item]) szText = "^4[Shop]^1 Nemas dovoljno para za ovu kupovinu";
else {
cs_set_user_money(id, iMoney - iCenaPuske[item]);
give_item(id, szGuns[item]);
static weapons[32], num;
get_user_weapons(id, weapons, num);
for (new i = 0; i < num; i++)
{
if (WEAPON_BITSUM & (1<<weapons[i]))
{
static wname[32];
get_weaponname(weapons[i], wname, sizeof wname - 1);
cs_set_user_bpammo(id, WEAPON_BITSUM, 200);
}
}
formatex(szText, charsmax(szText), "^4[Shop]^1 Kupio si^3 %s^1 za^3 %i^1$", szGunsNames[item], iCenaPuske[item]);
}
ColorChat(id, TEAM_COLOR, szText);
return PLUGIN_HANDLED;
}
public HealthMenuHandler(id, menu, item) {
if(item == MENU_EXIT) return PLUGIN_HANDLED;
new iMoney = cs_get_user_money(id);
new szText[200];
if(iMoney < iCenaHP[item]) szText = "^4[Shop]^1 Nemas dovoljno para za ovu kupovinu";
else {
cs_set_user_money(id, iMoney - iCenaHP[item]);
set_user_health(id, get_user_health(id) + iHealth[item]);
formatex(szText, charsmax(szText), "^4[Shop]^1 Kupio si^3 %s^1 za^3 %i^1$", iHealth[item], iCenaHP[item]);
}
ColorChat(id, TEAM_COLOR, szText);
return PLUGIN_HANDLED;
}
public cjenovnikCmd(id) {
static motd[1501], len;
new szName[33];
get_user_name(id, szName, charsmax(szName));
len = format(motd, 1500,"<body bgcolor=#000000><font color=#87cefa><pre>");
len += format(motd[len], 1500-len,"<h4><font color=^"blue^">%s - Sta dobijas ako si vip ? :</font></h4>", szName);
len += format(motd[len], 1500-len,"<h4><font color=^"white^"><B>-</B> </font></h4>");
len += format(motd[len], 1500-len,"<h4><font color=^"red^">VIP za svaki kill dobija 20 HP</font></h4>");
len += format(motd[len], 1500-len,"<h4><font color=^"red^">U ScoreBaru pise VIP</font></h4>");
len += format(motd[len], 1500-len,"<h4><font color=^"red^">VIP ima svoj SHOP!</font></h4>");
len += format(motd[len], 1500-len,"<h4><font color=^"white^"><B>-</B> </font></h4>");
show_motd(id, motd, "cjenovnik");
return PLUGIN_CONTINUE;
}
public reklama() ColorChat(0, TEAM_COLOR, "^4[Shop]^1 Ako si^4 VIP^3 say /vipshop^1 da otvoris shop, VIP Sposobnosti say^3 /vip");