FallingSheep
OpenDayZ Lord!
ok so i cant get this working so i thought id share it here (i take no credit for this, the code has come from 4 different servers that i have joined)
in fn_Selfactions.sqf added to the bottom
nitroinstall.sqf
nitro.sqf
so basically i dont work
any help to get it working so we can stop people hording scripts as its a free mod and any content made for it and used publicly shoud be free to use
in fn_Selfactions.sqf added to the bottom
Code:
//Nitro action
_hasNOSinstalled = _vehicle getVariable["nitroinstalled",0];
if (_inVehicle and _vehicle isKindOf "Car" and speed _vehicle >= 1) then {
if (_inVehicle and _hasNOSinstalled == 1) then {
if (isnil("Has_NOS")) then {Has_NOS = false;};
if (s_player_nitrobooston <0) then {
if (Has_NOS) then {
s_player_nitrobooston = _vehicle addAction [("<t color=""#39C1F3"">" + ("Nitro Off") + "</t>"),"scripts\nitro.sqf", [_vehicle], 999, false,true,"","driver _target == _this"];
} else {
s_player_nitrobooston = _vehicle addAction [("<t color=""#39C1F3"">" + ("Nitro On") + "</t>"),"scripts\nitro.sqf", [_vehicle], 999, false,true,"","driver _target == _this"];
};
};
} else {
_vehicle removeAction s_player_nitrobooston;
s_player_nitrobooston = -1;
};
} else {
_vehicle removeAction s_player_nitrobooston;
s_player_nitrobooston = -1;
if (_hasNOSinstalled == 1) then {
_vehicle setVariable ["nitroinstalled", 1, true];
};
};
_isCar = _cursorTarget isKindOf "Car";
if (("ItemJerrycan" in _itemsPlayer) && ("ItemSodaRbull" in _itemsPlayer)) then {
_hasNOSitems = true;
} else {
_hasNOSitems = false;
};
_isnosinstalled = _cursorTarget getVariable ["nitroinstalled", 0];
if (_isCar and !locked _cursorTarget and _hasNOSitems and _isnosinstalled == 0) then {
if (s_player_nitroInstall < 0) then {
s_player_nitroInstall = player addAction [("<t color=""#39C1F3"">" + ("Install NOS boost") +"</t>"), "scripts\nitroinstall.sqf",_cursorTarget, 999, true, false, "",""];
};
} else {
player removeAction s_player_nitroInstall;
s_player_nitroInstall = -1;
};
nitroinstall.sqf
Code:
private ["_vehicle","_hasNOS","_hasJerry","_hasRedbull"];
_vehicle = _this select 3;
player removeAction s_player_nitroInstall;
s_player_nitroInstall = -1;
if (dayz_combat == 1) exitWith {
cutText ["You cant install nitro while in combat.", "PLAIN DOWN"];
};
_hasNOS = _vehicle getVariable["nitroinstalled",0];
if(_hasNOS == 1)exitwith{cutText ["This vehicle has already nitro installed", "PLAIN DOWN"];};
_hasJerry = {_x == "ItemJerrycan"} count magazines player;
_hasRedbull = {_x == "ItemSodaRbull"} count magazines player;
if ((_hasJerry >= 1)&&(_hasRedbull >= 1)) then {
player removeMagazine "ItemJerrycan";
player removeMagazine "ItemSodaRbull";
player addMagazine "ItemJerrycanEmpty";
_vehicle setVariable ["nitroinstalled", 1, true];
cutText ["Installing NOS...", "PLAIN DOWN"];
_vehicle setfuel 0;
r_interrupt = false;
player playActionNow "Medic";
[player,"repair",0,false,10] call dayz_zombieSpeak;
[player,10,true,(getPosATL player)] spawn player_alertZombies;
sleep 6;
_vehicle setfuel 1;
_vehicle setVariable ["isnitroOn", 0, true];
systemChat("NOS installed! Activate it while driving vehicle.");
sleep 2;
r_interrupt = false;
sleep 5;
cutText ["WARNING: NOS doesn't save on restart!", "PLAIN DOWN"];
} else {
cutText ["You need: 1 Jerry Can and 1 RedBull to install NOS.", "PLAIN DOWN"];
};
nitro.sqf
Code:
private ["_vehicle"];
//https://community.bistudio.com/wiki/ListOfKeyCodes
_vehicle = _this select 3;
if (!Has_NOS) then {
_vehicle removeAction s_player_nitrobooston;
s_player_nitrobooston = -1;
Has_NOS = true;
systemChat ("NOS - Left shift to boost, space for brakes!");
waituntil {!isnull (finddisplay 46)};
boosterkey = (findDisplay 46) displayAddEventHandler ["KeyDown","_this select 1 call boosterFNC;false;"];
boosterFNC = {
private ["_vehicle","_fuel","_isNitroInstalled"];
_vehicle = vehicle player;
_isNitroInstalled = _vehicle getVariable["nitroinstalled",0];
_fuel = fuel _vehicle_player;
if(_vehicle == player)exitwith{};
if((isEngineOn _vehicle) and (_isNitroInstalled == 1)) then
{
switch (_this) do
{
case 1:
{
_vehicle setVelocity [(velocity _vehicle select 0) * 1.025, (velocity _vehicle select 1) * 1.025, (velocity _vehicle select 2) * 0.99];
_vehicle setfuel (_fuel - 0.0002);
};
case 2:
{
_vehicle SetVelocity [(velocity _vehicle select 0) * 0.95, (velocity _vehicle select 1) *0.95, (velocity _vehicle select 2) * 0.99];
};
};
};
};
} else {
_vehicle removeAction s_player_nitrobooston;
s_player_nitrobooston = -1;
Has_NOS = false;
systemChat ("NOS - deactivated");
(findDisplay 46) displayRemoveEventHandler ["KeyDown", boosterkey];
//_vehicle = nil;
_vehicle setVariable ["nitroinstalled", 1, true];
};
so basically i dont work
any help to get it working so we can stop people hording scripts as its a free mod and any content made for it and used publicly shoud be free to use