GetClosestPlayer - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: GetClosestPlayer (
/showthread.php?tid=115326)
GetClosestPlayer -
Kyle - 23.12.2009
Hello, I have a /arrest command which i want it so it can use (id) aswell as getclosestplayer how do i do it so they both work together currently i only have /arrest (id) but i want them to work with both heres part of my command.
http://pastebin.com/m24a3b529
Thanks For Looking!
Re: GetClosestPlayer -
Nero_3D - 23.12.2009
indention ? :S
pawn Код:
if(strcmp(cmd, "/ar", true) == 0 || strcmp(cmd, "/arrest", true) == 0) {
if(Spawned[playerid] == 0)
return SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
else if(gTeam[playerid] != TEAM_POLICE && gTeam[playerid] != TEAM_ARMY)
return SendClientMessage(playerid,COLOR_ERROR,"You are not a Law Enforcement officer ");
else if(Jailed[playerid] == 1)
return SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command in jail");
else if( (tmp = strtok(cmdtext, idx))[0] != EOS) {
if(!IsNumeric(tmp)) return SendClientMessage(playerid, COLOR_ERROR, "USAGE: /ar (id) - /arrest (id) ID Must be a number");
else if(!IsPlayerConnected( (giveplayerid = strval(tmp)) )) {
format(string, sizeof(string), "ID (%d) is not an active player", giveplayerid);
return SendClientMessage(playerid, COLOR_ERROR, string);
}
}
else giveplayerid = GetClosestPlayer(playerid);
//And the rest of your code
}
Like always, this is untested
Re: GetClosestPlayer -
Kyle - 23.12.2009
Ive added it but when they type the correct id
it send a message but with nothing in the message :/
Re: GetClosestPlayer -
Nero_3D - 24.12.2009
you have added it ?, sounds like you put it somewhere between :S
it sends a message ? ah which message ?
the best if you up the new code and tell the problem so exactly and short like possible
Re: GetClosestPlayer -
Kyle - 24.12.2009
http://pastebin.com/m6fb5739e
Re: GetClosestPlayer -
Nero_3D - 24.12.2009
that was a quite messy code :S
http://pastebin.com/m7a2ed793