When repacking a deployed bike, nearby buildings and objects disappear

Change the bike pack.sqf file to the following :
Code:
if(false)then{// player is in combat and cant pack his bike
cutText [format["You are in combat and cannot re-pack your bike."],"PLAIN DOWN"];}else{if(typeOf cursorTarget =="Old_bike_TK_INS_EP1"|| typeOf cursorTarget =="Old_bike_TK_CIV_EP1")then{// player is looking at a bike and the target has a bike classname// delete it first to avoid player changing to another target
deletevehicle cursorTarget;
player removeAction s_player_deploybike2;
player playActionNow "Medic";
r_interrupt =false;
player addWeapon "ItemToolbox";
_dis=10;
_sfx ="repair";[player,_sfx,0,false,_dis] call dayz_zombieSpeak;[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
sleep 6;
cutText [format["You have packed your bike and been given back your toolbox"],"PLAIN DOWN"];
r_interrupt =false;
player switchMove "";
player playActionNow "stop";}else{// player is not looking at a bike, or target does not have a bike classname
cutText [format["You have to be facing your bike to re-pack it!"],"PLAIN DOWN"];};};
Credit goes to JoSchaap for the code
 
Credit goes to JoSchaap for the code
tbh i doubt JoSchaap would make a script that starts with:
Code:
if(false)then{

on a side note this can be avoided by reducing the distance needed between object and player before addaction pops up to about 1-3m.
you can also do a nearestobject check and make sure the player as actually near a bike when activated and if not, then ignore/text

this would make sure you never delete anything but a bike

also, it would be a good idea to set/check for a variable within the bikes when created/deleted, that way you can check for this variable again when packing, to make sure its not a bike from the database
 
maybe just select the first bike and delete, instead of deleteing all nearby bikes.

incase someone by (slim but still possible) chance will have more than one bike within 5m ... lol
 
Is there something wrong with the script he has provided? You guys know a lot more about this stuff than I do. TBH I really know nothing other than what Im told. I started using the script he provided and it seems to work fine.
 
So Ive got this all over my RPT. I never used to have this before and Im trying to track down what I changed recently that might have caused this. The only thing I can think of is changing this repack script. Could that cause this to happen?
20:43:28 Error Generic error in expression
20:43:28 File z\addons\dayz_server\compile\server_updateObject.sqf, line 33
20:43:28 Error in expression <0";
};
if (_object getVariable "Sarge" == 1) exitWith {};
 
you should rather parse cursortarget via the addaction then, that would ensure its the bike that activated the addaction, which is deleted
 
Back
Top