AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   menu_display index 0 (https://forums.alliedmods.net/showthread.php?t=306960)

ish12321 04-20-2018 12:51

menu_display index 0
 
Hey,
Does menu_display accepts index 0 to show the menu to all players in amxmodx 1.8.3 latest dev build ? I know it is not so in 1.8.2

OciXCrom 04-20-2018 13:13

Re: menu_display index 0
 
Did you really find it easier to make a thread instead of testing it yourself with 2 lines of code? You could also have taken a look at the function's code in github:

PHP Code:

//Builds the menu string for a specific page (set title to 0 to not include title)
//page indices start at 0!
static cell AMX_NATIVE_CALL menu_display(AMX *amxcell *params)
{
    
auto handle params[2];
    
GETMENU(handle);

    
int player params[1];
    
int page params[3];
    
CPlayerpPlayer GET_PLAYER_POINTER_I(player);

    if (!
CloseNewMenus(pPlayer))
    {
        
LogError(amxAMX_ERR_NATIVE"Plugin called menu_display when item=MENU_EXIT");
        return 
0;
    }

    if (!
g_NewMenus[handle])
    {
        
LogError(amxAMX_ERR_NATIVE"Invalid menu id %d (was previously destroyed)."handle);
        return 
0;
    }

    
int time = -1;
    if (
params[0] / sizeof(cell) >= 4)
        
time params[4];

    if (
time 0)
        
pPlayer->menuexpire INFINITE;
    else
        
pPlayer->menuexpire gpGlobals->time static_cast<float>(time);

    return 
pMenu->Display(playerpage);


As you can see there's no loop in the code that displays it to all players when the index is set to 0.

Natsheh 04-20-2018 13:37

Re: menu_display index 0
 
Whats the different in pPlayer and player

fysiks 04-20-2018 23:05

Re: menu_display index 0
 
One is an integer and the other is a pointer to an instance of the CPlayer class (which is where you would store player data internally; hence why you see that's the only one used to get or store data that is specific to that player).


All times are GMT -4. The time now is 03:28.

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