help with /wantedlist command
#1

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.
Reply
#2

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.
Reply
#3

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.
Reply
#4

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"
Reply
#5

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
Reply
#6

i did define, its in my gamemode.
Reply
#7

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


Forum Jump:


Users browsing this thread: 1 Guest(s)