Custom Loadout Gear Duplicates it self.

Jolte

New Member
I have a big problem on my server atm.

I have changed so you start with some items in (server_playerLogin.sqf)

Code:
//Variables
_inventory =    [["M9","ItemToolbox","ItemCompass","ItemMap"],["15Rnd_9x19_M9","15Rnd_9x19_M9","ItemSodaPepsi","ItemBandage","ItemPainkiller"]];
_backpack =    [];
_items =        [];
_magazines =    [];
_weapons =        [];
_medicalStats =    [];
_survival =        [0,0,0];
_tent =            [];
_state =        [];
_direction =    0;
_model =        "";
_newUnit =        objNull;
_botActive = false;

And then i got a Script for making a bicycle from a ( Toolbox ).


But sometimes something goes wrong, cause they can simply just mass spawn bikes, i don't know if it has to do with either this, that the player spawns with 2x Toolboxes or if it's something in my (FN_Selfactions.sqf)

This usually happens after the player have died and respawns


Can someone please help me with this? Cause this is killing my server :/
 
I'm Using Overwatch 0.2.5

(FN_Selfactions.sqf)

Cutted it down due Restrictions ;)

Code:
scriptName "Functions\misc\fn_selfActions.sqf";
/***********************************************************
    ADD ACTIONS FOR SELF
    - Function
    - [] call fnc_usec_selfActions;
************************************************************/
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
_cursorTarget = cursorTarget;
_primaryWeapon = primaryWeapon player;
_currentWeapon = currentWeapon player;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
 
 
 
_nearLight = nearestObject [player,"LitObject"];
_canPickLight = false;
if (!isNull _nearLight) then {
    if (_nearLight distance player < 4) then {
        _canPickLight = isNull (_nearLight getVariable ["owner",objNull]);
    };
};
_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);
 
// Crafting Bike
_hasToolbox =    "ItemToolbox" in items player;
if((speed player <= 1) && cursorTarget isKindOf "Old_bike_TK_CIV_EP1" && _canDo) then {
if (s_player_deploybike2 < 0) then {
        s_player_deploybike2 = player addaction[("<t color=""#007ab7"">" + ("Re-Pack Bike") +"</t>"),"Fixes\bike2.sqf","",5,false,true,"", ""];
    };
} else {
    player removeAction s_player_deploybike2;
    s_player_deploybike2 = -1;
};
 
// RE-pack Bike to Toolbox
if((speed player <= 1) && _hasToolbox && _canDo) then {
    if (s_player_deploybike < 0) then {
        s_player_deploybike = player addaction[("<t color=""#007ab7"">" + ("Deploy Bike (will loose Toolbox)") +"</t>"),"Fixes\bike.sqf","",5,false,true,"", ""];
    };
} else {
    player removeAction s_player_deploybike;
    s_player_deploybike = -1;
};
 
 
};
 
Some more information about when it happens, You die and re-spawn. You scroll and there is 2x Menus of "Craft a Bicycle". When you make 1 bike and check your Inventory it doesn't display that you got a Toolbox, but you can still make a bike, but now there is just 1 Menu of "Creating Bike"
 
Could you PM me your bike scripts? i cant see a error in your FN_selfactions.sqf except you switched the comment around :)
 
"Bike.sqf" < For crafting the bike >


Code:
    player removeAction s_player_deploybike;
    player playActionNow "Medic";
    r_interrupt = false;
    player removeWeapon "ItemToolbox";
    _dis=10;
    _sfx = "repair";
    [player,_sfx,0,false,_dis] call dayz_zombieSpeak;
    [player,_dis,true,(getPosATL player)] spawn player_alertZombies;
   
    sleep 6;
   
    _object = "Old_bike_TK_CIV_EP1" createVehicle (position player);
    _object setVariable ["ObjectID", "1", true];
    _object setVariable ["ObjectUID", "1", true];
   
    _object attachto [player,[0.0,3.0,0.5]];
    sleep 3;
    detach _object;
    player reveal _object;
 
    cutText [format["You've used your toolbox to build a bike."], "PLAIN DOWN"];
   
    r_interrupt = false;
    player switchMove "";
    player playActionNow "stop";
   
    sleep 10;
   
    cutText [format["Warning: Spawned Bikes DO NOT SAVE after server restart!"], "PLAIN DOWN"];
   
};


"Bike2.sqf" < For re-packing the bike >

Code:
    player removeAction s_player_deploybike2;
    player playActionNow "Medic";
    r_interrupt = false;
    player addWeapon "ItemToolbox";
    deletevehicle cursortarget;
    _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";
};
 
I think it must have something to do with the Starting Gear. It's impossible to bug it out when you only see 1 menu!
But sometimes you spawn at certain location you can see that there is two menus :/ I don't know how it's possible but it have to be something going on with the starting gear
 
If your database has a Default_loadout table, is it empty?

I havn't use Overwatch so i'm not sure which it uses.

Looking at the code the only thing I can think of is that they have two toolboxes (which I'm not even sure is possible)
 
Okay, now it happend again. I can spam out Bikes even tho i'm not even having a toolbox in my Inventory!

I logged into my DB to check my gear as well, nope no Toolbox. But yet i can make bikes -.-
 
Looking at the code again, isn't a toolbelt item in the weapons slot of the inventory?

Try changing
Code:
_hasToolbox =    "ItemToolbox" in items player;
to
Code:
_hasToolbox =    player hasWeapon "ItemToolbox";
?
 
Back
Top