Sorry for the confusing title but I need a little bit of help. Im using an old scroll wheel option deploy script that I've modified to suit my purposes however I've recently discovered a rather serious problem. When you deploy the vehicle it is initially attached to the player and you are required to press space bar to deploy the vehicle. However, in the time before you press space bar you can simply move the required parts to your backpack and then deploy the vehicle without actually losing the required parts. This allows players to make an infinite amount of deployable vehicles.
How can I stop this? Here are my scripts
Deploy.sqf
if !(isNil "isDangerDeploying")exitWith{
titleText["Already deploying something ...","PLAIN DOWN"];
};
isDangerDeploying = true;
deploybike = false; //or whatever you would like to call this variable ;)
_weapons = [currentWeapon player] + (weapons player) + (magazines player);
closeDialog 0;
_toolbox = "ItemToolbox" in _weapons;
if (!_toolbox) then {
cutText [format["Missing Toolbox"], "PLAIN DOWN"];
} else {
cutText ["\n\nPRESS SPACEBAR TO DEPLOY", "PLAIN DOWN"];
_Offset = [0,5,0]; //change how far from player vehicle spawns
_worldPos = player modelToWorld _Offset; // spawn in front of player
_object = "350z_ruben" createVehicle (_worldPos);
_object setVariable ["ObjectID", "1", true];
_object setVariable ["ObjectUID", "1", true];
_object attachTo [player,[-0.2, 5, 1]];
waitUntil {deploybike};
_object setVariable ["Deployed", "1", true];
player playActionNow "Medic";
cutText ["\n\nDeploying vehicle. Move from current position to cancel", "PLAIN DOWN"];
[1,1] call dayz_HungerThirst;
player playActionNow "Medic";
[player,"repair",0,false] call dayz_zombieSpeak;
[player,50,true,(getPosATL player)] spawn player_alertZombies;
r_interrupt = false;
_animState = animationState player;
r_doLoop = true;
_started = false;
_finished = false;
while {r_doLoop} do {
_animState = animationState player;
_isMedic = ["medic",_animState] call fnc_inString;
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
r_doLoop = false;
_finished = true;
};
if (r_interrupt) then {
r_doLoop = false;
};
sleep 0.1;
};
r_doLoop = false;
if (_finished) then {
player removeWeapon "ItemToolbox";
player removeMagazine "PartEngine";
player removeMagazine "PartGeneric";
_dis=10;
_sfx = "repair";
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
detach _object;
cutText [format["Here's your 350z you lazy bum!"], "PLAIN DOWN"];
r_interrupt = false;
player switchMove "";
player playActionNow "stop";
sleep 10;
_object addEventHandler ["GetIn",{
_nil = [nil,(_this select 2),"loc",rTITLETEXT,"Warning: Spawned 350z DO NOT SAVE after server restart! ","PLAIN DOWN",5] call RE;
}];
} else {
r_interrupt = false;
player switchMove "";
player playActionNow "stop";
deleteVehicle _object;
cutText ["\n\nCanceled deploying vehicle", "PLAIN DOWN"];
};
};
isDangerDeploying = nil;
fn_selfActions.sqf
// -------------------------------------- 350z DEPLOY --------------------------------------
_weapons = [currentWeapon player] + (weapons player) + (magazines player);
_isNissan350z = typeOf cursorTarget in ["350z_ruben"];
if ("ItemToolbox" in _weapons && "PartEngine" in _mags && "PartGeneric" in _mags ) then {
hasNissanItem = true;
} else { hasNissanItem = false;};
if((speed player <= 1) && hasNissanItem && _canDo) then {
if (s_player_350z < 0) then {
s_player_350z = player addaction[("<t color=""#D16666"">" + ("Deploy 350z") +"</t>"),"deploys\350z\deploy.sqf","",5,false,true,"", ""];
};
} else {
player removeAction s_player_350z;
s_player_350z = -1;
};
// -------------------------------------- 350z DEPLOY --------------------------------------
Question
DangerRuss
Sorry for the confusing title but I need a little bit of help. Im using an old scroll wheel option deploy script that I've modified to suit my purposes however I've recently discovered a rather serious problem. When you deploy the vehicle it is initially attached to the player and you are required to press space bar to deploy the vehicle. However, in the time before you press space bar you can simply move the required parts to your backpack and then deploy the vehicle without actually losing the required parts. This allows players to make an infinite amount of deployable vehicles.
How can I stop this? Here are my scripts
Deploy.sqf
fn_selfActions.sqf
Link to comment
Share on other sites
16 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now