SA-MP Forums Archive
How to get a list of all players with: - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to get a list of all players with: (/showthread.php?tid=125465)



How to get a list of all players with: - Torran - 03.02.2010

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?


Re: How to get a list of all players with: - s0nic - 03.02.2010

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;
    }



Re: How to get a list of all players with: - Torran - 04.02.2010

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.



Re: How to get a list of all players with: - Torran - 04.02.2010

Nevermind i fixed it Thanx