Raised This Month: $ Target: $400
 0% 

[HELP] Menu on new round - works only once


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 06-02-2014 , 10:45   [HELP] Menu on new round - works only once
Reply With Quote #1

Plugin requested here - https://forums.alliedmods.net/showthread.php?t=241336
Hey all! Again, I've wondering about this for hours, and no solution appeared in my head. I couldn't get that strange problem and what is it cause by, so I hope you will know. Here what's the matter. In this code, everything is OK but only for the first round. The strange is, that in other rounds the menu still appears, but no functions from it. And I think - if the handler is wrong, it should not work event the first time. But it works for the first round - and then, nothing. Here is the code, I think it could be cause by the loop trough players in the new round event. Any ideas?
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

#define PLUGIN "Weapons Menu"
#define VERSION "1.0"
#define AUTHOR "Flicker"

new iMaxPlayers

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
iMaxPlayers get_maxplayers()
    
register_event("HLTV""NewRound""a""1=0""2=0")
}

enum _:Data
{
    
_name[32],
    
_csw[32],
    
_wname[32],
    
_ammo[32]
}

new const 
Weapons[][Data]=
{
    {
""},
    {
"M4A1"CSW_M4A1"weapon_m4a1"90},
    {
"AK47"CSW_AK47"weapon_ak47"90}
}

public 
NewRound()
{
    new 
Item[64]
    for(new 
id 1id <=iMaxPlayersid++)
    {
        new 
menu menu_create("Free VIP Guns""MenuHandler")
        for(new 
1sizeof Weaponsi++)
        {
            
formatex(Itemcharsmax(Item), "Get %s + Deagle"Weapons[i][_name])
            
menu_additem(menuItem""0)
        }
        
menu_display(idmenu0)
    }
}


public 
MenuHandler(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(id)
        return
    }
    
    if(!
is_user_alive(id))
    {
        
client_print(idprint_chat"You should be alive to get weapons.")
        return
    }
    
    new 
key item 1
    
    strip_user_weapons
(id)
    
give_item(id"weapon_knife")
    
give_item(idWeapons[key][_wname])
    
cs_set_user_bpammo(idWeapons[key][_csw], Weapons[key][_ammo])
    
give_item(id"weapon_deagle")
    
cs_set_user_bpammo(idCSW_DEAGLE35)
    

Whatever I choose - wokrs first round. And then, whatever I choose - nothing happens, like in the next round the handler is excluded somehow, don't know...
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:40.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode