Quote:
Originally Posted by NiHiLaNTh
that function is supported by the older versions of amx mod x too. Its just not integrated. Here it is.
|
Well, now isnt really necessary.
Anyway i got my pc and i just found one bug.
Actually the buytime is set in freezetime moment. Yet, it also set buytime AGAIN when it ends. So if your freeze time is higher than buytime, you wont be able to buy till freeze time ends. Valve, you have failed this game, i will call the Arrow.
Anyway can someone tell me whats the name for the messages You Cannot Carry Anymore and Buy Time ended? Not finding the correct ones.
I will let here the code, if someone knows the messages, let me know for update the code.
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#define VERSION "0.0.1"
#define TASK_BUYTIME 418123
new price = 300
new bool:CanBuy
public plugin_init() {
register_plugin("SmokeGrenade Price Change", VERSION, "Jhob94")
register_event("HLTV", "Round_New", "a", "1=0", "2=0" ) // New Round
register_event("TextMsg", "Round_Crap", "a", "2&#Game_C", "2&#Game_w") // Game restart/commecing
register_logevent("Fix_Buy_Time", 2, "1=Round_Start") // Register buy time at round start
register_logevent("Round_Crap", 2, "1=Round_End") // Round End
register_clcmd("sgren", "Buy_Smoke", 0) // VGUI Menu
register_menucmd(register_menuid("BuyItem"),(1<<4),"OS_Smoke") // Old-Style Menu
}
public Round_New() CanBuy = true
public Fix_Buy_Time() set_task(get_cvar_float("mp_buytime") * 60.0, "Can_Not_Buy", TASK_BUYTIME)
public Round_Crap()
{
if(task_exists(TASK_BUYTIME))
remove_task(TASK_BUYTIME)
}
public Can_Not_Buy() CanBuy = false
public OS_Smoke(id, key)
{
if(key == 4)
Buy_Smoke(id, 1)
}
public Buy_Smoke(id, OS)
{
if(!CanBuy)
client_print(id, print_center, "Buy Time Expired")
else
{
if(user_has_weapon(id, CSW_SMOKEGRENADE))
client_print(id, print_center, "You Cannot Carry Anymore!")
else
{
new cur_money = cs_get_user_money(id)
if(cur_money < price)
client_print(id, print_center, "#Not_Enough_Money")
else
{
give_item(id, "weapon_smokegrenade")
cs_set_user_money(id, cur_money - price, 1)
}
}
}
if(OS)
engclient_cmd(id, "menuselect" ,"10")
return PLUGIN_HANDLED
}
__________________