AlliedModders

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

ironskillz1 01-07-2013 14:52

Menu add
 
Okay so this code shows all players on the server
something like this:
1. name
2. name

and i want to do the player who open the menu name red
and the others grey.
And i want to add text behind there names that telling them there precent
Code:

new percent = 100 * earned/total
like this
1. name [%i] Done
2. name [%i] Done

how can i do that??

Code:

    new iMenu = menu_create("\rPERCENT PLAYER MENU", "handlePlayerMenu");
 
    new iPlayers[32], iNum, iPlayer, szName[32], szKey[3];
    get_players(iPlayers, iNum);
 
    for( new i; i < iNum; i++ )
    {
        iPlayer = iPlayers[i];
        get_user_name(iPlayer, szName, charsmax(szName));
        num_to_str(iPlayer, szKey, charsmax(szKey));
        menu_additem(iMenu, szName, szKey);
    }
 
    menu_setprop(iMenu, MPROP_EXITNAME, "Back");
    menu_display(id, iMenu, 0);
}


Neeeeeeeeeel.- 01-07-2013 15:00

Re: Menu add
 
Percent of what?

ironskillz1 01-07-2013 15:08

Re: Menu add
 
Quote:

Originally Posted by Neeeeeeeeeel.- (Post 1869042)
Percent of what?

i dont want help with percent i want help with the meny that shows percent

AngeIII 01-07-2013 15:09

Re: Menu add
 
PHP Code:

for( new iiNumi++ )
    {
        
iPlayer iPlayers[i];
        
get_user_name(iPlayerszNamecharsmax(szName));
        
num_to_str(iPlayerszKeycharsmax(szKey));
        
menu_additem(iMenuszNameszKey);
    } 

use formatting
PHP Code:

new szMenuKey[128],precent;
for( new 
iiNumi++ )
    {
        
iPlayer iPlayers[i];
        
precent=100*earned/total;
        
get_user_name(iPlayerszNamecharsmax(szName));
        
format(szMenuKey,127,"%s [%d] done",szName,precent);
        
num_to_str(iPlayerszKeycharsmax(szKey));
        
menu_additem(iMenuszMenuKeyszKey);
    } 


ironskillz1 01-07-2013 15:27

Re: Menu add
 
But how can i make the persons name red and a space
Who Open the menu
1. MyName // and this line should be red With your name
// and here a space
2. Name
3. Name

Neeeeeeeeeel.- 01-07-2013 19:27

Re: Menu add
 
PHP Code:

new szMenuKey[128],precent;
for( new 
iiNumi++ )
    {
        
iPlayer iPlayers[i];
        
precent=100*earned/total;
        
get_user_name(iPlayerszNamecharsmax(szName));
        
format(szMenuKey,127,"%s%s \w[%d] done%s"== id "\r" "",szName,precent== id "^n" "");
        
num_to_str(iPlayerszKeycharsmax(szKey));
        
menu_additem(iMenuszMenuKeyszKey);
    } 

I'm not sure if you can use ^n on this type of menus... but try it.

ironskillz1 01-08-2013 07:52

Re: Menu add
 
Quote:

Originally Posted by Neeeeeeeeeel.- (Post 1869209)
PHP Code:

new szMenuKey[128],precent;
for( new 
iiNumi++ )
    {
        
iPlayer iPlayers[i];
        
precent=100*earned/total;
        
get_user_name(iPlayerszNamecharsmax(szName));
        
format(szMenuKey,127,"%s%s \w[%d] done%s"== id "\r" "",szName,precent== id "^n" "");
        
num_to_str(iPlayerszKeycharsmax(szKey));
        
menu_additem(iMenuszMenuKeyszKey);
    } 

I'm not sure if you can use ^n on this type of menus... but try it.


your did not work
my name was white and the other players name was red
i want my name to be red and the other players red
and it was not a space
1. myname //red
//space
2. name
3. name

AngeIII 01-08-2013 08:36

Re: Menu add
 
PHP Code:

new szMenuKey[128],precent;
for( new 
iiNumi++ )
    {
        
iPlayer iPlayers[i];
        
precent=100*earned/total;
        
get_user_name(iPlayerszNamecharsmax(szName));
        
format(szMenuKey,127,"\r%s \w[%d] done^n",szName,precent);
        
num_to_str(iPlayerszKeycharsmax(szKey));
        
menu_additem(iMenuszMenuKeyszKey);
    } 

for more spaces: ^n and more: ^n^n^n^n^n

jimaway 01-08-2013 08:39

Re: Menu add
 
use callback and set the formatting to according item from there

ironskillz1 01-08-2013 14:32

Re: Menu add
 
evryones names was red?
but the space work
Code:

    {
        iPlayer = iPlayers[i];
 new percent = 100 * iAchLevel[id][i]/iAchPoints[i]
        get_user_name(iPlayer, szName, charsmax(szName));
        format(szMenuKey,127,"\r%s \d[%d%%]\w^n",szName,percent);
        num_to_str(iPlayer, szKey, charsmax(szKey));
        menu_additem(iMenu, szMenuKey, szKey);
    }



All times are GMT -4. The time now is 13:25.

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