AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   dynamic menu_additem (https://forums.alliedmods.net/showthread.php?t=127619)

HLM 05-23-2010 03:12

dynamic menu_additem
 
PHP Code:

StartVote()
{
    new 
i;
    new 
title[65];
    
format(title64"Tech Level %d Vote"iCurrentTechLevel+1);
    
//Store the menu in the global
    
gVoteMenu menu_create(title"menu_handler");
    
    
menu_setprop(gVoteMenuMPROP_EXITMEXIT_NEVER);

    
//Add some vote options
    
    
for(0TECHS_PER_LEVELi++)
    {
        new 
vote[65];
        
format(vote64"%s"szTechName[iCurrentTechLevel][i]);
        
menu_additem(gVoteMenuvotei+10);
    }

    for(
0MAX_PLAYERSi++)
    {
        
bPlayerVoted[i] = false;
    }
    
    
bInVote true;
    
fVoteStartTime get_gametime();
    
    
//We will need to create some variables so we can loop through all the players
    
new players[32], pnumtempid;

    
//Fill players with available players
    
get_players(playerspnum);

    
//Start looping through all players to show the vote to
    
for(ii<pnumi++ )
    {
        
//Save a tempid so we do not re-index
        
tempid players[i];

        
//Show the vote to this player
        
menu_display(tempidgVoteMenu0);

        
//Increase how many players are voting
        
gVoting++;
    }

    return 
PLUGIN_HANDLED;


Code:

        for(i = 0; i < TECHS_PER_LEVEL; i++)
        {
                new vote[65];
                format(vote, 64, "%s", szTechName[iCurrentTechLevel][i]);
                menu_additem(gVoteMenu, vote, i+1, 0);
        }

Quote:

Error: Argument type mismatch (argument 3) on line 451

Exolent[jNr] 05-23-2010 03:30

Re: dynamic menu_additem
 
That argument requires a string, not an integer.
You must convert the integer to a string.

HLM 05-23-2010 14:13

Re: dynamic menu_additem
 
thanks exolent

fysiks 05-23-2010 16:43

Re: dynamic menu_additem
 
Some advice: When you have an error like this it is always wise to first check the FuncWiki and if it's not there search for it in the /include/ folder because mose everything is well documented there.

Have fun! :)


All times are GMT -4. The time now is 05:21.

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