/wanted list of persons with wanted [EDIT... problem solved]
#1

hello this is my first topic, i am sorry if it's not in the right place... normally i don't make topics but i'm a lil desperate. I want in my script a command (/wanted) that tells the cop team (TEAM_COP and TEAM_ARMY) which people are wanted. I've heard about loops and stuff that can check all stats of players, i think i need that for it... but i prefer a FS or lines that are complete,

example(not detailed):

sendclientmessage(playerid,blabla, you are checking the list of most wanted players, you can arrest those)
sendclientmessage(playerid,blabla, player1 is wanted, player 6 is wanted )

it would be even greater if it says how much wanted stars!

i thought up this idea myself(meant for cops n gangs server) but a few days later i saw it in a server.. so I know it's possible!!

please help!!!
Reply
#2

This should work. Shows their wanted level too. Enjoy.

Код:
if(strcmp(cmd, "/wanted", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	 	{
			if(gTeam[playerid] == 2 || IsACop(playerid))
			{
				new x;
				SendClientMessage(playerid, COLOR_GREEN, "Current Wanted Suspects:");
			  for(new i=0; i < MAX_PLAYERS; i++) {
					if(IsPlayerConnected(i))
					{
					  if(WantedLevel[i] > 1)
					  {
							GetPlayerName(i, giveplayer, sizeof(giveplayer));
							format(string, sizeof(string), "%s%s: %d", string,giveplayer,WantedLevel[i]);
							x++;
							if(x > 3) {
							  SendClientMessage(playerid, COLOR_YELLOW, string);
							  x = 0;
								format(string, sizeof(string), "");
							} else {
								format(string, sizeof(string), "%s, ", string);
							}
						}
					}
				}
Reply
#3

well i get some errors, one of them is that i need to replace: isacop by team_cop.. but i think
the:


my gamemode is a lil shitty (i think somewhere misses a: return, ;, ), } ) on of these so put it in a FS
http://pastebin.com/f2daeaa7d
you can check the errors there yourself ...
Reply
#4

sorry for double post but i found something, maybe it's right... does:

new WantedLevel;
WantedLevel = GetPlayerWantedLevel(playerid);

needs to be somewhere?

or
WantedLevel[playerid]
or
// Top Of Script
new WantedLevel[MAX_PLAYERS];
Reply
#5

pawn Код:
#define color [your color code]

if(strcmp(cmd, /wanted, true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        SendClientMessage(playerid, color, "Current Wanted Suspects;");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
              new wantedlvl = GetPLayerWantedLevel(i);
              if(wantedlvl > 0)
              {
                    new wantedguy[MAX_PLAYER_NAME];
                    new string[MAX_PLAYER_NAME;
                    GetPlayerName(i, wentedguy, sizeof(wantedguy));
                    format(string, sizeof(string), "Name: %s || Wanted Level: %d", wantedguy, wantedlvl
                    SendClientMessage(playerid, color, string);
               }
         }
        SendClientMessage(playerid, color, "___________________");
    }
    return 1;
}
This should perfectly workbut for every players. If you want it to work only for cops, just add it
Reply
#6

nope doesn't work...
Reply
#7

I got some errors fixed(see red)

Код:
#define COLOR_WHITE 0xFFFFFFAA

 if(strcmp("/wanted", cmdtext, true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        SendClientMessage(playerid, COLOR_WHITE, "Current Wanted Suspects;");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
              new wantedlvl = GetPLayerWantedLevel(playerid);
              if(wantedlvl > 0)
              {
                    new wantedguy[MAX_PLAYER_NAME];
                    new string[MAX_PLAYER_NAME];
                    GetPlayerName(i, wantedguy, sizeof(wantedguy));
                    format(string, sizeof(string), "Name: %s || Wanted Level: %d", wantedguy, wantedlvl);
                    SendClientMessage(playerid, TEAM_CIVIL_COLOR, string);
               }
         }
        SendClientMessage(playerid, COLOR_WHITE, "___________________");
    }
    return 1;
}
the blue line is getting me keeping errors.. maybe someone can give the code to me in/as [FS]filterscript?

EDIT: shit the colors don't work in code... so a lil weird but here:

#define COLOR_WHITE 0xFFFFFFAA

if(strcmp("/wanted", cmdtext, true) == 0)
{
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_WHITE, "Current Wanted Suspects;");
for(new i = 0; i < MAX_PLAYERS; i++)
{
new wantedlvl = GetPLayerWantedLevel(playerid);
if(wantedlvl > 0)
{
new wantedguy[MAX_PLAYER_NAME];
new string[MAX_PLAYER_NAME];
GetPlayerName(i, wantedguy, sizeof(wantedguy));
format(string, sizeof(string), "Name: %s || Wanted Level: %d", wantedguy, wantedlvl);
SendClientMessage(playerid, TEAM_CIVIL_COLOR, string);
}
}
SendClientMessage(playerid, COLOR_WHITE, "___________________");
}
return 1;
}
Reply
#8

OK i got it to work
thanks for the help!

good code is this: (it won't show players wantedlevel only if he's wanted or not)

Код:
//at the other #definings!
#define COLOR_WHITE 0xFFFFFFAA

// public OnPlayerCommandText(playerid, cmdtext[])
// {
if(strcmp("/wanted", cmdtext, true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
         SendClientMessage(playerid, COLOR_WHITE, "Current Wanted Suspects;");
         for(new i = 0; i < MAX_PLAYERS; i++)
         {
               new plwl = GetPlayerWantedLevel(i);
               if(plwl > 0)
               {
                    new wantedguy[MAX_PLAYER_NAME];
                    new string[MAX_PLAYER_NAME];
                    GetPlayerName(i, wantedguy, sizeof(wantedguy));
                    format(string, sizeof(string), "Name: %s || Wanted Level: %d", wantedguy, plwl);
                    SendClientMessage(playerid, TEAM_CIVIL_COLOR, string);
               }
         }
         SendClientMessage(playerid, COLOR_WHITE, "___________________");
     }
     return 1;
}

// return 0;

// }
Reply
#9

Quote:
Originally Posted by jesse237
I got some errors fixed(see red)
Arf stupid errors, I'm always forgetting some characters
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)