MMB ARREST
#1

Hi I want to make when cops find a wanted player +4stars he can arrest him with MMB Button I'm trying to do that but I found many bugs... Example Like I didn't check player position.. & othersWhen some cops press MMB When they want arrest someone the message [WARRING]: ... will be spamming but the enemy player did not shot him anymore but It's spam when I press MMB It's bug... how to fix this.

PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(!
PoliceTeam(GetPlayerSkin(playerid)) && !SWAT(GetPlayerSkin(playerid)) && !Army(GetPlayerSkin(playerid)) && !FBII(GetPlayerSkin(playerid)) && !CIA(GetPlayerSkin(playerid)))
     {
           if(
PoliceTeam(GetPlayerSkin(playerid)) && !SWAT(GetPlayerSkin(playerid)) && !Army(GetPlayerSkin(playerid)) && !FBII(GetPlayerSkin(playerid)) && !CIA(GetPlayerSkin(playerid) && PRESSEDKEY_LOOK_BEHIND )))
        {
                new 
pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME],targetid,string[128], rangepass 0;
                new 
Float:targetidpos[3];
                if(
GetPlayerInterior(targetid) > 0) return SendClientMessage(playeridred"{FF0000}Error: You can't arrest players inside an interior.");
                if(
GetPVarInt(playerid,"ArTime")>GetTickCount())return SendClientMessage(playerid,0xFF0000FF,"{FF0000}Error: Please wait 5 seconds before arresting a suspect again.");
                if(
PlayerInfo[targetid][pJailed] == 1) return SendClientMessage(playeridred"{FF0000}Error: This player is already in jail, you can't arrest them.");
                if(
IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid,red,"{FF0000}Error: You can't arrest players if they're in a vehicle.");
                if(
GetPlayerWantedLevel(targetid) <= 3) return SendClientMessage(playeridred"{FF0000}Error: You can't arrest players with a wanted level lower than 4. Use /tk to issue a ticket, or press 2.");
                if(
GetPlayerWantedLevel(targetid) == 0) return SendClientMessage(playeridred"{FF0000}Error: This player is not wanted, you can't arrest them");
                if(
playerid == targetid) return SendClientMessage(playerid,red"{ff0000}Error: {ffffff}You can't arrest yourself.");
                if(
PlayerHasTakenDamage[playerid] == targetid) return SendClientMessage(playeridRED"[WARRING]: YOU CANNOT ARREST THIS PLAYER BECAUSE HE SHOOTED YOU...");
                
GetPlayerPos(playeridtargetidpos[0], targetidpos[1], targetidpos[2]);
                if (!
IsPlayerInRangeOfPoint(playerid5.0targetidpos[0], targetidpos[1], targetidpos[2])) return SendClientMessage(playerid, -1"Error: Nobody close enough to arrest.");
                
GetPlayerName(playeridpNamesizeof(pName));
                
GetPlayerName(targetidtNamesizeof(tName));
                if(
IsPlayerConnected(targetid))
                {
                    if(
SWAT(GetPlayerSkin(playerid)))
                    {
                        if(
GetPlayerWantedLevel(targetid) >= && GetPlayerWantedLevel(targetid) <= 30)
                        {
                            
rangepass++;
                            
SecondsToJail[targetid] = SetTimerEx("JailPlayer",5000,0,"i",targetid);
                            
TryingArrested[playerid] = 1;
                            
ArrestingPlayer[targetid] = playerid;
                            
format(stringsizeof(string), "{0080FF}[BEING ARRESTED]: {FFFFFF}S.W.A.T AGENT %s(%d) has put {ADFF2F}handcuffs {FFFFFF}on you."pNameplayerid);
                            
SendClientMessage(targetidredstring);
                            
SetPlayerAttachedObject(targetid9194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
                            
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED);
                            
format(stringsizeof(string), "~W~AN ~B~S.W.A.T AGENT %s(%d) ~W~HAS CUFFED YOU!!~n~~b~TYPE [/BC] TO ESCAPE FROM THE ~Y~CUFFS"pNameplayerid);
                            
GameTextForPlayer(targetidstring40005);
                            
format(stringsizeof(string), "{33B5FF}[BEGIN ARREST!!!] S.W.A.T AGENT %s(%d) is trying to arrest you!! {33B5FF}Use /BC for escape from this arrest!!"pNameplayerid);
                            
SendClientMessage(targetidredstring);
                            
format(stringsizeof(string), "{ffffff}You have placed {0080FF}%s(%d) {FFFFFF}in handcuffs for an arrest. Use {0080FF}/search (id) {FFFFFF}to search them for illegal Drugs."tNametargetid);
                            
SendClientMessage(playeridredstring);
                            
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
                            return 
1;
                        }
                    }
                    if(
Army(GetPlayerSkin(playerid)))
                    {
                        if(
GetPlayerWantedLevel(targetid) >= && GetPlayerWantedLevel(targetid) <= 30)
                        {
                            
SecondsToJail[targetid] = SetTimerEx("JailPlayer",5000,0,"i",targetid);
                            
TryingArrested[playerid] = 1;
                            
ArrestingPlayer[targetid] = playerid;
                            
format(stringsizeof(string), "{0080FF}[BEING ARRESTED]: {FFFFFF}A.R.M.Y AGENT %s(%d) has put {ADFF2F}handcuffs {FFFFFF}on you."pNameplayerid);
                            
SendClientMessage(targetidredstring);
                            
SetPlayerAttachedObject(targetid9194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
                            
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED);
                            
format(stringsizeof(string), "~W~AN ~P~ARMY AGENT %s(%d) ~W~HAS CUFFED YOU!!~n~~b~TYPE [/BC] TO ESCAPE FROM THE ~Y~CUFFS"pNameplayerid);
                            
GameTextForPlayer(targetidstring40005);
                            
format(stringsizeof(string), "{33B5FF}[BEGIN ARREST!!!] A.R.M.Y AGENT %s(%d) is trying to arrest you!! {33B5FF}Use /BC for escape from this arrest!!"pNameplayerid);
                            
SendClientMessage(targetidredstring);
                            
format(stringsizeof(string), "{ffffff}You have placed {0080FF}%s(%d) {FFFFFF}in handcuffs for an arrest. Use {0080FF}/search (id) {FFFFFF}to search them for illegal Drugs."tNametargetid);
                            
SendClientMessage(playeridredstring);
                            
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
                            return 
1;
                        }
                     }
                    if(
FBII(GetPlayerSkin(playerid)))
                    {
                            if(
GetPlayerWantedLevel(targetid) >= && GetPlayerWantedLevel(targetid) <= 30)
                            {
                                
SecondsToJail[targetid] = SetTimerEx("JailPlayer",5000,0,"i",targetid);
                                
TryingArrested[playerid] = 1;
                                
ArrestingPlayer[targetid] = playerid;
                                
format(stringsizeof(string), "{0080FF}[BEING ARRESTED]: {FFFFFF}F.B.I AGENT %s(%d) has put {ADFF2F}handcuffs {FFFFFF}on you."pNameplayerid);
                                
SendClientMessage(targetidredstring);
                                
SetPlayerAttachedObject(targetid9194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
                                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED);
                                
format(stringsizeof(string), "~W~AN ~B~F.B.I AGENT %s(%d) ~W~HAS CUFFED YOU!!~n~~b~TYPE [/BC] TO ESCAPE FROM THE ~Y~CUFFS"pNameplayerid);
                                
GameTextForPlayer(targetidstring40005);
                                
format(stringsizeof(string), "{33B5FF}[BEGIN ARREST!!!] F.B.I AGENT %s(%d) is trying to arrest you!! {33B5FF}Use /BC for escape from this arrest!!"pNameplayerid);
                                
SendClientMessage(targetidredstring);
                                
format(stringsizeof(string), "{ffffff}You have placed {0080FF}%s(%d) {FFFFFF}in handcuffs for an arrest. Use {0080FF}/search (id) {FFFFFF}to search them for illegal Drugs."tNametargetid);
                                
SendClientMessage(playeridredstring);
                                
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
                                return 
1;
                            }
                    }
                    if(
CIA(GetPlayerSkin(playerid)))
                    {
                            if(
GetPlayerWantedLevel(targetid) >= && GetPlayerWantedLevel(targetid) <= 30)
                            {
                                   
SecondsToJail[targetid] = SetTimerEx("JailPlayer",5000,0,"i",targetid);
                                
TryingArrested[playerid] = 1;
                                
ArrestingPlayer[targetid] = playerid;
                                
format(stringsizeof(string), "{0080FF}[BEING ARRESTED]: {FFFFFF}C.I.A AGENT %s(%d) has put {ADFF2F}handcuffs {FFFFFF}on you."pNameplayerid);
                                
SendClientMessage(targetidredstring);
                                
SetPlayerAttachedObject(targetid9194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
                                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED);
                                
format(stringsizeof(string), "~W~AN ~B~C.I.A AGENT %s(%d) ~W~HAS CUFFED YOU!!~n~~b~TYPE [/BC] TO ESCAPE FROM THE ~Y~CUFFS"pNameplayerid);
                                
GameTextForPlayer(targetidstring40005);
                                
format(stringsizeof(string), "{33B5FF}[BEGIN ARREST!!!] C.I.A AGENT %s(%d) is trying to arrest you!! {33B5FF}Use /BC for escape from this arrest!!"pNameplayerid);
                                
SendClientMessage(targetidredstring);
                                
format(stringsizeof(string), "{ffffff}You have placed {0080FF}%s(%d) {FFFFFF}in handcuffs for an arrest. Use {0080FF}/search (id) {FFFFFF}to search them for illegal Drugs."tNametargetid);
                                
SendClientMessage(playeridredstring);
                                
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
                                return 
1;
                               }
                    }
                    if(
PoliceTeam(GetPlayerSkin(playerid)))
                    {
                            if(
GetPlayerWantedLevel(targetid) >= && GetPlayerWantedLevel(targetid) <= 30)
                            {
                                
SecondsToJail[targetid] = SetTimerEx("JailPlayer",5000,0,"i",targetid);
                                
TryingArrested[playerid] = 1;
                                
ArrestingPlayer[targetid] = playerid;
                                
format(stringsizeof(string), "{0080FF}[BEING ARRESTED]: {FFFFFF}OFFICERAGENT %s(%d) has put {ADFF2F}handcuffs {FFFFFF}on you."pNameplayerid);
                                
SendClientMessage(targetidredstring);
                                
SetPlayerAttachedObject(targetid9194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
                                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED);
                                
format(stringsizeof(string), "~W~AN ~B~OFFICER AGENT %s(%d) ~W~HAS CUFFED YOU!!~n~~b~TYPE [/BC] TO ESCAPE FROM THE ~Y~CUFFS"pNameplayerid);
                                
GameTextForPlayer(targetidstring40005);
                                
format(stringsizeof(string), "{33B5FF}[BEGIN ARREST!!!] OFFICER AGENT %s(%d) is trying to arrest you!! {33B5FF}Use /BC for escape from this arrest!!"pNameplayerid);
                                
SendClientMessage(targetidredstring);
                                
format(stringsizeof(string), "{ffffff}You have placed {0080FF}%s(%d) {FFFFFF}in handcuffs for an arrest. Use {0080FF}/search (id) {FFFFFF}to search them for illegal Drugs."tNametargetid);
                                
SendClientMessage(playeridredstring);
                                
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
                                return 
1;
                            }
                          }
                    }
                }
            }
        return 
1;

Reply


Messages In This Thread
MMB ARREST - by Thanks - 23.07.2018, 15:26
Re: MMB ARREST - by JasonRiggs - 23.07.2018, 15:34
Re: MMB ARREST - by Calisthenics - 23.07.2018, 15:46
Re: MMB ARREST - by JasonRiggs - 23.07.2018, 16:49
Re: MMB ARREST - by Thanks - 24.07.2018, 09:09
Re: MMB ARREST - by JasonRiggs - 24.07.2018, 10:44
Re: MMB ARREST - by Thanks - 25.07.2018, 07:34
Re: MMB ARREST - by coool - 25.07.2018, 09:10
Re: MMB ARREST - by GTLS - 26.07.2018, 14:54

Forum Jump:


Users browsing this thread: 3 Guest(s)