#include <amxmodx>
#include <fun>
#include <cstrike>
new bool:g_hasC4[33]
new PcvarCost
static const PLUGIN_NAME[] = "Buy C4"
static const PLUGIN_AUTHOR[] = "Locks"
static const PLUGIN_VERSION[] = "1.2"
public plugin_init()
{
register_plugin(PLUGIN_NAME,PLUGIN_VERSION,PLUGIN_AUTHOR)
register_concmd("say buy_c4", "buy_c4")
PcvarCost = register_cvar("amx_c4_cost", "6000")
register_event("DeathMsg", "death", "a")
}
public buy_c4(id)
{
new CsTeams:team = cs_get_user_team(id)
if ( team == CS_TEAM_CT )
{
client_print(id, print_chat, "[AMXX] Terroristanak kell lenned, hogy megvasarold a bombat.")
return PLUGIN_HANDLED
}
if ( g_hasC4[id] )
{
client_print(id, print_chat, "[AMXX] Neked mar van bombad!")
}
if ( !is_user_alive(id) )
{
client_print(id,print_chat,"[AMXX] Halottkent nem vasarolhatsz bombat.")
return PLUGIN_HANDLED
}
if ( !cs_get_user_buyzone(id) )
{
client_print(id, print_chat, "[AMXX] Vasarlasi Zonaban kell lenned a bomba vasarlashoz.")
return PLUGIN_HANDLED
}
new money = cs_get_user_money(id)
new cost = get_pcvar_num(PcvarCost)
if ( money < cost )
{
client_print(id, print_chat, "[AMXX] Nincs eleg penzed a bomba megvasarlasahoz. ($%i szukseges).", cost)
return PLUGIN_CONTINUE
}
give_item(id, "weapon_c4")
cs_set_user_money(id, money - cost)
client_print(id, print_chat, "[AMXX] Sikeresen vasaroltal bombat.")
cs_set_user_plant(id, 1, 1)
g_hasC4[id] = true
return PLUGIN_CONTINUE
}
public client_connect(id)
{
g_hasC4[id] = false
return PLUGIN_HANDLED
}
public client_disconnect(id)
{
g_hasC4[id] = false
return PLUGIN_HANDLED
}
public death()
{
new id = read_data(2)
g_hasC4[id] = false
}