watarimono 0 Posted April 10, 2013 I'm wondering if anyone can help me with this since I'm total scripting noob. I'm working on a mission for a public server and have a couple of choppers that currently are only available to pilots with the following script: // Only pilots.sqf // Only pilots piloting _vehicle = _this select 0; _pilotstypes = ["B_Helipilot_F"]; _driver = objNull; while {damage _vehicle < 0.5} do { _driver = driver _vehicle; if (!isNull _driver) then { if (!((typeOf _driver) in _pilotstypes)) then { _driver action ["GETOUT", _vehicle]; hint "You are not trained to fly this type of Aircraft"; }; }; Sleep 1; }; What I want to add to this is that only pilots OR certain UIDs (clanmembers) from a list can fly the choppers. Can anyone help me with this? Share this post Link to post Share on other sites
mindstorm 8 Posted April 10, 2013 You could defaultly lock the vehicle (or by script): vehicleName setVehicleLock "LOCKED"; Then add an action on the chopper: http://community.bistudio.com/wiki/addAction _chopper addAction ["Enter vehicle", "enter_vehicle.sqf"] then in enter_vehicle.sqs: -Check if player is a pilot and pilot null then put him in the vehicle -If not a pilot put him in cargo if slot available. http://community.bistudio.com/wiki/moveInDriver http://community.bistudio.com/wiki/moveInCargo Not sure if those work when the vehicle is locked. If they don't you could only do the pilot check in enter_vehicle.sqf and do: vehicleName setVehicleLock "UNLOCKED"; Then this to lock the vehicle once the driver exits and kick all players. [] spawn { waitUntil {isNull driver vehicle}; vehicleName setVehicleLock "LOCKED"; //kick all players out }; You also might wanna check about removing the enter chopper action once a chopper enters it and replace it once he exits. The addAction returns a handle, so you can remove it with : http://community.bistudio.com/wiki/removeAction eg CHOPPER_ACTION = _chopper addAction ["Enter vehicle", "enter_vehicle.sqf"]; player removeAction CHOPPER_ACTION; Share this post Link to post Share on other sites
watarimono 0 Posted April 10, 2013 Doesn't that pretty much do the same as the script I'm using now, but in another way? My script works for pilots only but I want to add so pilots OR clanmembers (UIDs) can fly. Share this post Link to post Share on other sites
mindstorm 8 Posted April 10, 2013 _vehicle = _this select 0; _pilotstypes = ["B_Helipilot_F"]; _clanmemberuids = ["UID","UID","UID"]; _driver = objNull; while {damage _vehicle < 0.5} do { _driver = driver _vehicle; if (!isNull _driver) then { if (!((typeOf _driver) in _pilotstypes) && !(getPlayerUID player in _clanmemberuids)) then { _driver action ["GETOUT", _vehicle]; hint "You are not trained to fly this type of Aircraft"; }; }; Sleep 1; }; Share this post Link to post Share on other sites
watarimono 0 Posted April 10, 2013 (edited) Thank you mindstorm, worked like a charm :) ---------- Post added at 13:29 ---------- Previous post was at 12:35 ---------- Spoke to soon, It works perfect when I host it locally but on our "dedicated" server pilots can fly and clanmembers still get kicked out of choppers. Edited April 10, 2013 by Watarimono Share this post Link to post Share on other sites
mindstorm 8 Posted April 10, 2013 My bad. That's because in MP the player is only the local player. Change getPlayerUID player to getPlayerUID _driver aka _vehicle = _this select 0; _pilotstypes = ["B_Helipilot_F"]; _clanmemberuids = ["UID","UID","UID"]; _driver = objNull; while {damage _vehicle < 0.5} do { _driver = driver _vehicle; if (!isNull _driver) then { if (!((typeOf _driver) in _pilotstypes) && !(getPlayerUID _driver in _clanmemberuids)) then { _driver action ["GETOUT", _vehicle]; hint "You are not trained to fly this type of Aircraft"; }; }; Sleep 1; }; Share this post Link to post Share on other sites
watarimono 0 Posted April 10, 2013 Thanks again, Now it works as it should on our server Share this post Link to post Share on other sites
bloodxgusher 10 Posted April 11, 2013 My bad. That's because in MP the player is only the local player. Change getPlayerUID player to getPlayerUID _driver aka _vehicle = _this select 0; _pilotstypes = ["B_Helipilot_F"]; _clanmemberuids = ["UID","UID","UID"]; _driver = objNull; while {damage _vehicle < 0.5} do { _driver = driver _vehicle; if (!isNull _driver) then { if (!((typeOf _driver) in _pilotstypes) && !(getPlayerUID _driver in _clanmemberuids)) then { _driver action ["GETOUT", _vehicle]; hint "You are not trained to fly this type of Aircraft"; }; }; Sleep 1; }; Does this only work for the specific vehicle or every vehicle placed down? Thanks Share this post Link to post Share on other sites
mindstorm 8 Posted April 11, 2013 The above one works for a specific vehile. This one would work for every vehicle but there might be a performance hit on the server depending on the ammount of vehicles on it (I did not test this script). place in init. PLAYER_MESSAGE = ""; if(isServer) then { [] spawn { _pilotstypes = ["B_Helipilot_F"]; _clanmemberuids = ["UID","UID","UID"]; while { true } do { { _vehicle = _x; _driver = objNull; _driver = driver _vehicle; if (!isNull _driver) then { if (!((typeOf _driver) in _pilotstypes) && !(getPlayerUID _driver in _clanmemberuids)) then { _driver action ["GETOUT", _vehicle]; PLAYER_MESSAGE "You are not trained to fly this type of Aircraft"; owner _driver publicVariableClient "PLAYER_MESSAGE"; }; }; } foreach vehicles; Sleep 1; }; }; }; if!(isDedicated) then { [] spawn { while { true} do { if !(PLAYER_MESSAGE == "") then { hint PLAYER_MESSAGE; PLAYER_MESSAGE = ""; } sleep 1; } }; }; Share this post Link to post Share on other sites
watarimono 0 Posted April 11, 2013 Somehow a few players were able to sneak past this script but I'm not sure how yet, going to look into it further. Share this post Link to post Share on other sites
killzone_kid 1331 Posted April 11, 2013 Somehow a few players were able to sneak past this script but I'm not sure how yet, going to look into it further. perhaps vehicle was damaged 0.5 and more? Share this post Link to post Share on other sites
hellstorm77 2 Posted April 13, 2013 is there away to Lock vehicles like you could in domi arma 2. If your admin you could go up to the vehicle and lock it so people couldn't use it? Share this post Link to post Share on other sites
fathersarge 46 Posted December 8, 2014 I realize this thread is about 1000 years old but I don't have the ability to post new threads at the moment and this is almost exactly what I need. I'm trying to lock down both the pilot and co-pilot seats so that only pilots can enter them using this script: //waitUntil {player == player}; _this spawn { while {true} do { if ((((driver vehicle player == player) && (_this select 5)) || ((gunner vehicle player == player) && (_this select 4)) || ((commander vehicle player == player) && (_this select 3))) && ((vehicle player in (_this select 0)) || (typeOf vehicle player in (_this select 0))) && !((typeOf player in (_this select 1)) || (player in (_this select 1)) || (getPlayerUID player in (_this select 1)))) then { moveOut player; cutText [_this select 2, "PLAIN"]; }; sleep 0.1; }; }; Source: http://www.armaholic.com/page.php?id=24366 I realize it doesn't work but I do not know why. My scripting skills are less than beginner and with armaholic seemingly offline for me at the moment I'm getting nowhere. Can anyone else me out? I've like this to work for all helicopters and allow anyone to get in as gunners or passengers, just not pilot or co-pilot. Any assistance at all would be awesome. Share this post Link to post Share on other sites
mariodu62 5 Posted December 10, 2014 Somehow a few players were able to sneak past this script but I'm not sure how yet, going to look into it further. it could be because the vehicle is local to the driver. or try this (working fine on my mission) : moveOut _driver; instead of : _driver action ["GETOUT", _vehicle]; Share this post Link to post Share on other sites