How to get a list of all players with:
#1

I have this array or whatever they are,

Suspect[playerid] = 1;

That gets set when they try to steal a ambulance or copcar,
How do i get it so if a player types, Lets say /suspects
It will show a list of everyone who is online with: Suspect[playerid] = 1;
How would i do that?
Reply
#2

Here you go..modify w/e you need!
pawn Код:
if (strcmp(cmd, "/suspects", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            SendClientMessage(playerid, COLOR_GREY, "Suspects Online:");
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(Suspect[i] == 1)
                    {
                        GetPlayerName(i, sendername, sizeof(sendername));
                        format(string, sizeof(string), "[%d] %s",i,sendername);
                        SendClientMessage(playerid, COLOR_GREY, string);
                    }
                }
            }
        }
        return 1;
    }
Reply
#3

pawn Код:
GetPlayerName(i, sendername, sizeof(sendername));//Line
Код:
C:\Users\Torran\Desktop\Roleplay Server\Gamemodes\tCnR.pwn(119) : error 017: undefined symbol "sendername"
C:\Users\Torran\Desktop\Roleplay Server\Gamemodes\tCnR.pwn(119) : error 017: undefined symbol "sendername"
C:\Users\Torran\Desktop\Roleplay Server\Gamemodes\tCnR.pwn(119) : error 029: invalid expression, assumed zero
C:\Users\Torran\Desktop\Roleplay Server\Gamemodes\tCnR.pwn(119) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#4

Nevermind i fixed it Thanx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)