Jump to content
Repentz

[Tutorial] Cops can enter vehicles without unlocking

Recommended Posts

Taken from the old AltislifeRPG forums archive.

 

Step 1:

Create a file called "fn_copEnter.sqf" (this will be saved in Core>Cop)

/*	File: fn_copEnter.sqf	Author: I dunno, I do not care!		Description:	Allows Cops to enter locked Vehicles*/
if (playerSide != west) exitWith {};
private["_position", "_veh"];
_position = _this select 3;
switch (_position) do {
case "driver":
  {
    cursorTarget lock false;player action["getInDriver", cursorTarget];cursorTarget lock true;
  };
case "passenger":
  {
    cursorTarget lock false;player action["getInCargo", cursorTarget];cursorTarget lock true;
  };
case "gunner":
  {
    cursorTarget lock false;player action["getIngunner", cursorTarget];cursorTarget lock true;
  };
case "exit":
  {
    _veh = vehicle player;_veh lock false;player action["getOut", _veh];_veh lock true;
  };
};

Step 2:

Open up the functions.h file and under "class cop" at the bottom add:

class copEnter {};

Step 3:

Go directly to your "core" folder and edit fn_setupActions.sqf (in the case west):

//CopEnter - Driver Seat		life_actions = life_actions + [player addAction[localize "STR_pAct_DriverSeat",life_fnc_copEnter,"driver",200,false,false,"",'!isNull cursorTarget && ((cursorTarget isKindOf "Car")||(cursorTarget isKindOf "Air")||(cursorTarget isKindOf "Ship")) && (locked cursorTarget) != 0 && cursorTarget distance player < 3.5']];		

//CopEnter - Passenger Seat		life_actions = life_actions + [player addAction[localize "STR_pAct_PassengerSeat",life_fnc_copEnter,"passenger",100,false,false,"",'!isNull cursorTarget && ((cursorTarget isKindOf "Car")||(cursorTarget isKindOf "Air")||(cursorTarget isKindOf "Ship")) && (locked cursorTarget) != 0 && cursorTarget distance player < 3.5']]; 		

//CopEnter - Gunner Seat		life_actions = life_actions + [player addAction[localize "STR_pAct_GunnerSeat",life_fnc_copEnter,"gunner",100,false,false,"",'!isNull cursorTarget && ((cursorTarget isKindOf "Car")||(cursorTarget isKindOf "Air")||(cursorTarget isKindOf "Ship")) && (locked cursorTarget) != 0 && cursorTarget distance player < 3.5']]; 		

//CopEnter - Exit		life_actions = life_actions + [player addAction[localize "STR_pAct_GoOut",life_fnc_copEnter,"exit",100,false,false,"",'(vehicle player != player) && (locked(vehicle player)==2)']];

Step 4:

Add this to your "Stringtable.xml".

<Key ID="STR_pAct_DriverSeat">
            <Original>Driver's seat</Original>
            <English>Driver's seat</English>
            <German>Auf den Fahrersitz</German>
            <French>Place conducteur</French>
        </Key>
         <Key ID="STR_pAct_PassengerSeat">
            <Original>Passenger seat</Original>
            <English>Passenger seat</English>
            <German>Auf den Passagiersitz</German>
            <French>Place passager</French>
        </Key>
        <Key ID="STR_pAct_GunnerSeat">
            <Original>Gunner seat</Original>
            <English>Gunner seat</English>
            <German>gunner seat</German>
            <French>Place tireur</French>
        </Key>
        <Key ID="STR_pAct_GoOut">
            <Original>Get out of vehicle</Original>
            <English>Get out of vehicle</English>
            <German>Aus dem Fahrzeug austeigen</German>
            <French>Sortir du véhicule</French>
        </Key> 

Now you can enter to your cops vehicle without the key and when they are closed!

Edited by Repentz

Share this post


Link to post
Share on other sites

Thats really smart, hwoever it might destroy roleplay, nonetheless, police could move vehicles from crime scenes, how would i make it so they can only enter other police cars if their locked and not civilian, medics etc cars?

 

Share this post


Link to post
Share on other sites

Here is the Stringrable.xml is the right format to copy and paste:

 

        <Key ID="STR_pAct_DriverSeat">
            <Original>Driver's seat</Original>
            <English>Driver's seat</English>
            <German>Auf den Fahrersitz</German>
            <French>Place conducteur</French>
        </Key>
         <Key ID="STR_pAct_PassengerSeat">
            <Original>Passenger seat</Original>
            <English>Passenger seat</English>
            <German>Auf den Passagiersitz</German>
            <French>Place passager</French>
        </Key>
        <Key ID="STR_pAct_GunnerSeat">
            <Original>Gunner seat</Original>
            <English>Gunner seat</English>
            <German>gunner seat</German>
            <French>Place tireur</French>
        </Key>
        <Key ID="STR_pAct_GoOut">
            <Original>Get out of vehicle</Original>
            <English>Get out of vehicle</English>
            <German>Aus dem Fahrzeug austeigen</German>
            <French>Sortir du véhicule</French>
        </Key>

Share this post


Link to post
Share on other sites
4 hours ago, Rez said:

Here is the Stringrable.xml is the right format to copy and paste:

 

        <Key ID="STR_pAct_DriverSeat">
            <Original>Driver's seat</Original>
            <English>Driver's seat</English>
            <German>Auf den Fahrersitz</German>
            <French>Place conducteur</French>
        </Key>
         <Key ID="STR_pAct_PassengerSeat">
            <Original>Passenger seat</Original>
            <English>Passenger seat</English>
            <German>Auf den Passagiersitz</German>
            <French>Place passager</French>
        </Key>
        <Key ID="STR_pAct_GunnerSeat">
            <Original>Gunner seat</Original>
            <English>Gunner seat</English>
            <German>gunner seat</German>
            <French>Place tireur</French>
        </Key>
        <Key ID="STR_pAct_GoOut">
            <Original>Get out of vehicle</Original>
            <English>Get out of vehicle</English>
            <German>Aus dem Fahrzeug austeigen</German>
            <French>Sortir du véhicule</French>
        </Key>

Ah yeah mb ill fix it.

Share this post


Link to post
Share on other sites
15 hours ago, Rez said:

Btw bro, I don't think this worked for me 

 

Me either. The civ that owns the car can see the "Driver's Seat" option when it's locked but cops can't

Share this post


Link to post
Share on other sites
1 minute ago, Malson said:

Me either. The civ that owns the car can see the "Driver's Seat" option when it's locked but cops can't

I got it bro: its probably your fn_setUpActions file, copy and paste this :

 

        //CopEnter - Driver Seat
        life_actions = life_actions + [player addAction[localize "STR_pAct_DriverSeat",life_fnc_copEnter,"driver",200,false,false,"",'!isNull cursorTarget && ((cursorTarget isKindOf "Car")||(cursorTarget isKindOf "Air")||(cursorTarget isKindOf "Ship")) && (locked cursorTarget) != 0 && cursorTarget distance player < 3.5']];
        //CopEnter - Passenger Seat
        life_actions = life_actions + [player addAction[localize "STR_pAct_PassengerSeat",life_fnc_copEnter,"passenger",100,false,false,"",'!isNull cursorTarget && ((cursorTarget isKindOf "Car")||(cursorTarget isKindOf "Air")||(cursorTarget isKindOf "Ship")) && (locked cursorTarget) != 0 && cursorTarget distance player < 3.5']];
        //CopEnter - Gunner Seat
        life_actions = life_actions + [player addAction[localize "STR_pAct_GunnerSeat",life_fnc_copEnter,"gunner",100,false,false,"",'!isNull cursorTarget && ((cursorTarget isKindOf "Car")||(cursorTarget isKindOf "Air")||(cursorTarget isKindOf "Ship")) && (locked cursorTarget) != 0 && cursorTarget distance player < 3.5']];
         //CopEnter - Exit
         life_actions = life_actions + [player addAction[localize "STR_pAct_GoOut",life_fnc_copEnter,"exit",100,false,false,"",'(vehicle player != player) && (locked(vehicle player)==2)']];
    };

 

just like that under case west: so mine looks like:

  

 

 case west:
    {
        //Call backup
        life_actions pushBack (player addAction["<t color='#FF0000'>Call for Backup</t>",life_fnc_callbackup,"",0,FALSE,FALSE,""]);
        //CopEnter - Driver Seat
        life_actions = life_actions + [player addAction[localize "STR_pAct_DriverSeat",life_fnc_copEnter,"driver",200,false,false,"",'!isNull cursorTarget && ((cursorTarget isKindOf "Car")||(cursorTarget isKindOf "Air")||(cursorTarget isKindOf "Ship")) && (locked cursorTarget) != 0 && cursorTarget distance player < 3.5']];
        //CopEnter - Passenger Seat
        life_actions = life_actions + [player addAction[localize "STR_pAct_PassengerSeat",life_fnc_copEnter,"passenger",100,false,false,"",'!isNull cursorTarget && ((cursorTarget isKindOf "Car")||(cursorTarget isKindOf "Air")||(cursorTarget isKindOf "Ship")) && (locked cursorTarget) != 0 && cursorTarget distance player < 3.5']];
        //CopEnter - Gunner Seat
        life_actions = life_actions + [player addAction[localize "STR_pAct_GunnerSeat",life_fnc_copEnter,"gunner",100,false,false,"",'!isNull cursorTarget && ((cursorTarget isKindOf "Car")||(cursorTarget isKindOf "Air")||(cursorTarget isKindOf "Ship")) && (locked cursorTarget) != 0 && cursorTarget distance player < 3.5']];
         //CopEnter - Exit
         life_actions = life_actions + [player addAction[localize "STR_pAct_GoOut",life_fnc_copEnter,"exit",100,false,false,"",'(vehicle player != player) && (locked(vehicle player)==2)']];
    };
 

 

 

 

 

 

 

Share this post


Link to post
Share on other sites
7 hours ago, caliber8600 said:

Can This be Setup up for EMS to enter their vehicles without unlocking them?

put it under independent side in the setupactions

and in copEnter change this

if (playerSide != west) exitWith {};

Share this post


Link to post
Share on other sites

Hello guys i have been trying everything now and i can't still get it to work and i don't know where in the  Stringrable.xml i should put this  And i am using Alits Life RPG 4.5

 

And i have this in my  fn_setupActions.sq

/*
    File: fn_setupActions.sqf
    Author:

    Description:
    Master addAction file handler for all client-based actions.
*/
switch (playerSide) do {
    case civilian: {
        //Drop fishing net
        life_actions = [player addAction[localize "STR_pAct_DropFishingNet",life_fnc_dropFishingNet,"",0,false,false,"",'
        (surfaceisWater (getPos vehicle player)) && (vehicle player isKindOf "Ship") && life_carryWeight < life_maxWeight && speed (vehicle player) < 2 && speed (vehicle player) > -1 && !life_net_dropped ']];
        //Rob person
        life_actions = life_actions + [player addAction[localize "STR_pAct_RobPerson",life_fnc_robAction,"",0,false,false,"",'
        !isNull cursorObject && player distance cursorObject < 3.5 && isPlayer cursorObject && animationState cursorObject == "Incapacitated" && !(cursorObject getVariable ["robbed",false]) ']];
        
        }
 case west:
    {
        //CopEnter - Driver Seat
        life_actions = life_actions + [player addAction[localize "STR_pAct_DriverSeat",life_fnc_copEnter,"driver",200,false,false,"",'!isNull cursorTarget && ((cursorTarget isKindOf "Car")||(cursorTarget isKindOf "Air")||(cursorTarget isKindOf "Ship")) && (locked cursorTarget) != 0 && cursorTarget distance player < 3.5']];
        //CopEnter - Passenger Seat
        life_actions = life_actions + [player addAction[localize "STR_pAct_PassengerSeat",life_fnc_copEnter,"passenger",100,false,false,"",'!isNull cursorTarget && ((cursorTarget isKindOf "Car")||(cursorTarget isKindOf "Air")||(cursorTarget isKindOf "Ship")) && (locked cursorTarget) != 0 && cursorTarget distance player < 3.5']];
        //CopEnter - Gunner Seat
        life_actions = life_actions + [player addAction[localize "STR_pAct_GunnerSeat",life_fnc_copEnter,"gunner",100,false,false,"",'!isNull cursorTarget && ((cursorTarget isKindOf "Car")||(cursorTarget isKindOf "Air")||(cursorTarget isKindOf "Ship")) && (locked cursorTarget) != 0 && cursorTarget distance player < 3.5']];
        //CopEnter - Exit
        life_actions = life_actions + [player addAction[localize "STR_pAct_GoOut",life_fnc_copEnter,"exit",100,false,false,"",'(vehicle player != player) && (locked(vehicle player)==2)']];
    };

 

<Key ID="STR_pAct_DriverSeat">
            <Original>Driver's seat</Original>
            <English>Driver's seat</English>
            <German>Auf den Fahrersitz</German>
            <French>Place conducteur</French>
        </Key>
         <Key ID="STR_pAct_PassengerSeat">
            <Original>Passenger seat</Original>
            <English>Passenger seat</English>
            <German>Auf den Passagiersitz</German>
            <French>Place passager</French>
        </Key>
        <Key ID="STR_pAct_GunnerSeat">
            <Original>Gunner seat</Original>
            <English>Gunner seat</English>
            <German>gunner seat</German>
            <French>Place tireur</French>
        </Key>
        <Key ID="STR_pAct_GoOut">
            <Original>Get out of vehicle</Original>
            <English>Get out of vehicle</English>
            <German>Aus dem Fahrzeug austeigen</German>
            <French>Sortir du véhicule</French>
        </Key>

 

Edited by Kaiman™ * Publiclir.se

Share this post


Link to post
Share on other sites
On 6/16/2019 at 12:43 PM, john_65wadwada654 said:

not working on 5.0 someone update it for 5.0  

What about it isn't working? There's nothing to this. It simply unlocks the car, puts you in it and relocks it.

On 6/16/2019 at 3:22 PM, Fawks said:

You can update it. As I've said before, this is not a place to be spoon fed scripts.

It should work fine with 5.0 and multiple people use it on 5.0 AFAIK. English needs to be removed from the Stringtable though.

Share this post


Link to post
Share on other sites
On 6/18/2019 at 6:18 PM, imthatguyhere said:

What about it isn't working? There's nothing to this. It simply unlocks the car, puts you in it and relocks it.

It should work fine with 5.0 and multiple people use it on 5.0 AFAIK. English needs to be removed from the Stringtable though.

when i install it dont see any option and there is no error in logs

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...