Jump to content
Sign in to follow this  
Eargasm

Target Vehicle Disable

Recommended Posts

I am trying to create a script for the Blufor faction only. This script would be either client side or server side.

Need to be able to target a vehicle in front of the player while being the driver of his vehicle then be able to disable the target vehicles engine or tires using a scroll wheel option so it will roll to a stop and render the vehicle useless until it can be repaired. Draining the fuel to empty will also work. The Blufor vehicle would have to be within 2-3m of the target vehicle to be able to engage the option in the scroll menu.

This is for a RPG mod.

Thanks!

Edited by Eargasm

Share this post


Link to post
Share on other sites

Init.sqf

if (isServer || isDedicated) then {
vehicle1 addAction ["<t color='#FF0000'>Disable tyres</t>","nul = [] execVM ""disabletyres.sqf""","[player, vehicle2]",2,false,true,"","player distance vehicle2 < 5 && driver vehicle1 == player"];
};

Disabletyres.sqf

_unit = _this select 0;
_caller = _this select 1;
_ID = _this select 2;
_plyr = (_this select 3) select 0;
_tgtveh = (_this select 3) select 1;

_unit removeAction _ID; // Remove action to disable tyres.

_tgtveh setHit ["kola",1]; // Destroy tyres.

if (isServer || isDedicated) then {
_unit addAction ["<t color='#FF0000'>Disable tyres</t>","nul = []  execVM ""disabletyres.sqf""","[player,  vehicle2]",2,false,true,"","player distance vehicle2 < 5 &&  driver vehicle1 == player"];
};

Haven't tested it but should work. And yeah the last addaction gets cut for some reason. It's the same as the first one. Vehicle1 and Vehicle2 are variable names that need to be changed. Vehicle2 is intended to be the target vehicle and Vehicle1 is the player vehicle.

Edited by tryteyker

Share this post


Link to post
Share on other sites

So is the "Vehicle1, Vehicle2" supposed to be class names of the vehicles? And is it possible to white list this script so specific players can use it?

Share this post


Link to post
Share on other sites

No, just the names of the units. You could add player UIDs to a global variable and then add a secondary check to see if the player UID is in the global UID array. Like so:

if ((isServer || isDedicated) && ((getplayerUID) in globalUIDArrayName)) then {
// addAction
};

You'll have to manually add the GlobalUID Array.

Share this post


Link to post
Share on other sites

Scripts aren't working and can't seem to get it working with Vehicle1-2 replaced with unit1 and unit2.

---------- Post added at 23:19 ---------- Previous post was at 22:57 ----------

So I figured it out. Ok so now is it possible to set "vehicle1" to all vehicles used by Blufor and "vehicle2" to all vehicles under civilians?

EDIT:

I get this error when I select "Disable Tires" in the scroll menu:

Script null = [] execVM "disabletires.sqf" not found

===============================================

This is what I have for init.sqf

if (isServer || isDedicated) then {

vehicle1 addAction ["<t color='#FF0000'>Disable tires</t>","null = [] execVM ""disabletires.sqf""","[player, vehicle2]",2,false,true,"","player distance vehicle2 < 5 && driver vehicle1 == player"];

};

===============================================

This is what I have for disabletires.sqf

_unit = _this select 0;

_caller = _this select 1;

_ID = _this select 2;

_plyr = (_this select 3) select 0;

_tgtveh = (_this select 3) select 1;

_unit removeAction _ID; // Remove action to disable tires.

_tgtveh setHit ["kola",1]; // Destroy tires.

if (isServer || isDedicated) then {

_unit addAction ["<t color='#FF0000'>Disable tires</t>","null = [] execVM ""disabletires.sqf""","[player, vehicle2]",2,false,true,"","player distance vehicle2 < 5 && driver vehicle1 == player"];

};

Edited by Eargasm

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×