Jump to content
Sign in to follow this  
Anjan-Riot

Vehicle access via UID don't work after update

Recommended Posts

hi there,

i have a script that doesn't work even after an update, i played around with it a little bit, but no luck.

maybe some of you, can help me out with it.

i put this in the init field of the unit

veh = [this, 60, 300, 0, FALSE, FALSE, "nul = [this,""H4"",0.5] execVM ""scripts\mark_unit.sqf"";"] execVM "scripts\vehicle.sqf"; nul = [this,"H4",0.5] execVM "scripts\mark_unit.sqf";this addEventHandler ["GetIn", {_this execVM "scripts\vehiclelock.sqf"}];

and here is the script

private ["_vehicle", "_pos", "_unit", "_namesArray"];

_vehicle = _this select 0;

_pos = _this select 1;

_unit = _this select 2;

_namesArray = ["121212121212"];

if (driver _vehicle == player) then {

_vehicle setFuel 0;

_vehicle vehicleChat format["Welcome %1! Wait for the membership check.", name _unit];

};

sleep 3;

if ((getPlayerUID _unit) in _namesArray) then {

_vehicle vehicleChat "Welcome member! Membership check successful.";

sleep 2;

_vehicle vehicleChat format ["Engines free %1!", name _unit];

sleep 1;

_vehicle setFuel 1;

} else {

_vehicle vehicleChat "You are not a member or your PID is not in our list.";

sleep 1;

_vehicle vehicleChat "Only members can fly and use heavy vehicles.";

_unit action ["Eject", vehicle _unit];

_vehicle setFuel 0;

};

thanks Anjan

Share this post


Link to post
Share on other sites

no,

one is the simple vehicle respawn script,

the other one looks like that

private ["_unit","_marker","_delay"];

_unit = _this select 0;

_marker = _this select 1;

_delay = _this select 2;

while {true} do

{

_marker setMarkerAlpha 1;

while {alive _unit} do

{

_marker setMarkerPosLocal getPos _unit;

sleep _delay;

};

_marker setMarkerAlpha 0;

waitUntil {alive _unit};

};

Share this post


Link to post
Share on other sites

ok,

i updated the vehicle.sqf and now i have a setVehicleInit in it.

if (isNil "FNC_setVehicleInit") then {

FNC_setVehicleInit = {

private ["_netID","_unit","_unitinit"];

_netID = _this select 0;

_unit = objectFromNetID _netID;

_unitinit = _this select 1;

_unit call compile format ["%1",_unitinit];

};

};

but what now?

Share this post


Link to post
Share on other sites

You misunderstand, I meant is setVehicleInit anywhere in any of the scripts? Not that you should put it in any script. It is deprecated due to security issues, so it will break scripts that have it.

Share this post


Link to post
Share on other sites

hehe sorry, no i don't have it in any of the scripts and i put the vehicle.sqf back to:

private ["_hasname","_delay","_deserted","_respawns","_noend","_dead","_nodelay","_timeout","_position","_dir","_effect","_rounds","_run","_unit","_explode","_dynamic","_unitinit","_haveinit","_unitname","_type"];

if (!isServer) exitWith {};

// Define variables

_unit = _this select 0;

_delay = if (count _this > 1) then {_this select 1} else {30};

_deserted = if (count _this > 2) then {_this select 2} else {120};

_respawns = if (count _this > 3) then {_this select 3} else {0};

_explode = if (count _this > 4) then {_this select 4} else {false};

_dynamic = if (count _this > 5) then {_this select 5} else {false};

_unitinit = if (count _this > 6) then {_this select 6} else {};

_haveinit = if (count _this > 6) then {true} else {false};

_hasname = false;

_unitname = vehicleVarName _unit;

if (isNil _unitname) then {_hasname = false;} else {_hasname = true;};

_noend = true;

_run = true;

_rounds = 0;

if (_delay < 0) then {_delay = 0};

if (_deserted < 0) then {_deserted = 0};

if (_respawns <= 0) then {_respawns= 0; _noend = true;};

if (_respawns > 0) then {_noend = false};

_dir = getDir _unit;

_position = getPosASL _unit;

_type = typeOf _unit;

_dead = false;

_nodelay = false;

// Start monitoring the vehicle

while {_run} do

{

sleep (2 + random 10);

if ((getDammage _unit > 0.8) and ({alive _x} count crew _unit == 0)) then {_dead = true};

// Check if the vehicle is deserted.

if (_deserted > 0) then

{

if ((getPosASL _unit distance _position > 10) and ({alive _x} count crew _unit == 0) and (getDammage _unit < 0.8)) then

{

_timeout = time + _deserted;

sleep 0.1;

waitUntil {_timeout < time or !alive _unit or {alive _x} count crew _unit > 0};

if ({alive _x} count crew _unit > 0) then {_dead = false};

if ({alive _x} count crew _unit == 0) then {_dead = true; _nodelay =true};

if !(alive _unit) then {_dead = true; _nodelay = false};

};

};

// Respawn vehicle

if (_dead) then

{

if (_nodelay) then {sleep 0.1; _nodelay = false;} else {sleep _delay;};

if (_dynamic) then {_position = getPosASL _unit; _dir = getDir _unit;};

if (_explode) then {_effect = "M_AT" createVehicle getPosASL _unit; _effect setPosASL getPosASL _unit;};

sleep 0.1;

deleteVehicle _unit;

sleep 2;

_unit = _type createVehicle _position;

_unit setPosASL _position;

_unit setDir _dir;

_dead = false;

// Check respawn amount

if !(_noend) then {_rounds = _rounds + 1};

if ((_rounds == _respawns) and !(_noend)) then {_run = false;};

};

};

Share this post


Link to post
Share on other sites

I am an idiot,

it works!! I didn't test it on the server before, it was a long night sorry about that!!

thanks to all

anjan

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×