I'm making a Hev plugin. I'm trying to make it so you must buy the hev plugin but I'm already have problems. Here is what I have so far.
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
new bool:is_hev[33] = false
public plugin_init() {
register_plugin("Hev Suit","v1.0","Nicholas Glistak")
register_cvar("hev_suit","1")
register_cvar("hev_cost","5000")
}
public plugin_precache() {
precache_sound("sound/fvox/hev_logon.wav")
}
public BuyHev(ids[32], player) {
if (get_cvar_num("hev_suit") == 1) {
new buyer = ids[0]
if (is_hev[buyer]) {
new cost = get_cvar_num("hev_cost")
if (cs_get_user_money(buyer) < cost) {
client_print(buyer, print_chat, "[Hev] You currently need %d to buy a Hev Suit", cost)
return PLUGIN_HANDLED
} else if (cs_get_user_money(buyer) >= cost) {
is_hev[buyer] = true
set_task(0.1, "HevSuit", buyer)
client_print(buyer, print_chat, "[Hev] You have bought an Hev Suit for $%d", cost)
cs_set_user_money(buyer, cs_get_user_money(buyer) - cost)
new r = random(256)
new g = random(256)
new b = random(256)
switch (get_cvar_num("amx_show_activity")) {
case 2:
{
set_hudmessage(r, g, b, 0.03, 0.62, 2, 0.02, 6.0, 0.01, 0.1, 1)
show_hudmessage(buyer, "[Hev] %s has bought an Hev Suit", buyer)
}
case 1:
{
for(new i = 0; i < player; i++) {
if (cs_get_user_team(buyer[i]) == 1) {
set_hudmessage(r, g, b, 0.03, 0.62, 2, 0.02, 6.0, 0.01, 0.1, 1)
show_hudmessage(buyer, "[Hev] Someone on Terrorists has bought a Hev Suit")
} else if (cs_get_user_team(buyer[i]) == 2) {
set_hudmessage(r, g, b, 0.03, 0.62, 2, 0.02, 6.0, 0.01, 0.1, 1)
show_hudmessage(buyer, "[Hev] Someone on Counter Terrorists has bought a Hev Suit")
}
} // end for
} // end case
} // end switch
} // end else if
} else if (!is_hev[buyer]) {
client_print(buyer, print_chat, "[Hev] You have already bought a Hev Suit")
return PLUGIN_HANDLED
}
} else if (get_cvar_num("hev_suit") != 1) {
client_print(buyer, print_chat, "[Hev] Sorry, buy the Hev Suit plugin is currently turned Off")
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
public HevSuit(id) {
if (!is_hev[id]) {
client_cmd(id, "spk sound/fvox/hev_logon.wav")
return PLUGIN_HANDLED
}
}