Quote:
Originally Posted by Quickie
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
|
Thanks for the code Quickie but based on my ideas and my script, i was actually going to avoid having commands to ticket and arrest players.
And a few corrections to the code you provided:
pawn Код:
// 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???
if you have global variables, made as "per-player" variables, those should be:
pawn Код:
if(ticketid[i]) == 1 //did get the variable assigned as he was wanted with 1 wanted level.
Btw, you misunderstood my code, i don't think you can help so much then. But thanks for trying. (Based on the variables you said i had to create...). And if you don't know how to help, you shouldn't try, it only confuses people.
let me repeat my question for the forum:
I have a loop, and i want to do actions comparing "two" "i's" in the script, like two different players. How can i do this; is there any other way than in the code i provided firstly?
I want to check if the saved variable (the wanted playerid's ID) later in my code, so i can perform an arrest or ticket on the wanted player. It's hard to explain, so let me show by some code:
pawn Код:
else if(PlayerToPlayer(i, ticketid, 4)
if you see the "ticketid", you'll understand. I can't compare two "i" in the code, that would mean the same player. How can i set the variable / an variable to hold the playerid of the wanted player?
Any tips and tricks ?