Jump to content
Sign in to follow this  
kocrachon

Only "name" can enter this vehicle

Recommended Posts

Thx for replying OpusFmSPol. Don't take my word for it (I'm a newb) but I would say it's run from server.

I tried removing the waitUntil {!isNull player}; line out of the script and tested it on the dedi and it ejected the player out of the vehicle, but the message would not show up. However I fail to see that the line is the root of my problem as it has been working until the 1.36 update.

Share this post


Link to post
Share on other sites

Whitelistveh.sqf

if (isDedicated) ExitWith {
false;
};
//whitelist
_whitelistedvehicles = ["B_Heli_Light_01_F"];
idarr = ["123456","654321","123654"];


//Get player UID
_uid = 1;
if (isMultiplayer) Then {
_uid = getPlayerUID player;
};

//Request Array from server
RequestArray = 0;
publicVariableServer "RequestArray";

//Start loop
while {true} do {
   if ((typeOf(vehicle player)) in _whitelistedvehicles && !((vehicle player getCargoIndex player)>=0) && !(_uid in idarr)) Then {
   	hint parseText "<t color='#ff0000' size='1.6'>Whitelisted Vehicle!</t><br /><t size='1.1'>Only trained pilots may fly</t>";

   	_vehicle = vehicle player;
   	player action ["Eject", vehicle player];
   	player action ["getOut", _vehicle];
   	sleep 2;
   	_vehicle setFuel 0;
   	sleep 0.5;
   	_vehicle setFuel 1;
   };
   sleep 3;
};

Init.sqf

[] execVM "Whitelistveh.sqf"

here you go. this script will kick persons that are not whitelisted from all the vehicle's you specify in the vehicle array. ID's go into the id array

This was wrote by a kind community member of ours

Share this post


Link to post
Share on other sites
I tried removing the waitUntil {!isNull player}; line out of the script and tested it on the dedi and it ejected the player out of the vehicle, but the message would not show up.

systemChat is local in effect. A dedicated server has no real player to do chat, and the command needs to be run on the targeted client machine(s).

https://community.bistudio.com/wiki/systemChat

Maybe try:

[b]_unit systemChat "You need to be a VIPilot to fly this aircraft. Check FAQ in the menu on the map, top left corner!";[/b]

[i]			// - or -[/i]

[b]vehicle _unit systemChat "You need to be a VIPilot to fly this aircraft. Check FAQ in the menu on the map, top left corner!";[/b]

[i]// Note: format command is not needed since you're not using dynamic values (%1,%2 etc.) or a Localize string that has dynamic values.[/i]

Share this post


Link to post
Share on other sites

Thank you both very much for taking your time to help me with this. KKBW123 your script worked perfect and did the job so I'm just gonna stick with that one.

@ OpusFmSPol - love your forum signature.

Share this post


Link to post
Share on other sites

Is there a way to do this with using the info from the squad url file? So basically it checks against that?

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  

×