Arrest Distance
#1

PHP код:
CMD:arrest(playeridparams[])
{
    new 
cName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], targetidstring[128], string1[128];
    if(
gTeam[playerid] == CIVILIANS || gTeam[playerid] == MEDICS) return SendClientMessage(playeridROJOO"Only Cops Can Arrest People");
    if(
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridRED"You can't arrest players from a vehicle.");
    if(
sscanf(params"u"targetid)) return SendClientMessage(playeridROJOO"USAGE: /ar <playerid>");
    if(
targetid == playerid) return SendClientMessage(playeridROJOO"You can't arrest yourself");
    if(
GetDistanceBetweenPlayers(playerid,targetid) > 10 && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(targetid))
    {
                  
GetPlayerName(playeridcNamesizeof(cName));
                  
GetPlayerName(targetidtNamesizeof(tName));
                  if(
IsPlayerConnected(targetid))
                  {
                    if(
GetPlayerWantedLevel(targetid) >= 4)
                    {
                       if(
HasBeenArrested{playerid} == false)
                       {
                         if(
gTeam[playerid] == COPS)
                         {
                                new 
pay random(1500) + 3000;
                                
TogglePlayerControllable(targetidfalse);
                                
GameTextForPlayer(targetid"~r~Arrested!"30005);
                                
format(string1sizeof(string1), "You have been arrested by %s (%d). You lose $%d"GetName(playerid), playeridpay);
                                
SendClientMessage(targetidCOLOR_CYANstring1);
                                
GameTextForPlayer(playerid,"~w~Suspect ~g~Arrested.",5000,5);
                                
SetPlayerScore(playeridGetPlayerScore(playerid) + 1);
                                
GivePlayerCashEx(playeridpay);
                                
GivePlayerCashEx(targetid, -pay);
                                
pInfo[playerid][pArrest] ++;
                                
pInfo[targetid][pBusted] ++;
                                
ApplyAnimation(playerid"ped""ARRESTgun"4.101111);
                                
format(stringsizeof(string), "%s (%d) has been arrested by Cop %s (%d)!"GetName(targetid), targetidGetName(playerid), playerid);
                                
SendClientMessageToAll(COLOR_CYANstring);
                                
SetPlayerScore(targetidGetPlayerScore(targetid) - 1);
                                
SetPlayerScore(playeridGetPlayerScore(targetid) + 1);
                                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_HANDSUP);
                                
SetTimerEx("SendPlayerToJail"3000false"d"targetid);
                                
HasBeenArrested{targetid} = true;
                         }
                         else if(
gTeam[playerid] == CIA)
                         {
                                new 
pay random(1500) + 3000;
                                
TogglePlayerControllable(targetidfalse);
                                
GameTextForPlayer(targetid"~r~Arrested!"30005);
                                
format(string1sizeof(string1), "You have been arrested by %s (%d). You lose $%d"GetName(playerid), playeridpay);
                                
SendClientMessage(targetidCOLOR_CYANstring1);
                                
GameTextForPlayer(playerid,"~w~Suspect ~g~Arrested.",5000,5);
                                
SetPlayerScore(playeridGetPlayerScore(playerid) + 1);
                                
GivePlayerCashEx(playeridpay);
                                
GivePlayerCashEx(targetid, -pay);
                                
pInfo[playerid][pArrest] ++;
                                
pInfo[targetid][pBusted] ++;
                                
ApplyAnimation(playerid"ped""ARRESTgun"4.101111);
                                
format(stringsizeof(string), "%s (%d) has been arrested by an undercover CIA agent %s (%d)!"GetName(targetid), targetidGetName(playerid), playerid);
                                
SendClientMessageToAll(COLOR_CYANstring);
                                
SetPlayerScore(targetidGetPlayerScore(targetid) - 1);
                                
SetPlayerScore(playeridGetPlayerScore(targetid) + 1);
                                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_HANDSUP);
                                
SetTimerEx("SendPlayerToJail"3000false"d"targetid);
                                
HasBeenArrested{targetid} = true;
                         }
                         else if(
gTeam[playerid] == FBI)
                         {
                                new 
pay random(1500) + 3000;
                                
TogglePlayerControllable(targetidfalse);
                                
GameTextForPlayer(targetid"~r~Arrested!"30005);
                                
format(string1sizeof(string1), "You have been arrested by %s (%d). You lose $%d"GetName(playerid), playeridpay);
                                
SendClientMessage(targetidCOLOR_CYANstring1);
                                
GameTextForPlayer(playerid,"~w~Suspect ~g~Arrested.",5000,5);
                                
SetPlayerScore(playeridGetPlayerScore(playerid) + 1);
                                
GivePlayerCashEx(playeridpay);
                                
GivePlayerCashEx(targetid, -pay);
                                
pInfo[playerid][pArrest] ++;
                                
pInfo[targetid][pBusted] ++;
                                
ApplyAnimation(playerid"ped""ARRESTgun"4.101111);
                                
format(stringsizeof(string), "%s (%d) has been arrested by an FBI %s (%d)!"GetName(targetid), targetidGetName(playerid), playerid);
                                
SendClientMessageToAll(COLOR_CYANstring);
                                
SetPlayerScore(targetidGetPlayerScore(targetid) - 1);
                                
SetPlayerScore(playeridGetPlayerScore(targetid) + 1);
                                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_HANDSUP);
                                
SetTimerEx("SendPlayerToJail"3000false"d"targetid);
                                
HasBeenArrested{targetid} = true;
                         }
                         else if(
gTeam[playerid] == ARMY)
                         {
                                new 
pay random(1500) + 3000;
                                
TogglePlayerControllable(targetidfalse);
                                
GameTextForPlayer(targetid"~r~Arrested!"30005);
                                
format(string1sizeof(string1), "You have been arrested by %s (%d). You lose $%d"GetName(playerid), playeridpay);
                                
SendClientMessage(targetidCOLOR_CYANstring1);
                                
GameTextForPlayer(playerid,"~w~Suspect ~g~Arrested.",5000,5);
                                
SetPlayerScore(playeridGetPlayerScore(playerid) + 1);
                                
GivePlayerCashEx(playeridpay);
                                
GivePlayerCashEx(targetid, -pay);
                                
pInfo[playerid][pArrest] ++;
                                
pInfo[targetid][pBusted] ++;
                                
ApplyAnimation(playerid"ped""ARRESTgun"4.101111);
                                
format(stringsizeof(string), "%s (%d) has been arrested by an Army %s (%d)!"GetName(targetid), targetidGetName(playerid), playerid);
                                
SendClientMessageToAll(COLOR_CYANstring);
                                
SetPlayerScore(targetidGetPlayerScore(targetid) - 1);
                                
SetPlayerScore(playeridGetPlayerScore(targetid) + 1);
                                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_HANDSUP);
                                
SetTimerEx("SendPlayerToJail"3000false"d"targetid);
                                
HasBeenArrested{targetid} = true;
                         }
                       }
                    }
                    else return 
SendClientMessage(playeridRED"There are no wanted players enough close.");
                  }
                  else return 
SendClientMessage(playeridRED"Invalid playerid.");
    }
    else 
SendClientMessage(playeridRED"There are no wanted players enough close.");
    return 
1;

Well, It arresting me even im so far. What's wrong with Distance codes? anyone help?
Reply
#2

FXIED IT!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)