AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Menu Question (https://forums.alliedmods.net/showthread.php?t=172354)

Diegorkable 11-19-2011 09:30

Menu Question
 
Hey guys,

I created a menu of map votes and I get in the error_log 2 wierd stuff:

These are the lines I am getting the first error on:

PHP Code:

// Some irrelevant public and code...

new players[32], pnumtempid
     
get_players(playerspnum"ch"); 

for( new 
ii<pnumi++ ) 
    { 
        
tempid players[i]; 
        
ColorChat(tempidRED"%s ^3Please ^4vote^3 for the ^4map^3 you'd like to play in."PREFIX_COLOR
        
menu_display(tempidgVoteMenu); // Line 2804 
    
// Line 2805 

Error log:

Code:

L 11/19/2011 - 15:35:25: Plugin called menu_display when item=MENU_EXIT
L 11/19/2011 - 15:35:25: [AMXX] Displaying debug trace (plugin "adminslots.amxx")
L 11/19/2011 - 15:35:25: [AMXX] Run time error 10: native error (native "menu_display")
L 11/19/2011 - 15:35:25: [AMXX]    [0] pimpdr.sma::StartVote (line 2805)
L 11/19/2011 - 15:35:25: [AMXX]    [1] pimpdr.sma::StartVote (line 2804)

Why the hell is item = MENU_EXIT?!

Second error:

PHP Code:

// The public where it counts the votes... my question is about the menu_destroy so the rest isnt relevant....

menu_destroy(gVoteMenu)
    return 
PLUGIN_HANDLED 

log:

Code:

L 11/19/2011 - 15:35:31: Invalid menu id 11(12)
L 11/19/2011 - 15:35:31: [AMXX] Displaying debug trace (plugin "adminslots.amxx")
L 11/19/2011 - 15:35:31: [AMXX] Run time error 10: native error (native "menu_destroy")
L 11/19/2011 - 15:35:31: [AMXX]    [0] pimpdr.sma::EndVote (line 2925)

What wrong with destroying the menu after vote is done? and why is the menu id invalid? The variable of gVoteMenu is global btw...

Thanks for your time.

drekes 11-19-2011 14:35

Re: Menu Question
 
If you make a global menu, you can't destroy it.
Destroying a menu free's the memory of the menu, so it becomes invalid.

Diegorkable 11-19-2011 15:30

Re: Menu Question
 
Ahh I see...


All times are GMT -4. The time now is 08:32.

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