Open hekut146 opened 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 :)
thanks i try
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
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;
};
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
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; }; };
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
and yes i thought too, thats because of the null cursortarget so ive written it to work around but nvm if its working now :)
thank for help, i try
with my little workaround it shouldnt matter alot where u place it in the fn_selfActions.sqf... at the boddom or the top :)
very big thanks, now don't have spam :)
great :)
good luck, hf ^^
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