GetClosestPlayer
#1

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!
Reply
#2

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
Reply
#3

Ive added it but when they type the correct id

it send a message but with nothing in the message :/
Reply
#4

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
Reply
#5

http://pastebin.com/m6fb5739e
Reply
#6

that was a quite messy code :S http://pastebin.com/m7a2ed793
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)