here is the log file sometime it open grenade menu in next round too and sometime it say you have to wait 1 more round
here is log file and i have added log_amx and set round time 1 minute
Quote:
L 09/05/2016 - 17:19:51: -------- Mapchange to de_dust2 --------
L 09/05/2016 - 17:20:02: [test_flashbang.amxx] You have purchased flashbang
L 09/05/2016 - 17:21:07: [test_flashbang.amxx] You have purchased flashbang
L 09/05/2016 - 17:22:18: [test_flashbang.amxx] You need to wait for 1 more round to use Grenade_Menu.
|
PHP Code:
#include <amxmodx>
#include <fun>
new purchasedFlashiCount[33];
new bool:purchasedFlash[33];
public plugin_init()
{
register_logevent( "logevent_RoundStart", 2, "1=Round_Start" );
register_clcmd("say /flash", "ShowMenu");
}
public logevent_RoundStart()
{
new iPlayers[32], iCount
get_players(iPlayers, iCount, "ch")
if( !iCount ) return
new id
for(--iCount; iCount>=0; iCount--)
{
id = iPlayers[iCount]
if(purchasedFlash[id]) purchasedFlashiCount[id]++;
}
}
public ShowMenu(id) {
if(is_user_alive(id)){
if(purchasedFlashiCount[id] == 0){
new menu = menu_create("Grenade_Menu", "mh_MyMenu");
menu_additem(menu, "flashbang", "", 0); // case 0
menu_display(id, menu, 0);
}
else{
client_print(id, 3, "You need to wait for 1 more round to use Grenade_Menu.")
log_amx("You need to wait for 1 more round to use Grenade_Menu.")
}
}
else{
client_print(id, 3, "You need to be alive to use Grenade_Menu.")
}
return PLUGIN_HANDLED;
}
public mh_MyMenu(id, menu, item)
{
switch(item)
{
case 0:
{
give_item(id, "weapon_flashbang");
client_print(id, print_chat, "You have purchased flashbang");
log_amx("You have purchased flashbang")
purchasedFlash[id] = true;
purchasedFlashiCount[id]--;
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
But the output should be like this :
Quote:
You already purchased in this round
in next round
you have to wait 1 round to purchase again
then after this round he will able to purchase again same loop
|
__________________
Thanks everyone. #miss_you_all