/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <fun>
#include <colorchat>
#include <cstrike>
#include <hamsandwich>
#define PLUGIN "Fegyvermenu"
#define VERSION "2.0"
#define AUTHOR "Silent"
new const fegyvernevek[][] = {
"M4A1 Colt",
"AK47 Kalasnikov",
"AWP Magnum",
"Scout",
"Sima shotgun",
"IMI galil"
}
new const fegyverertek[][] = {
"weapon_m4a1",
"weapon_ak47",
"weapon_awp",
"weapon_scout",
"weapon_m3",
"weapon_galil"
}
new cEnable;
new cOnspawn;
new cOncommand;
new cCommandpunish;
new cPunishamount;
new cCommandbuyzone;
new cColorchat;
new cWP;
new cSecond;
new cAdvert;
new gWP = 0;
new bool:gBombas[33] = false;
new bool:gHirdetes = false;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
RegisterHam(Ham_Spawn, "player", "fwUjraeled", 1);
register_clcmd("say /fegyver", "parancs");
register_logevent("bomb_is_dropped", 3, "2=Dropped_The_Bomb");
register_logevent("logevent_round_end", 2, "1=Round_End")
cEnable = register_cvar("fmenu_bekapcsolva", "1");
cOnspawn = register_cvar("fmenu_automenu", "1");
cOncommand = register_cvar("fmenu_parancs", "1");
cCommandpunish = register_cvar("fmenu_buntetes", "1");
cPunishamount = register_cvar("fmenu_mennyiseg", "15");
cCommandbuyzone = register_cvar("fmenu_buyzone", "1");
cColorchat = register_cvar("fmenu_szineschat", "1");
cWP = register_cvar("fmenu_wpkorlat", "4");
cSecond = register_cvar("fmenu_pisztoly", "deagle");
cAdvert = register_cvar("fmenu_hirdetes", "30.0");
register_dictionary("fegyvermenu.txt");
AdvertChck();
}
public logevent_round_end()
{
gWP = 0;
new i = 0;
while(i < 33)
{
gBombas[i] = false;
i++
}
}
public AdvertChck()
{
if(get_pcvar_float(cAdvert) > 0.0 || !get_pcvar_num(cEnable))
{
set_task(get_pcvar_float(cAdvert), "AdvertChck");
gHirdetes ? elso() : masodik();
}
}
public elso()
{
if(get_pcvar_num(cColorchat))
ColorChat(0, BLUE, "%L", LANG_PLAYER, "HIRDETES", AUTHOR);
else
client_print(0, print_chat, "%L", LANG_PLAYER, "HIRDETES", AUTHOR);
gHirdetes = false;
}
public masodik()
{
if(get_pcvar_num(cColorchat))
ColorChat(0, BLUE, "%L", LANG_PLAYER, "HIRDETES2", AUTHOR);
else
client_print(0, print_chat, "%L", LANG_PLAYER, "HIRDETES2", AUTHOR);
gHirdetes = true;
}
public fwUjraeled(id)
{
cs_set_user_money(id, 0, 0);
if(get_pcvar_num(cOnspawn) && is_user_alive(id))
fegyvermenu(id);
else
return PLUGIN_CONTINUE;
return PLUGIN_CONTINUE;
}
public parancs(id)
{
if(!get_pcvar_num(cEnable) || !get_pcvar_num(cOncommand))
return PLUGIN_CONTINUE;
if(get_pcvar_num(cCommandbuyzone) && !cs_get_user_buyzone(id))
{
if(get_pcvar_num(cColorchat))
ColorChat(id, RED, "%L", LANG_PLAYER, "CSAK_BUYZONE");
else
client_print(id, print_chat, "%L", LANG_PLAYER, "CSAK_BUYZONE");
return PLUGIN_HANDLED;
}
switch(get_pcvar_num(cCommandpunish))
{
case 0: semmi();
case 1: set_user_health(id, get_user_health(id)-get_pcvar_num(cPunishamount));
}
fegyvermenu(id);
return PLUGIN_HANDLED;
}
semmi() { }
public fegyvermenu(id)
{
if(!get_pcvar_num(cEnable))
return PLUGIN_CONTINUE;
new l_str[64];
format(l_str, charsmax(l_str), "%s v%s by: %s",PLUGIN, VERSION, AUTHOR);
new menu = menu_create(l_str, "fegyvermenu_handler");
for(new i=0; i<sizeof(fegyvernevek); i++)
{
menu_additem(menu, fegyvernevek[i], fegyverertek[i], 0);
}
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
return PLUGIN_HANDLED;
}
public fegyvermenu_handler(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[15], szName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);
if(equal(data, "weapon_awp"))
{
if(gWP == get_pcvar_num(cWP))
{
if(get_pcvar_num(cColorchat))
ColorChat(id, RED, "%L", LANG_PLAYER, "MAX_WP");
else
client_print(id, print_chat, "%L", LANG_PLAYER, "MAX_WP");
fegyvermenu(id);
return PLUGIN_HANDLED;
}
else
{
bombacheck(id);
give_item(id, data);
cs_set_user_bpammo(id, weapon_to_csw(data), 200);
give_item(id, pisztolykell())
cs_set_user_bpammo(id, weapon_to_csw(pisztolykell()), 200);
if(gBombas[id] == true)
{
give_item(id, "weapon_c4");
cs_set_user_plant(id, 1, 1);
}
if(get_pcvar_num(cColorchat))
ColorChat(id, GREEN, "%L", LANG_PLAYER, "KAPTAL_VMIT");
else
client_print(id, print_chat, "%L", LANG_PLAYER, "KAPTAL_VMIT");
gWP++;
return PLUGIN_HANDLED;
}
}
bombacheck(id);
give_item(id, data);
//Granatok
give_item(id, "weapon_hegrenade");
give_item(id, "weapon_flashbang");
give_item(id, "weapon_flashbang");
give_item(id, "weapon_smokegrenade");
//Granatok vege
cs_set_user_bpammo(id, weapon_to_csw(data), 200);
give_item(id, pisztolykell())
cs_set_user_bpammo(id, weapon_to_csw(pisztolykell()), 200);
if(gBombas[id] == true)
{
give_item(id, "weapon_c4");
cs_set_user_plant(id, 1, 1);
}
if(get_pcvar_num(cColorchat))
ColorChat(id, GREEN, "%L", LANG_PLAYER, "KAPTAL_VMIT");
else
client_print(id, print_chat, "%L", LANG_PLAYER, "KAPTAL_VMIT");
return 0;
}
public weapon_to_csw(weapon[])
{
if(equal(weapon, "weapon_m4a1"))
return CSW_M4A1;
else if(equal(weapon, "weapon_ak47"))
return CSW_AK47;
else if(equal(weapon, "weapon_awp"))
return CSW_AWP;
else if(equal(weapon, "weapon_famas"))
return CSW_FAMAS;
else if(equal(weapon, "weapon_aug"))
return CSW_AUG;
else if(equal(weapon, "weapon_g3sg1"))
return CSW_G3SG1;
else if(equal(weapon, "weapon_galil"))
return CSW_GALIL;
else if(equal(weapon, "weapon_m249"))
return CSW_M249;
else if(equal(weapon, "weapon_m3"))
return CSW_M3;
else if(equal(weapon, "weapon_mac10"))
return CSW_MAC10;
else if(equal(weapon, "weapon_mp5navy"))
return CSW_MP5NAVY;
else if(equal(weapon, "weapon_p90"))
return CSW_P90;
else if(equal(weapon, "weapon_scout"))
return CSW_SCOUT;
else if(equal(weapon, "weapon_sg550"))
return CSW_SG550;
else if(equal(weapon, "weapon_sg552"))
return CSW_SG552;
else if(equal(weapon, "weapon_tmp"))
return CSW_TMP;
else if(equal(weapon, "weapon_ump45"))
return CSW_UMP45;
else if(equal(weapon, "weapon_xm1014"))
return CSW_XM1014;
else if(equal(weapon, "weapon_deagle"))
return CSW_DEAGLE;
else if(equal(weapon, "weapon_elite"))
return CSW_ELITE;
else if(equal(weapon, "weapon_fiveseven"))
return CSW_FIVESEVEN;
else if(equal(weapon, "weapon_glock18"))
return CSW_GLOCK18;
else if(equal(weapon, "weapon_p228"))
return CSW_P228;
else if(equal(weapon, "weapon_usp"))
return CSW_USP;
return -1;
}
public pisztolykell()
{
new returnertek[15];
new cvarertek[10];
get_pcvar_string(cSecond, cvarertek, 9);
format(returnertek, 14, "weapon_%s", cvarertek);
return returnertek;
}
public bombacheck(id)
{
if(user_has_weapon(id, CSW_C4))
gBombas[id] = true;
strip_user_weapons(id);
give_item(id, "weapon_knife");
}
public bomb_is_dropped()
{
new player = get_loguser_index();
gBombas[player] = false;
}
stock get_loguser_index()
{
new loguser[80], name[32];
read_logargv(0, loguser, 79);
parse_loguser(loguser, name, 31);
return get_user_index(name);
}