This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

New AMXX Menu System


Post New Thread Reply   
 
Thread Tools Display Modes
yan1255
Senior Member
Join Date: Jul 2011
Old 10-25-2012 , 14:55   Re: New AMXX Menu System
Reply With Quote #401

I don't know if anyone else noticed but i tryed the example of your Basic Vote Menu...
and the vote doesn't ends... i mean it will continue from the last result for example:
I choose the Option 1 and then the vote was over so it shows that Option 1 has won the vote
and then i just start the vote again and choose Option 2 and it shows a tie...
I used this to stop it... and i'm sure theres a better way... i just tryed this

PHP Code:
    gVotes] = 0;
    
gVotes] = 0;
    
// this is found in the - public EndVote( ) on the end 
__________________
yan1255 is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 10-25-2012 , 17:19   Re: New AMXX Menu System
Reply With Quote #402

Code:
arrayset(gVotes, 0, sizeof gVotes);
hleV is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-25-2012 , 19:53   Re: New AMXX Menu System
Reply With Quote #403

Quote:
Originally Posted by hleV View Post
Code:
arrayset(gVotes, 0, sizeof gVotes);
If there are only two options, I'm guessing that it's more efficient to set the two cell manually like yan does above.
__________________

Last edited by fysiks; 10-25-2012 at 19:53. Reason: typo
fysiks is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 10-31-2012 , 14:09   Re: New AMXX Menu System
Reply With Quote #404

Quote:
Originally Posted by yan1255 View Post
I don't know if anyone else noticed but i tryed the example of your Basic Vote Menu...
and the vote doesn't ends... i mean it will continue from the last result for example:
I choose the Option 1 and then the vote was over so it shows that Option 1 has won the vote
and then i just start the vote again and choose Option 2 and it shows a tie...
I used this to stop it... and i'm sure theres a better way... i just tryed this

PHP Code:
    gVotes] = 0;
    
gVotes] = 0;
    
// this is found in the - public EndVote( ) on the end 
Thank you for bringing that to my attention, I have added it to the example vote menus.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
B l e n d
BANNED
Join Date: Oct 2012
Location: Somewhere on the planet
Old 11-07-2012 , 21:40   Re: New AMXX Menu System
Reply With Quote #405

What do:
menu_additem(menu, "\wI'm Selection #1", "1", 0);

AkA:

menu_additem(menu, "\wI'm Selection #1", "1", ADMIN_ADMIN);


Mean? =)

Last edited by B l e n d; 11-07-2012 at 21:40.
B l e n d is offline
Send a message via Skype™ to B l e n d
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-07-2012 , 22:39   Re: New AMXX Menu System
Reply With Quote #406

Quote:
Originally Posted by B l e n d View Post
What do:
menu_additem(menu, "\wI'm Selection #1", "1", 0);

AkA:

menu_additem(menu, "\wI'm Selection #1", "1", ADMIN_ADMIN);


Mean? =)
http://hg.alliedmods.net/amxmodx-cen...wmenus.inc#l77
__________________
fysiks is offline
B l e n d
BANNED
Join Date: Oct 2012
Location: Somewhere on the planet
Old 11-08-2012 , 08:22   Re: New AMXX Menu System
Reply With Quote #407

Quote:
Originally Posted by fysiks View Post
Thank you very much!
But I didn't know that "-1" return false.
Isnt: < 0 true and > 0 true
B l e n d is offline
Send a message via Skype™ to B l e n d
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 11-08-2012 , 14:29   Re: New AMXX Menu System
Reply With Quote #408

For anyone interested, I use this for menus with callbacks when the menu supposedly can still be open for client who should no longer be able to use it.
For example: the menu option should only be available to alive players. The player has the menu opened and dies. The menu option is still available for him to use.
PHP Code:
public OnMenu(clientmenuitem)
{
    
// Real item IDs start from 0, but options like exit, next or
    // back all have negative IDs, so it's incorrect to only check
    // if item == MENU_EXIT, because this function is called for
    // MENU_NEXT and MENU_BACK as well
    
if (item 0)
        return 
PLUGIN_HANDLED;
    
    
// Now we check if for this client, menu item selected is valid,
    // as player may have died and should be no longer able to use
    
if (!IsMenuItemValid(clientitem))
    {
        
// The menu item is invalid, we re-display the menu with
        // updated (disabled) menu items
        
menu_display(clientmenu);
        
        return 
PLUGIN_HANDLED;
    }
    
    
// We do the usual menu stuff
    
    
return PLUGIN_HANDLED;
}

public 
OnMenuCallback(clientmenuitem)
{
    
// We don't need to check whether the item < 0 because callback
    // is only called for items we specified when adding menu items
    
    // Now we use same function as above, but to mark items as
    // either enabled or disabled
    
return IsMenuItemValid(client) ? ITEM_ENABLED ITEM_DISABLED;
}

bool:IsMenuItemValid(clientitem)
{
    
// We can do additional checks here, which apply to all items
    
if (!is_user_alive(client))
        return 
false;
    
    
// Just pure examples, no commenting needed
    
switch (item)
    {
        case 
0:
        {
            if (
get_user_health(client) >= 100)
                return 
false;
        }
        case 
1:
        {
            if (
cs_get_user_money(client) < 1000)
                return 
false;
        }
    }
    
    
// We went through all checks. Menu item is available for client
    
return true;

Basically, the same checks should be used in both the menu handler function (though it may have more checks as seen in the example) and menu callback function.

Last edited by hleV; 11-08-2012 at 14:33.
hleV is offline
Old 11-10-2012, 14:05
Fr33m@n
This message has been deleted by Fr33m@n.
Fr33m@n
Veteran Member
Join Date: May 2008
Location: France Marne
Old 11-10-2012 , 14:36   Re: New AMXX Menu System
Reply With Quote #409

To visualy remove a new menu, you can use something like
show_menu(id, 0, " ") to get ride of the HUD. (thx Connor)
Don't forget to menu_destroy your menu if it's a dynamic one.

Can someone explain me why my global g_voteNextmapMenu working dynamic new menu return me 0 right here ?

PHP Code:
new menunewmenu
player_menu_info
(playermenunewmenu)
client_print(playerprint_chat"%d %d %d"g_voteNextmapMenumenunewmenu

Last edited by Fr33m@n; 11-10-2012 at 14:37.
Fr33m@n is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-10-2012 , 14:42   Re: New AMXX Menu System
Reply With Quote #410

Quote:
Originally Posted by Fr33m@n View Post
Can someone explain me why my global g_voteNextmapMenu working dynamic new menu return me 0 right here ?

PHP Code:
new menunewmenu
player_menu_info
(playermenunewmenu)
client_print(playerprint_chat"%d %d %d"g_voteNextmapMenumenunewmenu

Can't help you without the full code. Attach the .sma file.
__________________
fysiks is offline
Reply



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 01:40.


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