Jump to content
Sign in to follow this  
hellstorm77

lock/unlock vehicle scripts

Recommended Posts

wondering if the is a login admin lock/unlock vehicle script for arma 3

Share this post


Link to post
Share on other sites

been looking around but couldnt find any that worked. I have changed my mind in what i am looking for.

I have 2 vehicles in my mission named v1 & v2 and i was wondering if there is a script where i can add a UID to each vehicle (player1) to v1 and (player2 to v2)

Share this post


Link to post
Share on other sites

ok i found a script but it doesn't seem to work how i wanted it too. V1 is the vehicle name. when i put my guid into the script it still kicks me from the vehicle. help would be appreciated hellstorm77

Vehicle_restriction.sqf

_vehicle = _this select 0; 

_vehicle addEventHandler ["GetIn",  
{ 
private ["_veh", "_pos", "_unit", "_namesArray"]; 
_veh = _this select 0; 
_pos = _this select 1; 
_unit = _this select 2; 
_namesArray = ["MY GUID1", "GUID2", "GUID3"]; 

if !((getPlayerUID _unit) in _namesArray) then 
{ 
_unit action ["Eject", vehicle _unit];  
}; 
}];  

I put this in the init of the vehicle veh = [v1] execVM "Vehicle_restriction.sqf";

Share this post


Link to post
Share on other sites
ok i found a script but it doesn't seem to work how i wanted it too. V1 is the vehicle name. when i put my guid into the script it still kicks me from the vehicle. help would be appreciated hellstorm77

Vehicle_restriction.sqf

_vehicle = _this select 0; 

_vehicle addEventHandler ["GetIn",  
{ 
private ["_veh", "_pos", "_unit", "_namesArray"]; 
_veh = _this select 0; 
_pos = _this select 1; 
_unit = _this select 2; 
_namesArray = ["MY GUID1", "GUID2", "GUID3"]; 

if !((getPlayerUID _unit) in _namesArray) then 
{ 
_unit action ["Eject", vehicle _unit];  
}; 
}];  

I put this in the init of the vehicle veh = [v1] execVM "Vehicle_restriction.sqf";

So let me get this straight you want a script to kick non admins from specific vehicles?

Share this post


Link to post
Share on other sites

no i changed my mind on that. I just want it to kick everyone who's guid isn't in the list

Share this post


Link to post
Share on other sites
no i changed my mind on that. I just want it to kick everyone who's guid isn't in the list

So server whitelist?

Share this post


Link to post
Share on other sites

yes whitelist i dont want to work with vehicle classnames i want to be able to just name a vehicles init

Share this post


Link to post
Share on other sites
yes whitelist i dont want to work with vehicle classnames i want to be able to just name a vehicles init

Ok so you want to make a vehicle only for people with certain UID's?

Also why do you want to kick people why not just make them get out of the vehicle?

Share this post


Link to post
Share on other sites

yeah vehicle for people with certain UID's because its on public server and the whitelist is for clan members.

Share this post


Link to post
Share on other sites
yeah vehicle for people with certain UID's because its on public server and the whitelist is for clan members.

Ok then you could use the following code

if you spawn the vehicle using the editor then put this in it's init field

null = this execVM "Clan_VCL.sqf";

Clan_VCL.sqf

call compile format ['
[{
if !(isServer) then
{
_VCL = %1;
_UIDs = ["123456","7891011"];
while{true}do
	{
	waitUntil{((vehicle player) == _VCL)};
	if !((getPlayerUID player) in _UIDs) then {endMission "LOSER";};
	waitUntil{((vehicle player) != _VCL)};
	};
}
}, "BIS_fnc_spawn", true, true] spawn BIS_fnc_MP;
',_this];

This will kick players who get into the vehicle and their UID is not in the list

call compile format ['
[{
if !(isServer) then
{
_VCL = %1;
_UIDs = ["123456","7891011"];
while{true}do
	{
	waitUntil{((vehicle player) == _VCL)};
	if !((getPlayerUID player) in _UIDs) then {unassignVehicle player;};
	waitUntil{((vehicle player) != _VCL)};
	};
}
}, "BIS_fnc_spawn", true, true] spawn BIS_fnc_MP;
',_this];

This will eject players from the vehicle who get into the vehicle and their UID is not in the list

Share this post


Link to post
Share on other sites

it looking good just one thing i would like to change endMission "LOSER" could that be eject instead

---------- Post added at 13:31 ---------- Previous post was at 12:00 ----------

just tried this but didn't work i added player action ["eject", vehicle player]; instead of {endMission "LOSER";};

call compile format ['
[{
if !(isServer) then
{
_VCL = %1;
_UIDs = ["123456","7891011"];
while{true}do
	{
	waitUntil{((vehicle player) == _VCL)};
	if !((getPlayerUID player) in _UIDs) then player action ["eject", vehicle player];
	waitUntil{((vehicle player) != _VCL)};
	};
	hint "this";
}
}, "BIS_fnc_spawn", true, true] spawn BIS_fnc_MP;
',_this];


call compile format ['
[{
if !(isServer) then
{
_VCL = %1;
_UIDs = ["123456","7891011"];
while{true}do
	{
	waitUntil{((vehicle player) == _VCL)};
	if !((getPlayerUID player) in _UIDs) then {unassignVehicle player;};
	waitUntil{((vehicle player) != _VCL)};
	};
}
}, "BIS_fnc_spawn", true, true] spawn BIS_fnc_MP;
',_this];

my error

Error in expression <};
if !((getPlayerUID player) in _UIDs) then player action ["eject", vehicle pla>
 Error position: <then player action ["eject", vehicle pla>
 Error then: Type Object, expected Array,code

Edited by hellstorm77

Share this post


Link to post
Share on other sites

Second part of my last post...

call compile format ['
[{
if !(isServer) then
{
_VCL = %1;
_UIDs = ["123456","7891011"];
while{true}do
	{
	waitUntil{((vehicle player) == _VCL)};
	if !((getPlayerUID player) in _UIDs) then {unassignVehicle player;};
	waitUntil{((vehicle player) != _VCL)};
	};
}
}, "BIS_fnc_spawn", true, true] spawn BIS_fnc_MP;
',_this];

This will eject players from the vehicle who get into the vehicle and their UID is not in the list

Share this post


Link to post
Share on other sites
Second part of my last post...

the first part works and ends the mission but the second part doesn't work i can still get into the vehicle even though my uid isn't in the script

Share this post


Link to post
Share on other sites

Then this

call compile format ['
[{
if !(isServer) then
   {
   _VCL = %1;
   _UIDs = ["123456","7891011"];
   while{true}do
       {
       waitUntil{((vehicle player) == _VCL)};
       if !((getPlayerUID player) in _UIDs) then {player action ["eject", _VCL];};
       waitUntil{((vehicle player) != _VCL)};
       };
       hint "this";
   }
}, "BIS_fnc_spawn", true, true] spawn BIS_fnc_MP;
',_this];

You had the structure slightly wrong

Share this post


Link to post
Share on other sites

i have another question when the vehicle respawns the script goes away how would i get around this?

Share this post


Link to post
Share on other sites
i have another question when the vehicle respawns the script goes away how would i get around this?

You would need to call the script again once it has respawned.

Does the vehicle respawn using the createVehicle command?

Share this post


Link to post
Share on other sites
this is the vehicle respawn script im using http://pastebin.com/haQgr6dV. Line 133 i did try to call it but it gave me errors

Change line 133 to this

_unit execVM "core\restrictions\Vehicle_restriction.sqf";

Share this post


Link to post
Share on other sites

i do get this error though

Error in expression <
[{
if !(isServer) then
{
_VCL = 5221c100# 1780244: mrap_01_unarmed_f.p3d;
_U>
 Error position: <c100# 1780244: mrap_01_unarmed_f.p3d;
_U>
 Error Missing ;
Error in expression <
[{
if !(isServer) then
{
_VCL = 5221c100# 1780244: mrap_01_unarmed_f.p3d;
_U>
 Error position: <c100# 1780244: mrap_01_unarmed_f.p3d;
_U>
 Error Missing ;

Share this post


Link to post
Share on other sites
i do get this error though
Error in expression <
[{
if !(isServer) then
{
_VCL = 5221c100# 1780244: mrap_01_unarmed_f.p3d;
_U>
 Error position: <c100# 1780244: mrap_01_unarmed_f.p3d;
_U>
 Error Missing ;
Error in expression <
[{
if !(isServer) then
{
_VCL = 5221c100# 1780244: mrap_01_unarmed_f.p3d;
_U>
 Error position: <c100# 1780244: mrap_01_unarmed_f.p3d;
_U>
 Error Missing ;

Ok try using the following modified code instead

call compile format ['
[{
if !(isServer) then
   {
   _VCL = %1;
   if (isNull _VCL) exitWith {};
   _UIDs = ["123456","7891011"];
   while{true}do
       {
       waitUntil{((vehicle player) == _VCL)};
       if !((getPlayerUID player) in _UIDs) then {player action ["eject", _VCL];};
       waitUntil{((vehicle player) != _VCL)};
       };
       hint "this";
   }
}, "BIS_fnc_spawn", true, true] spawn BIS_fnc_MP;
',_this];

Share this post


Link to post
Share on other sites

still getting an error

Error in expression <[{
if !(isServer) then
{
_VCL = 6451d600# 1780188: mrap_01_unarmed_f.p3d REMOTE;>
 Error position: <# 1780188: mrap_01_unarmed_f.p3d REMOTE;>
 Error Missing ;
Error in expression <[{
if !(isServer) then
{
_VCL = 6451d600# 1780188: mrap_01_unarmed_f.p3d REMOTE;>
 Error position: <# 1780188: mrap_01_unarmed_f.p3d REMOTE;>
 Error Missing ;

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  

×