I need help with this command!
#2

You need to put a check in to see if the player their trying to arrest is the same as the playerid. Something like
pawn Код:
if(i == playerid) return SendClientMessage(playerid,-1,"You cannot arrest yourself");
should work fine, If you don't want it to say 'you cannot arrest yourself' you could just put
pawn Код:
if(i != playerid)
pawn Код:
if(newkeys == KEY_LOOK_BEHIND)
{
    if(gTeam[playerid] == TEAM_COPS)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(GetDistanceBetweenPlayers(i,playerid) > 5) return SendClientMessage(playerid,COLOR_WHITE,"Nobody is close enough");
            if(GetDistanceBetweenPlayers(i,playerid) < 5)
            {
                if(i == playerid) return SendClientMessage(playerid, -1,"You cannot arrest yourself.");
                if(GetPlayerWantedLevel(i) > 0)
                {
                    TogglePlayerControllable(i,0);
                    GivePlayerMoney(playerid,500);
                    GivePlayerMoney(i,-500);
                    new copname[20];
                    new wantedname[20];
                    GetPlayerName(i,wantedname,sizeof(wantedname));
                    GetPlayerName(playerid,copname,sizeof(copname));
                    new string[128];
                    format(string,sizeof(string),"%s(%d) has been arrested by officer %s(%d)",wantedname,i,copname,playerid);
                    SendClientMessageToAll(COLOR_GREY,string);
                }
            }
        }
    }
}
Hopefully something like that should work.
Reply


Messages In This Thread
I need help with this command! - by Cjgogo - 28.05.2011, 13:41
Re: I need help with this command! - by Haydz - 28.05.2011, 13:52
Re: I need help with this command! - by cs_master - 28.05.2011, 13:56
Re: I need help with this command! - by Cjgogo - 28.05.2011, 14:10
Re: I need help with this command! - by Cjgogo - 28.05.2011, 15:16
Re: I need help with this command! - by x-cutter - 28.05.2011, 15:32
Re: I need help with this command! - by Cjgogo - 28.05.2011, 15:39
Re: I need help with this command! - by Cjgogo - 28.05.2011, 15:47

Forum Jump:


Users browsing this thread: 1 Guest(s)