/wanted command
#1

How to make a command like "/wanted" but it shows all the players with stars names?
Reply
#2

pawn Код:
CMD:wanted(playerid, params[])
{
  new p = 0;
  SendClientMessage(playerid, 0x009DFFFF, "__________________| Wanted List |__________________");
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    if (IsPlayerConnected(i))
    {
      if(GetPlayerWantedLevel(i) >= 1)
      {
        new string[128], Name[MAX_PLAYER_NAME];
        GetPlayerName(i, Name, sizeof(Name));
        format(string, sizeof(string), "> %s (Wanted Level: %i)", Name, GetPlayerWantedLevel(i));
        SendClientMessage(playerid, 0xFFFFFFFF, string);
        p++;
      }
    }
  }
  if (p == 0) SendClientMessage(playerid, 0xFFFFFFFF, "There are no wanted criminals!");
  return 1;
}
This is made for zcmd... so convert it if you use something else, its un-tested but should work. Hope it helps
Reply
#3

How do i convert it.
Reply
#4

change the CMD:wanted(playerid, params[]) to whatever you are using for your commands
Reply
#5

Quote:
Originally Posted by Steven82
How do i convert it.
pawn Код:
if (strcmp(cmdtext, "/wanted", true) ==0)
{
  new p = 0;
  SendClientMessage(playerid, 0x009DFFFF, "__________________| Wanted List |__________________");
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    if (IsPlayerConnected(i))
    {
      if(GetPlayerWantedLevel(i) >= 1)
      {
        new string[128], Name[MAX_PLAYER_NAME];
        GetPlayerName(i, Name, sizeof(Name));
        format(string, sizeof(string), "> %s (Wanted Level: %i)", Name, GetPlayerWantedLevel(i));
        SendClientMessage(playerid, 0xFFFFFFFF, string);
        p++;
      }
    }
  }
  if (p == 0) SendClientMessage(playerid, 0xFFFFFFFF, "There are no wanted criminals!");
  return 1;
}
Reply
#6

*Deleted
Reply
#7

Guys i am trying to mix this command with:
Код:
if(gTeam[playerid] == TEAM_LVPD
but i keep getting errors
Reply
#8

Quote:
Originally Posted by Steven82
Guys i am trying to mix this command with:
Код:
if(gTeam[playerid] == TEAM_LVPD
but i keep getting errors
pawn Код:
if (strcmp(cmdtext, "/wanted", true) ==0)
{
  if (gTeam[playerid] != TEAM_LVPD) return 0;
  new p = 0;
  SendClientMessage(playerid, 0x009DFFFF, "__________________| Wanted List |__________________");
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    if (IsPlayerConnected(i))
    {
      if(GetPlayerWantedLevel(i) >= 1)
      {
        new string[128], Name[MAX_PLAYER_NAME];
        GetPlayerName(i, Name, sizeof(Name));
        format(string, sizeof(string), "> %s (Wanted Level: %i)", Name, GetPlayerWantedLevel(i));
        SendClientMessage(playerid, 0xFFFFFFFF, string);
        p++;
      }
    }
  }
  if (p == 0) SendClientMessage(playerid, 0xFFFFFFFF, "There are no wanted criminals!");
  return 1;
}
Should work, let me know how it goes
Reply
#9

Nope, didn't work, i made my own coding.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)