#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>
#include <cstrike>
#include <nvault>
#include <fakemeta>
#define PLUGIN "Pont rendeszer"
#define AUTHOR "Small"
#define VERSION "1.0"
new g_vault
new pontok[33]
new name[33][32]
new bool:m4a1 = true
new bool:awp = true
new bool:granat = true
new bool:ak47 = true
public plugin_init()
{
register_event("DeathMsg", "Death", "a")
set_task(4.9, "hud", 0, "", 0, "b", 0);
register_clcmd("team_say shop", "shopmenu")
register_clcmd("team_say /shop", "shopmenu")
register_clcmd("say shop", "shopmenu")
register_clcmd("say /shop", "shopmenu")
g_vault = nvault_open("Ido")
}
public shopmenu(id)
{
new menu = menu_create("\rValasz a menumbol:", "menu_handler");
menu_additem(menu, "\wM4A1 (50p)", "1", 0);
menu_additem(menu, "\wAK47 (30p)", "2", 0);
menu_additem(menu, "\wSMG (30p)","3",0);
menu_additem(menu, "\wOsszes Granat(15p)", "4", 0);
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
}
public menu_handler(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[6], szName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);
new key = str_to_num(data);
switch(key)
{
case 1:
{
if(pontok[id] < 50)
{
client_print(id,print_chat,"Nincs eleg pontod!")
}
else if(m4a1 == false)
{
client_print(id,print_chat,"Mar van ilyen targyad!")
}
else
{
give_item(id, "weapon_m4a1")
pontok[id] -= 50
m4a1 = false
}
}
case 2:
{
if(pontok[id] < 30)
{
client_print(id,print_chat,"Nincs eleg pontod!")
}
else if(ak47 == false)
{
client_print(id,print_chat,"Mar van ilyen targyad!")
}
else
{
give_item(id, "weapon_ak47")
pontok[id] -= 30
ak47 = false
}
}
case 3:
{
if(pontok[id] < 30)
{
client_print(id,print_chat,"Nincs eleg pontod!")
}
else if(awp == false)
{
client_print(id,print_chat,"Mar van ilyen targyad!")
}
else
{
give_item(id, "weapon_awp")
pontok[id] -= 30
awp = false
}
}
case 4:
{
if(pontok[id] < 15)
{
client_print(id,print_chat,"Nincs eleg penzed!")
}
else if(granat == false)
{
client_print(id,print_chat,"Mar van ilyen targyad!")
}
else
{
give_item(id,"weapon_flashbang")
give_item(id,"weapon_hegrenade")
give_item(id,"weapon_smokegrenade")
pontok[id] -= 15
granat = false
}
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
public mentes(id)
{
new vaultkey[64],vaultdata[256]
format(vaultkey,63,"%s-PONTOK", name[id])
format(vaultdata,255,"%s", pontok[id])
nvault_set(g_vault,vaultkey,vaultdata)
return PLUGIN_CONTINUE
}
public betoltes(id)
{
new vaultkey[64],vaultdata[256]
format(vaultkey,63,"%s-PONTOK", name[id])
nvault_get(g_vault,vaultkey,vaultdata,255)
pontok[id] = str_to_num(vaultdata)
return PLUGIN_CONTINUE
}
public client_disconnect(id)
{
{
mentes(id)
}
}
public client_connect(id)
{
{
get_user_name(id, name[id], 31)
betoltes(id)
}
}
public hud(id)
{
set_hudmessage(0, 170, 255, 0.5, 0.0, 0, 6.0, 5.0)
show_hudmessage(0,"Pont: %d",pontok[id])
}
public Death(id)
{
new attacker = read_data(1);
new hs = read_data(3);
if(hs)
{
pontok[attacker] += 10
client_print(attacker,print_chat,"+10 pontot kaptal a fejlovesert")
}
else if(get_user_weapon(id) == CSW_HEGRENADE)
{
pontok[attacker] += 10
client_print(attacker,print_chat,"+10 pontot kaptal a granat olesert")
}
else
{
pontok[attacker] += 5
client_print(attacker,print_chat,"+5 pontot kaptal az olesert")
}
}
public bomb_planted( id )
{
pontok[id] += 20
client_print(id,print_chat,"20+ pontot kaptal a c4 lerakasaert")
}
public bomb_defused(id)
{
pontok[id] += 20
client_print(id,print_chat,"20+ pontot kaptal a c4 felszedeseert")
}