Takistan RPT Spam

bubba752

New Member
Hi, I am a developer on a Takistan Life server and are currently working on our Holster/Unholster script. I usually can resolve issues on my own, but this one has me stumped.

We get this spam in our RPT:
Code:
waitUntil {holster == _waitUntil || unholster == _waitUntil};>
  Error position: <unholster == _waitUntil};>
  Error Undefined variable in expression: unholster
File mpmissions\__cur_mp.Takistan\pistolControl.sqf, line 98
Error in expression <ct 2;
_d = _this select 3;

And this is our Holster/Unholster script:
Code:
_passedArray = _this;
_waitUntil = 0;
_gun = "";

// Function for pistol data - by Spooner
isPistol =
{
    _unknownWeaponClass = _this select 0;
   
    _unknownConfig = configFile >> "CfgWeapons" >> _unknownWeaponClass;
    _pistolConfig = configFile >> "CfgWeapons" >> "PistolCore";
   
    _isPistol = false;
    while {isClass _unknownConfig} do
    {
        if (_unknownConfig == _pistolConfig) exitWith
        {
            _isPistol = true;
        };
   
        _unknownConfig = inheritsFrom _unknownConfig;
    };
   
    _isPistol; // Return.
};

// Moderate array when script is ran 1st time
if (count _this == 0) then
{
// Modify array when first ran (make it similar to addAction)
_passedArray = [0,0,0,[false]];

// Activate parallel script to check weapon conditions, first run
[] spawn
{
    // Syntax: ["pistolclass",holstered?,dropped pistol?];
    saveWeapon = ["",false,false];

while { true } do
{
    _weaponsArray = weapons player;
    _numWeapon = count _weaponsArray;

// Get pistol classname
_prevention = true;
for [{_p = 0},{_p < _numWeapon},{_p = _p + 1}] do
{
    _gun = (_weaponsArray select _p);
    if ([_gun] call isPistol) exitWith
    {
        _prevention = false;
        if ((_gun != saveWeapon select 0) && saveWeapon select 1) then { _prevention = true; saveWeapon set [1,false]; };
        saveWeapon set [0,_gun];       
    };
};

// Determine if holster/unholster can be used
if (_prevention && !(saveWeapon select 1)) then { saveWeapon set [2,true]; player removeAction holster; player removeAction unholster; }
else
{ if (saveWeapon select 2) then { holster = player addAction ["Holster Pistol","pistolControl.sqf",[true]]; saveWeapon set [2,false]; }; };

sleep 0.5;
};

// End of spawn
};
};

// Prepare value if holster or unholstered
_holster = (_passedArray select 3 select 0);

// Activate the correct action
if (!_holster) then
{
    player removeAction unholster;
    saveWeapon set [1,false];
    holster = player addAction ["Holster Pistol","pistolControl.sqf",[true]];
   
    // Upon first activation, prevent addWeapon
    if (count _this > 0) then
    {
    player addWeapon (saveWeapon select 0);
    player selectWeapon (saveWeapon select 0);
    };
}
else
{
    player removeAction holster;
    saveWeapon set [1,true];
    unholster = player addAction ["Unholster Pistol","pistolControl.sqf",[false]];
    player removeWeapon (saveWeapon select 0);
};

// Calculate next ID
_waitUntil = (_passedArray select 2) + 1;

// Wait with termination until action is used or pistol is dropped//
waitUntil {holster == _waitUntil || unholster == _waitUntil || (saveWeapon select 2)};

Now In-Game the script works completely fine, in fact it's flawless. But the RPT spam is HUGE. Is there any small fix I can make to the Holster script to prevent this RPT spam? I have tried removing the last line which helped with the RPT spam but just creates too many false addActions in-game. Any help is greatly appreciated!
 
I was sure I had replied to this already. As well as a bubba-bump ... ..

I think the issue will be that the RPT spam is on the server while your script is running on the client. Therefore the unholstered variable is not known on the server. So some type of condition to prevent this script from running on the server might fix your problem.
 
quick easy and dirty fix, add
Code:
unholster = "";
to your server variables.sqf and it should stop the spam

EDIT: try add it to the top of your holster script instead so its declared before it gets used
 
Back
Top