/arrest problem!
#1

When i type /ar [ID] They given me You are not close enough to the player! and the player near me 1meter only whats the problem here?



PHP код:
CMD:ar(playeridparams[])
{
    if(
GetTeam{playerid} == CLASS_CIV || GetTeam{playerid} == CLASS_MEDIC) return SendClientMessage(playeridRED"Only law enforcement can arrest players.");
    new 
pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME],targetid,string[400];
    new 
Float:targetidpos[3];
    if(
GetPlayerInterior(targetid) > 0) return SendClientMessage(playeridred"ERROR: You can't arrest players inside an interior.");
    if(
sscanf(params"ui"targetid)) SendClientMessage(playeridCOLOR_WHITE"USAGE: /ar [ID/NAME]");
    if(
GetPVarInt(playerid,"ArTime")>GetTickCount())return SendClientMessage(playerid,0xFF0000FF,"{FF0000}[Please wait]: {FFFFFF}Just Wait 5 seconds before arresting a suspect again.");
    if(
PlayerInfo[targetid][pJailed] == 1) return SendClientMessage(playeridred"This player is already in jail,you can't arrest him.");
    if(
IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid,red,"You can't arrest players if they're in a vehicle.");
    if(
GetPlayerWantedLevel(targetid) <= 3) return SendClientMessage(playeridred"{FF0000}ERROR: {FFFFFF}No eligible players are in range to receive a ticket.");
    if(
GetPlayerWantedLevel(targetid) > 0) return SendClientMessage(playeridred"{ff0000}[ERROR]: {FFFFFF}You are not close enough to the player!");
    if(
playerid == targetid) return SendClientMessage(playerid,red"You can't arrest yourself,you stupid or what?");
    if(
gTeam[playerid] == CLASS_COPS && gTeam[targetid] == CLASS_COPS) return SendClientMessage(playerid,red"You can't arrest who is in your team.");
    
GetPlayerPos(playeridtargetidpos[0], targetidpos[1], targetidpos[2]);
    if (!
IsPlayerInRangeOfPoint(playerid5.0targetidpos[0], targetidpos[1], targetidpos[2])) return SendClientMessage(playerid, -1"Nobody close enough to arrest.");
    
GetPlayerName(playeridpNamesizeof(pName));
    
GetPlayerName(targetidtNamesizeof(tName));
    if(
IsPlayerConnected(targetid))
        {
            if(
GetTeam{playerid} == CLASS_COPS)
            if(
GetPlayerWantedLevel(targetid) >= 4)
            {
                new 
ArrestReward random(15000) + 2500;
                  if(
ArrestReward GetPlayerCash(playerid))
                
TimerArrest[targetid] = SetTimerEx("BeginArrestedTimer"10000false,"i"targetid); // 10 Secdons timer
                   
BeginArrested[targetid] = 1;
                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED);
                
SetPlayerAttachedObject(targetid8194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
                
format(stringsizeof(string), "{0080FF}[BEING ARRESTED]: {FFFFFF}Law Enforcement Officer %s(%d) has put {ADFF2F}Handcuffs {FFFFFF}on you."pNameplayerid);
                
format(stringsizeof(string), "You have placed {0080FF}%s(%d) {FFFFFF}in Handcuffs for an Arrest. Use {0080FF}/search (id) {FFFFFF}to search Him for illegal Drugs."tNametargetid);
                
SendClientMessage(targetid, -1"{0080FF}[BEING ARRESTED]: {FFFFFF}Use {0080FF}/breakcuffs (/bc) {FFFFFF}to attempt to evade the Arrest.");
                
format(stringsizeof(string), "{ffffff}You have Arrested {FFD700}%s(%d){FFFFFF}. You have received {33FF33}$%d {FFFFFF}for this Arrest."tNametargetidArrestReward);
                
SendClientMessage(playeridredstring);
                new 
current_zone player_zone[targetid];
                
format(stringsizeof(string), "{0080FF}[ARRESTED]: {FFD700}%s(%d) {FFFFFF}has been {33CCFF}Arrested {FFFFFF}by {308AFF}Officer %s(%d){FFFFFF}! Location: %s"tNametargetidpNameplayerid,zones[current_zone][zone_name]);
                
SendClientMessageToAll(yellowstring);
                
format(stringsizeof(string), "~w~You have ~G~Arrested ~Y~%s(%d)~n~n~You have received ~n~n~~y~$%d ~w~for this Arrest."tNametargetidArrestReward);
                
GameTextForPlayer(playeridstring70005);
                
GivePlayerMoney(playeridArrestReward);
                
SetPlayerScore(playeridGetPlayerScore(playerid)+1);
                
SetPlayerScore(playeridGetPlayerScore(targetid)-1);
                
pJailTimerID[targetid] = SetTimerEx("pJailTimer"3000true"i"targetid);
                
pJailCount[targetid] = 20 random(40);
                new 
Random random(sizeof(RandomJailSpawns));
                
SetPlayerPos(targetidRandomJailSpawns[Random][0], RandomJailSpawns[Random][1], RandomJailSpawns[Random][2]);
                
SetPlayerFacingAngle(targetidRandomJailSpawns[Random][2]);
                
ResetPlayerWeapons(targetid);
                
SetPlayerInterior(targetid10);
                
SetPlayerWantedLevel(targetid,0);
                
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
            }
            else if(
GetTeam{playerid} == CLASS_ARMY)
            if(
GetPlayerWantedLevel(targetid) >= 4)
            {
                new 
ArrestReward random(20000) + 2500;
                  if(
ArrestReward GetPlayerCash(playerid))
                
TimerArrest[targetid] = SetTimerEx("BeginArrestedTimer"10000false,"i"targetid); // 10 Secdons timer
                   
BeginArrested[targetid] = 1;
                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED);
                
SetPlayerAttachedObject(targetid8194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
                
format(stringsizeof(string), "{7E01F3}[BEING ARRESTED]: {7E01F3}Law Enforcement Army {FFFFFF}%s(%d) has put {ADFF2F}Handcuffs {FFFFFF}on you."pNameplayerid);
                
format(stringsizeof(string), "You have placed {0080FF}%s(%d) {FFFFFF}in Handcuffs for an Arrest. Use {0080FF}/search (id) {FFFFFF}to search Him for illegal Drugs."tNametargetid);
                
SendClientMessage(targetid, -1"{7E01F3}[BEING ARRESTED]: {FFFFFF}Use {0080FF}/breakcuffs (/bc) {FFFFFF}to attempt to evade the Arrest.");
                
format(stringsizeof(string), "{ffffff}You have Arrested {FFD700}%s(%d){FFFFFF}. You have received {33FF33}$%d {FFFFFF}for this Arrest."tNametargetidArrestReward);
                
SendClientMessage(playeridredstring);
                
format(stringsizeof(string), "{7E01F3}[ARRESTED]: {FFD700}%s(%d) {FFFFFF}has been {33CCFF}Arrested {FFFFFF}by {7E01F3}A.R.M.Y {0080FF}%s(%d)"tNametargetidpNameplayerid);
                
SendClientMessageToAll(yellowstring);
                
format(stringsizeof(string), "~w~You have ~G~Arrested ~Y~%s(%d)~n~n~You have received ~n~n~~y~$%d ~w~for this Arrest."tNametargetidArrestReward);
                
GameTextForPlayer(playeridstring70005);
                
GivePlayerMoney(playeridArrestReward);
                
SetPlayerScore(playeridGetPlayerScore(playerid)+1);
                
SetPlayerScore(playeridGetPlayerScore(targetid)-1);
                
pJailTimerID[targetid] = SetTimerEx("pJailTimer"3000true"i"targetid);
                
pJailCount[targetid] = 20 random(40);
                new 
Random random(sizeof(RandomJailSpawns));
                
SetPlayerPos(targetidRandomJailSpawns[Random][0], RandomJailSpawns[Random][1], RandomJailSpawns[Random][2]);
                
SetPlayerFacingAngle(targetidRandomJailSpawns[Random][1]);
                
ResetPlayerWeapons(targetid);
                
SetPlayerInterior(targetid10);
                
SetPlayerWantedLevel(targetid,0);
                
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
            }
            else if(
GetTeam{playerid} == CLASS_SWAT)
            if(
GetPlayerWantedLevel(targetid) >= 4)
            {
                new 
ArrestReward random(25000) + 2500;
                  if(
ArrestReward GetPlayerCash(playerid))
                
TimerArrest[targetid] = SetTimerEx("BeginArrestedTimer"10000false,"i"targetid); // 10 Secdons timer
                   
BeginArrested[targetid] = 1;
                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED);
                
SetPlayerAttachedObject(targetid8194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
                
format(stringsizeof(string), "{00FFFB}[BEING ARRESTED]: {00FFFB}Law Enforcement SWAT {FFFFFF}%s(%d) has put {ADFF2F}Handcuffs {FFFFFF}on you."pNameplayerid);
                
format(stringsizeof(string), "You have placed {0080FF}%s(%d) {FFFFFF}in Handcuffs for an Arrest. Use {0080FF}/search (id) {FFFFFF}to search Him for illegal Drugs."tNametargetid);
                
SendClientMessage(targetid, -1"{00FFFB}[BEING ARRESTED]: {FFFFFF}Use {0080FF}/breakcuffs (/bc) {FFFFFF}to attempt to evade the Arrest.");
                
format(stringsizeof(string), "{ffffff}You have Arrested {FFD700}%s(%d){FFFFFF}. You have received {33FF33}$%d {FFFFFF}for this Arrest."tNametargetidArrestReward);
                
SendClientMessage(playeridredstring);
                
format(stringsizeof(string), "{00FFFB}[ARRESTED]: {FFD700}%s(%d) {FFFFFF}has been {33CCFF}Arrested {FFFFFF}by {00FFFB}S.W.A.T {0080FF}%s(%d)"tNametargetidpNameplayerid);
                
SendClientMessageToAll(yellowstring);
                
format(stringsizeof(string), "~w~You have ~G~Arrested ~Y~%s(%d)~n~n~You have received ~n~n~~y~$%d ~w~for this Arrest."tNametargetidArrestReward);
                
GameTextForPlayer(playeridstring70005);
                
GivePlayerMoney(playeridArrestReward);
                
SetPlayerScore(playeridGetPlayerScore(playerid)+1);
                
SetPlayerScore(playeridGetPlayerScore(targetid)-1);
                
pJailTimerID[targetid] = SetTimerEx("pJailTimer"3000true"i"targetid);
                
pJailCount[targetid] = 20 random(40);
                new 
Random random(sizeof(RandomJailSpawns));
                
SetPlayerPos(targetidRandomJailSpawns[Random][0], RandomJailSpawns[Random][1], RandomJailSpawns[Random][2]);
                
SetPlayerFacingAngle(targetidRandomJailSpawns[Random][2]);
                
ResetPlayerWeapons(targetid);
                
SetPlayerInterior(targetid10);
                
SetPlayerWantedLevel(targetid,0);
                
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
            }
            else if(
GetTeam{playerid} == CLASS_CIA)
            if(
GetPlayerWantedLevel(targetid) >= 4)
            {
                new 
ArrestReward random(25000) + 2500;
                  if(
ArrestReward GetPlayerCash(playerid))
                
TimerArrest[targetid] = SetTimerEx("BeginArrestedTimer"10000false,"i"targetid); // 10 Secdons timer
                   
BeginArrested[targetid] = 1;
                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED);
                
SetPlayerAttachedObject(targetid8194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
                
format(stringsizeof(string), "{0080FF}[BEING ARRESTED]: {00FFFB}Law Enforcement C.I.A {FFFFFF}%s(%d) has put {ADFF2F}Handcuffs {FFFFFF}on you."pNameplayerid);
                
format(stringsizeof(string), "You have placed {0080FF}%s(%d) {FFFFFF}in Handcuffs for an Arrest. Use {0080FF}/search (id) {FFFFFF}to search Him for illegal Drugs."tNametargetid);
                
SendClientMessage(targetid, -1"{0080FF}[BEING ARRESTED]: {FFFFFF}Use {0080FF}/breakcuffs (/bc) {FFFFFF}to attempt to evade the Arrest.");
                
format(stringsizeof(string), "{ffffff}You have Arrested {FFD700}%s(%d){FFFFFF}. You have received {33FF33}$%d {FFFFFF}for this Arrest."tNametargetidArrestReward);
                
SendClientMessage(playeridredstring);
                
format(stringsizeof(string), "{0080FF}[ARRESTED]: {FFD700}%s(%d) {FFFFFF}has been {33CCFF}Arrested {FFFFFF}by {FFFFFF}C.I.A {0080FF}%s(%d)"tNametargetidpNameplayerid);
                
SendClientMessageToAll(yellowstring);
                
format(stringsizeof(string), "~w~You have ~G~Arrested ~Y~%s(%d)~n~n~You have received ~n~n~~y~$%d ~w~for this Arrest."tNametargetidArrestReward);
                
GameTextForPlayer(playeridstring70005);
                
GivePlayerMoney(playeridArrestReward);
                
SetPlayerScore(playeridGetPlayerScore(playerid)+1);
                
SetPlayerScore(playeridGetPlayerScore(targetid)-1);
                
pJailTimerID[targetid] = SetTimerEx("pJailTimer"3000true"i"targetid);
                
pJailCount[targetid] = 20 random(40);
                new 
Random random(sizeof(RandomJailSpawns));
                
SetPlayerPos(targetidRandomJailSpawns[Random][0], RandomJailSpawns[Random][1], RandomJailSpawns[Random][2]);
                
SetPlayerFacingAngle(targetidRandomJailSpawns[Random][1]);
                
ResetPlayerWeapons(targetid);
                
SetPlayerInterior(targetid10);
                
SetPlayerWantedLevel(targetid,0);
                
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
            }
            else if(
GetTeam{playerid} == CLASS_FBI)
            if(
GetPlayerWantedLevel(targetid) >= 4)
            {
                new 
ArrestReward random(25000) + 2500;
                  if(
ArrestReward GetPlayerCash(playerid))
                
TimerArrest[targetid] = SetTimerEx("BeginArrestedTimer"10000false,"i"targetid); // 10 Secdons timer
                   
BeginArrested[targetid] = 1;
                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED);
                
SetPlayerAttachedObject(targetid8194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
                
format(stringsizeof(string), "{0080FF}[BEING ARRESTED]: {0080FF}Law Enforcement F.B.I {FFFFFF}%s(%d) has put {ADFF2F}Handcuffs {FFFFFF}on you."pNameplayerid);
                
format(stringsizeof(string), "You have placed {0080FF}%s(%d) {FFFFFF}in Handcuffs for an Arrest. Use {0080FF}/search (id) {FFFFFF}to search Him for illegal Drugs."tNametargetid);
                
SendClientMessage(targetid, -1"{0080FF}[BEING ARRESTED]: {FFFFFF}Use {0080FF}/breakcuffs (/bc) {FFFFFF}to attempt to evade the Arrest.");
                
format(stringsizeof(string), "{ffffff}You have Arrested {FFD700}%s(%d){FFFFFF}. You have received {33FF33}$%d {FFFFFF}for this Arrest."tNametargetidArrestReward);
                
SendClientMessage(playeridredstring);
                
format(stringsizeof(string), "{0080FF}[ARRESTED]: {FFD700}%s(%d) {FFFFFF}has been {33CCFF}Arrested {FFFFFF}by {0080FF}F.B.I {0080FF}%s(%d)"tNametargetidpNameplayerid);
                
SendClientMessageToAll(yellowstring);
                
format(stringsizeof(string), "~w~You have ~G~Arrested ~Y~%s(%d)~n~n~You have received ~n~n~~y~$%d ~w~for this Arrest."tNametargetidArrestReward);
                
GameTextForPlayer(playeridstring70005);
                
GivePlayerMoney(playeridArrestReward);
                
SetPlayerScore(playeridGetPlayerScore(playerid)+1);
                
SetPlayerScore(playeridGetPlayerScore(targetid)-1);
                
pJailTimerID[targetid] = SetTimerEx("pJailTimer"3000true"i"targetid);
                
pJailCount[targetid] = 20 random(40);
                new 
Random random(sizeof(RandomJailSpawns));
                
SetPlayerPos(targetidRandomJailSpawns[Random][0], RandomJailSpawns[Random][1], RandomJailSpawns[Random][2]);
                
SetPlayerFacingAngle(targetidRandomJailSpawns[Random][1]);
                
ResetPlayerWeapons(targetid);
                
SetPlayerInterior(targetid10);
                
SetPlayerWantedLevel(targetid,0);
                
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
            }
         }
         return 
1;

Reply
#2

PHP код:
    if(GetPlayerWantedLevel(targetid) > 0) return SendClientMessage(playeridred"{ff0000}[ERROR]: {FFFFFF}You are not close enough to the player!"); 
This line is the error, You are making it like if the player is WANTED send this message to the person trying to arrest, Change it to this..

PHP код:
    if(GetPlayerWantedLevel(targetid) < 0) return SendClientMessage(playeridred"{ff0000}[ERROR]: {FFFFFF}This player is not wanted!"); 
Reply
#3

I Did that its still same!! So I Think the problem when i've add For if(GetTeam{playerid} == CLASS_COPS) AND Added +3like that the problem is with {} right? So i dont know how to fix it... can you do that?
Reply
#4

Send me the current code now..
Reply
#5

Sscanf line is wrong. It asks for two parameters but you only use one. Also beats me what the relation is between wanted level and distance.
Reply
#6

Код:
 GetPlayerPos(playerid, targetidpos[0], targetidpos[1], targetidpos[2]); 
    if (!IsPlayerInRangeOfPoint(playerid, 5.0, targetidpos[0], targetidpos[1], targetidpos[2])) return SendClientMessage(playerid, -1, "Nobody close enough to arrest.");
to

Код:
 GetPlayerPos(targetid, targetidpos[0], targetidpos[1], targetidpos[2]); 
    if (!IsPlayerInRangeOfPoint(playerid, 5.0, targetidpos[0], targetidpos[1], targetidpos[2])) return SendClientMessage(playerid, -1, "Nobody close enough to arrest.");
Also like Vincent mentioned, you're judging how far a player is by their wanted level? That's stupid.
Change these:
Код:
 if(GetPlayerWantedLevel(targetid) <= 3) return SendClientMessage(playerid, red, "{FF0000}ERROR: {FFFFFF}No eligible players are in range to receive a ticket."); 
    if(GetPlayerWantedLevel(targetid) > 0) return SendClientMessage(playerid, red, "{ff0000}[ERROR]: {FFFFFF}You are not close enough to the player!");
to this

Код:
 if(GetPlayerWantedLevel(targetid) <= 3) return SendClientMessage(playerid, red, "{FF0000}ERROR: {FFFFFF}No nearby players are wanted highly enough to receive a ticket.");
Because I have no clue why you add the second line if you are already checking if they are wanted, the second line just checks if they are wanted at all..
Reply
#7

Full code now is:

PHP код:
CMD:ar(playeridparams[])
{
    if(
GetTeam{playerid} == CLASS_CIV || GetTeam{playerid} == CLASS_MEDIC) return SendClientMessage(playeridRED"Only law enforcement can arrest players.");
    new 
pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME],targetid,string[400];
    new 
Float:targetidpos[3];
    if(
GetPlayerInterior(targetid) > 0) return SendClientMessage(playeridred"ERROR: You can't arrest players inside an interior.");
    if(
sscanf(params"ui"targetid)) SendClientMessage(playeridCOLOR_WHITE"{FF0000}[POLICE]: {FFFFFF}/arrest(/ar) [ID / NAME]");
    if(
GetPVarInt(playerid,"ArTime")>GetTickCount())return SendClientMessage(playerid,0xFF0000FF,"{FF0000}[Please wait]: {FFFFFF}Just Wait 5 seconds before arresting a suspect again.");
    if(
PlayerInfo[targetid][pJailed] == 1) return SendClientMessage(playeridred"This player is already in jail,you can't arrest him.");
    if(
IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid,red,"You can't arrest players if they're in a vehicle.");
    if(
GetPlayerWantedLevel(targetid) <= 3) return SendClientMessage(playeridred"{FF0000}ERROR: {FFFFFF}No nearby players are wanted highly enough to receive a ticket.");
    if(
playerid == targetid) return SendClientMessage(playerid,red"[ERROR]: You cannot arrest yourself.");
    if(
playeridgTeam[playerid] == CLASS_COPS && gTeam[targetid] == CLASS_ARMY && gTeam[playerid] == CLASS_SWAT && gTeam[playerid] == CLASS_CIA && gTeam[playerid] == CLASS_FBI) return SendClientMessage(playerid,red"You can't arrest who is in your team.");
    
GetPlayerPos(targetidtargetidpos[0], targetidpos[1], targetidpos[2]);
    if (!
IsPlayerInRangeOfPoint(playerid5.0targetidpos[0], targetidpos[1], targetidpos[2])) return SendClientMessage(playerid, -1"Nobody close enough to arrest.");
    
GetPlayerName(playeridpNamesizeof(pName));
    
GetPlayerName(targetidtNamesizeof(tName));
    if(
IsPlayerConnected(targetid))
        {
            if(
GetTeam{playerid} == CLASS_COPS)
            {
                new 
ArrestReward random(15000) + 2500;
                  if(
ArrestReward GetPlayerCash(playerid))
                if(
GetPlayerWantedLevel(targetid) >= 4)
                
TimerArrest[targetid] = SetTimerEx("BeginArrestedTimer"10000false,"i"targetid); // 10 Secdons timer
                   
BeginArrested[targetid] = 1;
                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED);
                
SetPlayerAttachedObject(targetid8194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
                
format(stringsizeof(string), "{0080FF}[BEING ARRESTED]: {FFFFFF}Law Enforcement Officer %s(%d) has put {ADFF2F}Handcuffs {FFFFFF}on you."pNameplayerid);
                
format(stringsizeof(string), "You have placed {0080FF}%s(%d) {FFFFFF}in Handcuffs for an Arrest. Use {0080FF}/search (id) {FFFFFF}to search Him for illegal Drugs."tNametargetid);
                
SendClientMessage(targetid, -1"{0080FF}[BEING ARRESTED]: {FFFFFF}Use {0080FF}/breakcuffs (/bc) {FFFFFF}to attempt to evade the Arrest.");
                
format(stringsizeof(string), "{ffffff}You have Arrested {FFD700}%s(%d){FFFFFF}. You have received {33FF33}$%d {FFFFFF}for this Arrest."tNametargetidArrestReward);
                
SendClientMessage(playeridredstring);
                new 
current_zone player_zone[targetid];
                
format(stringsizeof(string), "{0080FF}[ARRESTED]: {FFD700}%s(%d) {FFFFFF}has been {33CCFF}Arrested {FFFFFF}by {308AFF}Officer %s(%d){FFFFFF}! Location: %s"tNametargetidpNameplayerid,zones[current_zone][zone_name]);
                
SendClientMessageToAll(yellowstring);
                
format(stringsizeof(string), "~w~You have ~G~Arrested ~Y~%s(%d)~n~n~You have received ~n~n~~y~$%d ~w~for this Arrest."tNametargetidArrestReward);
                
GameTextForPlayer(playeridstring70005);
                
GivePlayerMoney(playeridArrestReward);
                
SetPlayerScore(playeridGetPlayerScore(playerid)+1);
                
SetPlayerScore(playeridGetPlayerScore(targetid)-1);
                
pJailTimerID[targetid] = SetTimerEx("pJailTimer"3000true"i"targetid);
                
pJailCount[targetid] = 20 random(40);
                new 
Random random(sizeof(RandomJailSpawns));
                
SetPlayerPos(targetidRandomJailSpawns[Random][0], RandomJailSpawns[Random][1], RandomJailSpawns[Random][2]);
                
SetPlayerFacingAngle(targetidRandomJailSpawns[Random][2]);
                
ResetPlayerWeapons(targetid);
                
SetPlayerInterior(targetid10);
                
SetPlayerWantedLevel(targetid,0);
                
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
            }
            else if(
GetTeam{playerid} == CLASS_ARMY)
            if(
GetPlayerWantedLevel(targetid) >= 4)
            {
                new 
ArrestReward random(20000) + 2500;
                  if(
ArrestReward GetPlayerCash(playerid))
                
TimerArrest[targetid] = SetTimerEx("BeginArrestedTimer"10000false,"i"targetid); // 10 Secdons timer
                   
BeginArrested[targetid] = 1;
                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED);
                
SetPlayerAttachedObject(targetid8194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
                
format(stringsizeof(string), "{7E01F3}[BEING ARRESTED]: {7E01F3}Law Enforcement Army {FFFFFF}%s(%d) has put {ADFF2F}Handcuffs {FFFFFF}on you."pNameplayerid);
                
format(stringsizeof(string), "You have placed {0080FF}%s(%d) {FFFFFF}in Handcuffs for an Arrest. Use {0080FF}/search (id) {FFFFFF}to search Him for illegal Drugs."tNametargetid);
                
SendClientMessage(targetid, -1"{7E01F3}[BEING ARRESTED]: {FFFFFF}Use {0080FF}/breakcuffs (/bc) {FFFFFF}to attempt to evade the Arrest.");
                
format(stringsizeof(string), "{ffffff}You have Arrested {FFD700}%s(%d){FFFFFF}. You have received {33FF33}$%d {FFFFFF}for this Arrest."tNametargetidArrestReward);
                
SendClientMessage(playeridredstring);
                
format(stringsizeof(string), "{7E01F3}[ARRESTED]: {FFD700}%s(%d) {FFFFFF}has been {33CCFF}Arrested {FFFFFF}by {7E01F3}A.R.M.Y {0080FF}%s(%d)"tNametargetidpNameplayerid);
                
SendClientMessageToAll(yellowstring);
                
format(stringsizeof(string), "~w~You have ~G~Arrested ~Y~%s(%d)~n~n~You have received ~n~n~~y~$%d ~w~for this Arrest."tNametargetidArrestReward);
                
GameTextForPlayer(playeridstring70005);
                
GivePlayerMoney(playeridArrestReward);
                
SetPlayerScore(playeridGetPlayerScore(playerid)+1);
                
SetPlayerScore(playeridGetPlayerScore(targetid)-1);
                
pJailTimerID[targetid] = SetTimerEx("pJailTimer"3000true"i"targetid);
                
pJailCount[targetid] = 20 random(40);
                new 
Random random(sizeof(RandomJailSpawns));
                
SetPlayerPos(targetidRandomJailSpawns[Random][0], RandomJailSpawns[Random][1], RandomJailSpawns[Random][2]);
                
SetPlayerFacingAngle(targetidRandomJailSpawns[Random][1]);
                
ResetPlayerWeapons(targetid);
                
SetPlayerInterior(targetid10);
                
SetPlayerWantedLevel(targetid,0);
                
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
            }
            else if(
GetTeam{playerid} == CLASS_SWAT)
            if(
GetPlayerWantedLevel(targetid) >= 4)
            {
                new 
ArrestReward random(25000) + 2500;
                  if(
ArrestReward GetPlayerCash(playerid))
                
TimerArrest[targetid] = SetTimerEx("BeginArrestedTimer"10000false,"i"targetid); // 10 Secdons timer
                   
BeginArrested[targetid] = 1;
                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED);
                
SetPlayerAttachedObject(targetid8194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
                
format(stringsizeof(string), "{00FFFB}[BEING ARRESTED]: {00FFFB}Law Enforcement SWAT {FFFFFF}%s(%d) has put {ADFF2F}Handcuffs {FFFFFF}on you."pNameplayerid);
                
format(stringsizeof(string), "You have placed {0080FF}%s(%d) {FFFFFF}in Handcuffs for an Arrest. Use {0080FF}/search (id) {FFFFFF}to search Him for illegal Drugs."tNametargetid);
                
SendClientMessage(targetid, -1"{00FFFB}[BEING ARRESTED]: {FFFFFF}Use {0080FF}/breakcuffs (/bc) {FFFFFF}to attempt to evade the Arrest.");
                
format(stringsizeof(string), "{ffffff}You have Arrested {FFD700}%s(%d){FFFFFF}. You have received {33FF33}$%d {FFFFFF}for this Arrest."tNametargetidArrestReward);
                
SendClientMessage(playeridredstring);
                
format(stringsizeof(string), "{00FFFB}[ARRESTED]: {FFD700}%s(%d) {FFFFFF}has been {33CCFF}Arrested {FFFFFF}by {00FFFB}S.W.A.T {0080FF}%s(%d)"tNametargetidpNameplayerid);
                
SendClientMessageToAll(yellowstring);
                
format(stringsizeof(string), "~w~You have ~G~Arrested ~Y~%s(%d)~n~n~You have received ~n~n~~y~$%d ~w~for this Arrest."tNametargetidArrestReward);
                
GameTextForPlayer(playeridstring70005);
                
GivePlayerMoney(playeridArrestReward);
                
SetPlayerScore(playeridGetPlayerScore(playerid)+1);
                
SetPlayerScore(playeridGetPlayerScore(targetid)-1);
                
pJailTimerID[targetid] = SetTimerEx("pJailTimer"3000true"i"targetid);
                
pJailCount[targetid] = 20 random(40);
                new 
Random random(sizeof(RandomJailSpawns));
                
SetPlayerPos(targetidRandomJailSpawns[Random][0], RandomJailSpawns[Random][1], RandomJailSpawns[Random][2]);
                
SetPlayerFacingAngle(targetidRandomJailSpawns[Random][2]);
                
ResetPlayerWeapons(targetid);
                
SetPlayerInterior(targetid10);
                
SetPlayerWantedLevel(targetid,0);
                
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
            }
            else if(
GetTeam{playerid} == CLASS_CIA)
            if(
GetPlayerWantedLevel(targetid) >= 4)
            {
                new 
ArrestReward random(30000) + 2500;
                  if(
ArrestReward GetPlayerCash(playerid))
                
TimerArrest[targetid] = SetTimerEx("BeginArrestedTimer"10000false,"i"targetid); // 10 Secdons timer
                   
BeginArrested[targetid] = 1;
                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED);
                
SetPlayerAttachedObject(targetid8194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
                
format(stringsizeof(string), "{0080FF}[BEING ARRESTED]: {00FFFB}Law Enforcement C.I.A {FFFFFF}%s(%d) has put {ADFF2F}Handcuffs {FFFFFF}on you."pNameplayerid);
                
format(stringsizeof(string), "You have placed {0080FF}%s(%d) {FFFFFF}in Handcuffs for an Arrest. Use {0080FF}/search (id) {FFFFFF}to search Him for illegal Drugs."tNametargetid);
                
SendClientMessage(targetid, -1"{0080FF}[BEING ARRESTED]: {FFFFFF}Use {0080FF}/breakcuffs (/bc) {FFFFFF}to attempt to evade the Arrest.");
                
format(stringsizeof(string), "{ffffff}You have Arrested {FFD700}%s(%d){FFFFFF}. You have received {33FF33}$%d {FFFFFF}for this Arrest."tNametargetidArrestReward);
                
SendClientMessage(playeridredstring);
                
format(stringsizeof(string), "{0080FF}[ARRESTED]: {FFD700}%s(%d) {FFFFFF}has been {33CCFF}Arrested {FFFFFF}by {FFFFFF}C.I.A {0080FF}%s(%d)"tNametargetidpNameplayerid);
                
SendClientMessageToAll(yellowstring);
                
format(stringsizeof(string), "~w~You have ~G~Arrested ~Y~%s(%d)~n~n~You have received ~n~n~~y~$%d ~w~for this Arrest."tNametargetidArrestReward);
                
GameTextForPlayer(playeridstring70005);
                
GivePlayerMoney(playeridArrestReward);
                
SetPlayerScore(playeridGetPlayerScore(playerid)+1);
                
SetPlayerScore(playeridGetPlayerScore(targetid)-1);
                
pJailTimerID[targetid] = SetTimerEx("pJailTimer"3000true"i"targetid);
                
pJailCount[targetid] = 20 random(40);
                new 
Random random(sizeof(RandomJailSpawns));
                
SetPlayerPos(targetidRandomJailSpawns[Random][0], RandomJailSpawns[Random][1], RandomJailSpawns[Random][2]);
                
SetPlayerFacingAngle(targetidRandomJailSpawns[Random][1]);
                
ResetPlayerWeapons(targetid);
                
SetPlayerInterior(targetid10);
                
SetPlayerWantedLevel(targetid,0);
                
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
            }
            else if(
GetTeam{playerid} == CLASS_FBI)
            if(
GetPlayerWantedLevel(targetid) >= 4)
            {
                new 
ArrestReward random(25000) + 2500;
                  if(
ArrestReward GetPlayerCash(playerid))
                
TimerArrest[targetid] = SetTimerEx("BeginArrestedTimer"10000false,"i"targetid); // 10 Secdons timer
                   
BeginArrested[targetid] = 1;
                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED);
                
SetPlayerAttachedObject(targetid8194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
                
format(stringsizeof(string), "{0080FF}[BEING ARRESTED]: {0080FF}Law Enforcement F.B.I {FFFFFF}%s(%d) has put {ADFF2F}Handcuffs {FFFFFF}on you."pNameplayerid);
                
format(stringsizeof(string), "You have placed {0080FF}%s(%d) {FFFFFF}in Handcuffs for an Arrest. Use {0080FF}/search (id) {FFFFFF}to search Him for illegal Drugs."tNametargetid);
                
SendClientMessage(targetid, -1"{0080FF}[BEING ARRESTED]: {FFFFFF}Use {0080FF}/breakcuffs (/bc) {FFFFFF}to attempt to evade the Arrest.");
                
format(stringsizeof(string), "{ffffff}You have Arrested {FFD700}%s(%d){FFFFFF}. You have received {33FF33}$%d {FFFFFF}for this Arrest."tNametargetidArrestReward);
                
SendClientMessage(playeridredstring);
                
format(stringsizeof(string), "{0080FF}[ARRESTED]: {FFD700}%s(%d) {FFFFFF}has been {33CCFF}Arrested {FFFFFF}by {0080FF}F.B.I {0080FF}%s(%d)"tNametargetidpNameplayerid);
                
SendClientMessageToAll(yellowstring);
                
format(stringsizeof(string), "~w~You have ~G~Arrested ~Y~%s(%d)~n~n~You have received ~n~n~~y~$%d ~w~for this Arrest."tNametargetidArrestReward);
                
GameTextForPlayer(playeridstring70005);
                
GivePlayerMoney(playeridArrestReward);
                
SetPlayerScore(playeridGetPlayerScore(playerid)+1);
                
SetPlayerScore(playeridGetPlayerScore(targetid)-1);
                
pJailTimerID[targetid] = SetTimerEx("pJailTimer"3000true"i"targetid);
                
pJailCount[targetid] = 20 random(40);
                new 
Random random(sizeof(RandomJailSpawns));
                
SetPlayerPos(targetidRandomJailSpawns[Random][0], RandomJailSpawns[Random][1], RandomJailSpawns[Random][2]);
                
SetPlayerFacingAngle(targetidRandomJailSpawns[Random][1]);
                
ResetPlayerWeapons(targetid);
                
SetPlayerInterior(targetid10);
                
SetPlayerWantedLevel(targetid,0);
                
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
            }
              }
         return 
1;

Reply
#8

Guys the problem is When some cops tried to arrest someone and he Wanted Level the police cannot arrest him Why?? AND They are not giving me a message when i tried to arrest someone +4 Wanted Level. any help? The Full code UP!
Reply
#9

Just looking at that code is difficult.

Many repetitions, and so much code that could be put into one section.


As Vince said though, you're asking sscanf for 2 values, and only using one. That's just at the top in your code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)