2 errors
#1

Код:
C:\Users\Owner\Desktop\Pawno\filterscripts\Test.pwn(4822) : error 017: undefined symbol "foreach"
C:\Users\Owner\Desktop\Pawno\filterscripts\Test.pwn(4824) : error 032: array index out of bounds (variable "pName")
Here are the lines for the unidentified symbol, and tag mismatch:

pawn Код:
for(new i; i < MAX_PLAYERS; i ++)
    {
        if(IsPlayerConnected(i))
        {
            new FPSList[512];
            foreach(i)
            {
                format(FPSList, sizeof(FPSList), "%s:   %i\n", pName[MAX_PLAYER_NAME], GetPlayerFPS(i));
                ShowPlayerDialog(playerid, 55, DIALOG_STYLE_MSGBOX, "Players' FPS", FPSList, "Ok", "");
            }
        }
    }
I want the command when they type /fpslist to display EVERYONE's FPS, not only the person who typed /fpslist. So, how would I do this? I thought the above would make it work but apparently not. :S
Reply
#2

ShowPlayerDialog(i, not playerid <<<<<<<<< FAIL sorry xD
Reply
#3

You are using 2 loops that do the same thing. Use this:
pawn Код:
#define DIALOG_FPS_LIST (1337)

new
    FPSList[512];

for(new i = 0; i < MAX_PLAYERS; ++i)
{
    if(IsPlayerConnected(i) && !IsPlayerNPC(i))
    {
        format(FPSList, sizeof(FPSList), "%s%s:    %s\n", FPSList, pName(i), GetPlayerFPS(i));
    }
}
ShowPlayerDialog(playerid, DIALOG_FPS_LIST, DIALOG_STYLE_MSGBOX, "Players' FPS", FPSList, "Ok", "");
You will also need:
pawn Код:
stock pName(playerid)
{
    new
        iName[MAX_PLAYER_NAME];

    GetPlayerName(playerid, iName, sizeof(iName));
    return iName;
}
Reply
#4

Код:
C:\Users\Owner\Desktop\Pawno\filterscripts\Test.pwn(4824) : error 012: invalid function call, not a valid address
C:\Users\Owner\Desktop\Pawno\filterscripts\Test.pwn(4824) : warning 215: expression has no effect
C:\Users\Owner\Desktop\Pawno\filterscripts\Test.pwn(4824) : error 001: expected token: ";", but found ")"
C:\Users\Owner\Desktop\Pawno\filterscripts\Test.pwn(4824) : error 029: invalid expression, assumed zero
C:\Users\Owner\Desktop\Pawno\filterscripts\Test.pwn(4824) : fatal error 107: too many error messages on one line
Line 4824:

pawn Код:
format(FPSList, sizeof(FPSList), "%s%s:    %s\n", FPSList, pName(i), GetPlayerFPS(i));
Reply
#5

pawn Код:
#define DIALOG_FPS_LIST (1337)

new FPSList[512];

for(new i = 0; i < MAX_PLAYERS; ++i)
{
    if(IsPlayerConnected(i) && !IsPlayerNPC(i))
    {
        format(FPSList, sizeof(FPSList), "%s%s:    %s\n", FPSList, pName(i), GetPlayerFPS(i));
        ShowPlayerDialog(playerid, DIALOG_FPS_LIST, DIALOG_STYLE_MSGBOX, "Players FPS", FPSList, "Ok", "");
    }
}


stock pName(playerid)
{
    new iName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, iName, sizeof(iName));
    return iName;
}
Reply
#6

Still the same errors.

EDIT: Never mind, thanks alot for all your help Lethal, you are a huge help. Thanks for help too Riddick94, there was an error in my pName. I fixed it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)