SA-MP Forums Archive
help with /wantedlist command - 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: help with /wantedlist command (/showthread.php?tid=67378)



help with /wantedlist command - CJ101 - 01.03.2009

ok i want to make a command that when you use it, it shows a list of all wanted players (wanted level above 0).
can someone help? no idea where to start.


Re: help with /wantedlist command - Towlies - 01.03.2009

Little bored tonight but this command is basic logic just looping to get all players current level.

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i ++)
{
    if(GetPlayerWantedLevel(i) >= 1)
    {
      // This player is wanted
    }
}
Once you determined it you could probably just format it all into a nice looking string.


Re: help with /wantedlist command - Rks25 - 01.03.2009

Here you go
A full working /wantedlist command.
pawn Код:
dcmd_wantedlist(playerid,params[]) {
  #pragma unused params
  new wantedmates, string[64];
  new playername[MAX_PLAYER_NAME];

  for(new i=0;i<MAX_PLAYERS;i++)
  {
    if(GetPlayerWantedLevel(i) >= 1)
    {
      if(wantedmates == 0)
      {
         SendClientMessage(playerid, COLOR_COLOR, "* List of players which are currently wanted:");
        wantedmates = 1;
      }
      GetPlayerName(i, playername, sizeof(playername));
      format(string, sizeof(string), "* %s (id: %d) is currently wanted.", playername,i);
      SendClientMessage(playerid, COLOR_COLOR, string);
    }
  }
  if(wantedmates == 0)
  {
    SendClientMessage(playerid, COLOR_COLOR, "* No one is currently wanted.");
  }
  return 1;
}
NOTE: you need dcmd for this.


Re: help with /wantedlist command - CJ101 - 01.03.2009

i have dccmd.

i put this into OnPlayerCmd:
dcmd_wantedlist(playerid,params[]);

i put the code somewhere, and i get error:
error 017: undefined symbol "params"


Re: help with /wantedlist command - Rks25 - 01.03.2009

than you havent defined dcmd?

pawn Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1



Re: help with /wantedlist command - CJ101 - 01.03.2009

i did define, its in my gamemode.


Re: help with /wantedlist command - Rks25 - 01.03.2009

if you placed my command and:
dcmd(wantedlist,10,cmdtext); At OnPlayerCommandText, it should not go wrong..