What is wrong in this code?
PHP Code:
#include <amxmodx>
new VoteMenu
new Votes[2]
new gVoting
public plugin_init()
{
register_clcmd( "amx_awpvote","Vote")
}
public Vote(id)
{
if( gVoting )
{
client_print(id, print_chat, "There is already a vote going (Vote jos uvek traje)")
return PLUGIN_HANDLED
}
VoteMenu = menu_create("\rAWP?:", "menu_handler")
menu_additem(VoteMenu, "Yes (Da)", "0", 0)
menu_additem(VoteMenu, "No (Ne)", "1", 0)
new players[32], pnum, tempid
get_players(players, pnum)
for( new i ; i<pnum ; i++ )
{
tempid = players[i]
menu_display(tempid, VoteMenu, 0)
gVoting++
}
set_task(10.0, "End")
return PLUGIN_HANDLED
}
public menu_handler(id, menu, item)
{
if( item == MENU_EXIT || !gVoting )
{
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 voteid = str_to_num(data)
Votes[voteid]++
return PLUGIN_HANDLED
}
public End()
{
if( Votes[0] > Votes[1] )
client_print(0, print_chat, "AWP permitted (Dozvoljen AWP) (%d)", Votes[0] )
else if( Votes[0] < Votes[1] )
{
client_print(0, print_chat, "AWP illegal (Ne dozvoljen AWP) (%d)", Votes[1] )
set_task(0.1, "DropAWP")
}
else
client_print(0, print_chat, "Do what you want (Radi sta hoces)", Votes[0] )
menu_destroy(VoteMenu)
gVoting = 0
}
public DropAWP(id)
{
new awp = get_user_weapon(id,_,_)
if(awp == CSW_AWP)
{
client_print(id, print_chat, "AWP is not now allowed")
client_print(id, print_chat, "AWP nije trenutno dozvoljen")
client_cmd(id, "drop")
}
else
return PLUGIN_HANDLED
return PLUGIN_HANDLED
}
Plugin not doing drop command when user buy AWP... Why? Can someone fix that... (If you dont know what is wrong dont replay)
__________________