31.10.2014, 02:59
i agree with this
pawn Код:
if(GetPlayerWantedLevel(i) > 1)
wantedid[i]= 1;// change it to wantedid[i]=GetPlayerWantedLevel(i); so you will configure his actual wanted level and store to his player variable wantedid[playerid]
// ur looping to connected players foreach(new i:Player) and does the "i" signifies the id of the
// current looped player so wantedid[i] is a clever move
//
//the isplayerinvehicle thing
// change it to
if(IsPlayerInAnyVehicle(i)) // as i just have said,,.. the "i" signifies the id of the current plyer looped
// im sorry cuz i just barely read your code and cant understand the rest 3/4 of it
// what does the ticketid and wantedid?
//it should be
if(ticketid == -1) // this checks if the player is a cop right ??? ive notice u write if(ticketid != -1)
if(wantedid==-1)// this one too???
//BTW i can provide you a better code instead of your onplayerupdate like timer
// make a command for cop player so he can ticket or arrest the wanted player
// like /ticket and /arrest
CMD:arrest(playerid,params[])
{
new targetid,msg1[128],msg2[128];
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
if(iscop[playerid]!=1) // checks if the player enter this command is a cop then if its not he cant use this command
{
return SendClientMessage(playerid,-1,"only cops can use this command");
}
if(isnull(params) // if the cop just enter "/arrest"
{
foreach(new i:Player) // looping throuh all players
{
if(i==playerid)continue; // if loops reached the cops id then we'll skip
if(IsPlayerInRangeOfPoint(i, 7.0, X, Y, Z)&&GetPlayerWantedLevel(i)) // checking if there is wanted player nearby
{
// ur command to arrest the player
SendClientMessage(i,-1,"arrested for being wanted");
return SendClientMessage(playerid,-1,"you have arrested a wanted player); // stopping the loop if we found the wantedplayer
}
}
return SendClientMessage(playerid,-1,"no wanted player nearby");// prints to the client if we cant find a wanted player nearby
}
// gets though here if the player type /arrest <id/name>
if(sscanf(params,"u",targetid)) // checks if the player enter a valid syntax
{
return SendClientMessage(playerid,-1,"Syntax: /arrest <id/name>");
}
if(targetid==INVALID_PLAYER_ID) // checks if the player enters the invalid targetid eg.yourself and offline player
{
return SendClientMessage(playerid,-1,"player not found");
}
if(IsPlayerInRangeOfPoint(targetid, 7.0, X, Y, Z)&&GetPlayerWantedLevel(playerid)) // checks if the player is wanted and is if the player nearby
{
// ur command to arrest the player
SendClientMessage(i,-1,"arrested for being wanted");
return SendClientMessage(playerid,-1,"you have arrested a wanted player);
}
else
{
return SendClientMessage(playerid,-1,"player must be near");
}
return 1;
}
// i hope this will help you
// goodluck