0verHeaT / VehicleGarage

Virtual Vehicle Storage for Arma 2 Epoch
3 stars 7 forks source link

rtp spam (fn_selfactions.sqf) #2

Open hekut146 opened 8 years ago

hekut146 commented 8 years ago

Error in expression < _garagefriends,(_x select 0)]; } count _friend;

_garageallowed = [_owner] + _g> Error position: <_friend;

_garageallowed = [_owner] + _g> Error Undefined variable in expression: _friend File mpmissions__CUR_MP.Chernarus\custom\fixes\fn_selfActions.sqf, line 1168

Evocation commented 8 years ago

replace

private ["_garageowner","_garagefriends","_garageallowed","_friend"]; _garageowner = _cursorTarget getVariable ["ownerPUID","0"]; //<-- We get the PUID of the owner. Here with P4L _friend = _cursorTarget getVariable ["GarageFriends",[]]; _garagefriends = []; { _garagefriends set [count _garagefriends,(_x select 0)]; } count _friend;

with

private ["_garageowner","_garagefriends","_garageallowed"]; _garageowner = _cursorTarget getVariable ["ownerPUID","0"]; //<-- We get the PUID of the owner. Here with P4L _garagefriends = []; { _garagefriends set [count _garagefriends,(_x select 0)]; } count (_cursorTarget getVariable ["GarageFriends",[]]);

if still errors will occour, check if _cursorTarget is defined before and reply accordingly :)

hekut146 commented 8 years ago

thanks i try

hekut146 commented 8 years ago

but when i replace i have this spam error:

Error in expression <"GarageFriends",[]]); _garageallowed = [_garageowner] + _garagefriends; if (_typ> Error position: <_garageowner] + _garagefriends; if (_typ> Error Undefined variable in expression: _garageowner File mpmissions__CUR_MP.Chernarus\custom\fixes\fn_selfActions.sqf, line 1160

hekut146 commented 8 years ago

I have now this code:

private ["_garageowner","_garagefriends","_garageallowed","_cursorTarget","_typeOfCursorTarget"]; _cursorTarget = cursorTarget; _typeOfCursorTarget = (typeOf _cursorTarget); _garageowner = _cursorTarget getVariable ["ownerPUID","0"]; _garagefriends = []; { _garagefriends set [count _garagefriends,(_x select 0)]; } count (cursorTarget getVariable ["GarageFriends",[]]); _garageallowed = [_garageowner] + _garagefriends; if (_typeOfCursorTarget in DZE_Garage) then { if (s_player_garage < 0) then { if ((getPlayerUID player) in _garageallowed) then { s_player_garage = player addAction ["Меню гаража", "Garage\player_virtualgarage.sqf", _cursorTarget, 2, false]; } else { s_player_garage = player addAction ["Гараж закрыт", "",_cursorTarget, 2, true, true, "", ""];
}; }; } else { player removeAction s_player_garage; s_player_garage = -1;
};

hekut146 commented 8 years ago

when i see at garage i test inject this script:

private ["_ownerPUID","_GarageFriends"]; _ownerPUID = cursorTarget getVariable ["ownerPUID","0"]; _GarageFriends = cursorTarget getVariable ["GarageFriends",[]]; systemChat format ['_ownerPUID:%1 _GarageFriends:%2',_ownerPUID,_GarageFriends];

all work, i see _ownerPUID:my uid and _GarageFriends:my uid and my profile name in arma

Evocation commented 8 years ago

i shrinked the script as small as possible i think

replace the whole part and report back pls:

private ["_garagefriends","_cT"]; if (!isNull cursorTarget && (player distance cursorTarget < 10)) then { _cT = cursorTarget; _garagefriends = []; { _garagefriends set [count _garagefriends,(_x select 0)]; } count (cursorTarget getVariable ["GarageFriends",[]]); if ((typeOf _cT) in DZE_Garage) then { if (s_player_garage < 0) then { if ((getPlayerUID player) in ([(_cT getVariable ["ownerPUID","0"])] + _garagefriends)) then { s_player_garage = player addAction ["Меню гаража", "Garage\player_virtualgarage.sqf", _cT, 2, false]; } else { s_player_garage = player addAction ["Гараж закрыт", "",_cT, 2, true, true, "", ""]; }; }; } else { player removeAction s_player_garage; s_player_garage = -1; }; };

hekut146 commented 8 years ago

i think i found my problem, need add this script in this block

if (!isNull cursorTarget && !_inVehicle && !_isPZombie && (player distance cursorTarget < _allowedDistance) && _canDo) then { //Has some kind of target

Evocation commented 8 years ago

and yes i thought too, thats because of the null cursortarget so ive written it to work around but nvm if its working now :)

hekut146 commented 8 years ago

thank for help, i try

Evocation commented 8 years ago

with my little workaround it shouldnt matter alot where u place it in the fn_selfActions.sqf... at the boddom or the top :)

hekut146 commented 8 years ago

very big thanks, now don't have spam :)

Evocation commented 8 years ago

great :)

good luck, hf ^^