Raised This Month: $ Target: $400
 0% 

More items in menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Saint Sinner
Senior Member
Join Date: Feb 2016
Old 11-11-2019 , 09:20   More items in menu
Reply With Quote #1

I want to add more items in menu : gVotes[2], gVotes[3], gVotes[4], gVotes[5]

how can do that?

Code:
#include <amxmodx>

new gVoteMenu,gVotes[2],gVoting;

public plugin_init()
{
    register_clcmd( "say /vote","StartVote" );
}
public StartVote( id )
{
    if ( gVoting )
    {
        client_print( id, print_chat, "There is already a vote going." );
        return PLUGIN_HANDLED;
    }
    gVotes[0] = gVotes[1] = 0;

    gVoteMenu = menu_create( "\rVote Fun Menu!:", "menu_handler" );

    menu_additem( gVoteMenu, "Gravity", "", 0 );
    menu_additem( gVoteMenu, "Speed", "", 0 );

    new players[32], pnum, tempid;

    get_players( players, pnum );

    for ( new i; i < pnum; i++ )
    {
        tempid = players[i];

        menu_display( tempid, gVoteMenu, 0 );

        gVoting++;
    }

    set_task(10.0, "EndVote" );

    return PLUGIN_HANDLED;
}
public menu_handler( id, menu, item )
{
    if ( item == MENU_EXIT || !gVoting )
    {
        return PLUGIN_HANDLED;
    }
    
    gVotes[ item ]++;

    return PLUGIN_HANDLED;
}
public EndVote()
{
    if ( gVotes[0] > gVotes[1] )
        client_print(0, print_chat, "Gravity recieved most votes (%d )", gVotes[0] );

    else if ( gVotes[0] < gVotes[1] )
        client_print(0, print_chat, "Speed  recieved most votes (%d )", gVotes[1] );
	
    else
        client_print(0, print_chat, "The vote tied at %d votes each.", gVotes[0] );

    menu_destroy( gVoteMenu );

    gVoting = 0;
}

Last edited by Saint Sinner; 11-11-2019 at 09:21.
Saint Sinner is offline
 


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 02:47.


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