#1

pawn Код:
CMD:donators(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 5)
    {
        SendClientMessage(playerid, COLOR_NEWS, "Donators Online:");
        new
            iCount,
            szMessage[128];

        foreach(new i : Player) //This line
        {
            if(PlayerInfo[i][pDonator] == 1)
            {
                format(szMessage, sizeof(szMessage), "(Ruby) ID: %d | Name: %s | Level: %d | Ping: %d", i, GetPlayerNameEx(i),  PlayerInfo[i][pLevel], GetPlayerPing(i));
                SendClientMessage(playerid, COLOR_WHITE, szMessage);
                iCount++;
            }
            else if(PlayerInfo[i][pDonator] == 2)
            {
                format(szMessage, sizeof(szMessage), "(Sapphire) ID: %d | Name: %s | Level: %d | Ping: %d", i, GetPlayerNameEx(i),  PlayerInfo[i][pLevel], GetPlayerPing(i));
                SendClientMessage(playerid, COLOR_WHITE, szMessage);
                iCount++;
            }
            else if(PlayerInfo[i][pDonator] == 3)
            {
                format(szMessage, sizeof(szMessage), "(Diamond) ID: %d | Name: %s | Level: %d | Ping: %d", i, GetPlayerNameEx(i),  PlayerInfo[i][pLevel], GetPlayerPing(i));
                SendClientMessage(playerid, COLOR_WHITE, szMessage);
                iCount++;
            }
        }

        if(iCount == 0)
            return SendClientMessage(playerid, COLOR_GREY, "There aren't any donators online right now.");
    }
    return true;
}
PHP код:
C:\Ma Stuff is Here\FUCKU\gamemodes\LYL.pwn(11846) : error 017undefined symbol "foreach"
C:\Ma Stuff is Here\FUCKU\gamemodes\LYL.pwn(11846) : error 029invalid expressionassumed zero
C
:\Ma Stuff is Here\FUCKU\gamemodes\LYL.pwn(11846) : error 017undefined symbol "i"
C:\Ma Stuff is Here\FUCKU\gamemodes\LYL.pwn(11846) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
4 Errors

Can someone fix it?
Reply
#2

Change it to
pawn Код:
for (new i = 0; i != MAX_PLAYERS; ++i)
Reply
#3

You could use this too for player names. Just to make command smaller.

new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);

and replace GetPlayerNameEx(i); with "name"

This will make your command to looks better
Reply
#4

Nvm, Fixed it by myself
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)