mattxr 9 Posted August 27, 2007 Ok i have this arry of player names and what i want is i want to stop anyone who wasnt in that list to get kicked out of the helicopers.. Init.sqs Quote[/b] ]gol_rf = ["-{GOL}-Mattius","-{GOL}-","-{GOL}-Rayven","-{GOL}-DAV1D","-{GOL}-Bunnehrawr","-{GOL}-Shadow","-{GOL}-Balder" ,"-{GOL}-CopiousLight","-{GOL}-Somerville","-{GOL}-JasonO",& quot;-{GOL}-ProPilot","-{GOL}-Unknown","-{GOL}-Simon","-{GOL }-Omar","-{GOL}-Weaner","-{GOL}-Mavvv","-{GOL}-Quadro", "-{GOL}-Lt.Chris"]; Trigger Condition Quote[/b] ]!isNull driver ah1a Trigger Activation Quote[/b] ]if !(name player in gol_Rf) then {driver ah1a action["Eject",ah1a];hint 'Only -{GOL}- can fly the Attack choppers'}; Although this kicks everyone out, and it kicks the players who have names in the array out also but without the hint. Is there any way to make it so it doesnt kick the players with the names in that array out? Please help. Share this post Link to post Share on other sites
the unknown 0 Posted August 27, 2007 Well I do know this works to get the player name and only let that player use it but other wise i got no clue on how to help. Credits go to crashdome since it had his name in it i guesed he put it in the script. ? (name vehicle player == "-{GOL}-The Unknown"): P.S. you forgot The infront of unknown P.P.S. have you checked the BAS frame work you might find some info in there they have a boot out of vehicle ting in it. Share this post Link to post Share on other sites
norrin 9 Posted August 28, 2007 I've got a feeling I've tried something similar in the past and found I could not use "not" with "in" (ie. !in) so I had to turn the code around another way. Maybe try something like <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> if (name player in gol_Rf) then {sleep 0.5} else {driver ah1a action["Eject",ah1a];hint 'Only -{GOL}- can fly the Attack choppers'}; Share this post Link to post Share on other sites
UNN 0 Posted August 28, 2007 The eject action is a global command. Anyone will be ejected, as long as there is one person playing, that isn't in the list. Something like this will do: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">If !(Name (Driver ah1a) in gol_rf) Then {If (Local (Driver ah1a)) Then {(Driver ah1a) Action ["Eject",ah1a]; Hint "Only -{GOL}- can fly the Attack choppers"}} That should be enough Share this post Link to post Share on other sites
Synide 0 Posted August 28, 2007 i know people will disagree... if it was me... * I wouldn't use a trigger... triggers get checked every .5 seconds to see if there conditions are met... it's a waste in this instance... * attach a event handler to the chopper for the 'getin' event and have this event run your checking sqf script. Â with the guts specified as per UNN's post... Â as you can't swap from passenger to driver in a AH1 there's no worries about people getting in the gunners seat then swapping to the driver's seat... doing it this way means the 'checking' script will only ever be called when someone tries to get in the AH... better than a trigger constantly checking to see if the condition is met... the bonus doing it this way is the script that will be fired by the 'getin' event will recieve the vehicle being boarded, the seat being entered and the player unit that is trying to getin... NB. each time the chopper is respawned (assuming you are doing vehicle respawn) you have to reattach the 'getin' EH. Share this post Link to post Share on other sites
mattxr 9 Posted August 28, 2007 Could you help me do this EH as im not that good with them. Thanks for all the replys. Share this post Link to post Share on other sites
Synide 0 Posted August 28, 2007 i'm just off too work... i'll post an example mission link for you when i get home... Share this post Link to post Share on other sites
UNN 0 Posted August 28, 2007 The event handler version would look like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">aha1 AddEventhandler ["getin",{_This ExecVM "TeamCrew.sqf"}] TeamCrew.sqf: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Vehicle=_This Select 0; _CrewPos=_This Select 1; _Unit=_This Select 2; If (Local _Unit) Then     {     If !((Name _Unit) in gol_Rf) Then         {         _Unit Action ["Eject",_Vehicle];         Hint "Only -{GOL}- can fly the Attack choppers";         };     }; Quote[/b] ]i know people will disagree... Not sure who would disagree? Each person has there prefered method. But they both work, so there isn't much to argue over. Myself, I tend to go for event handlers over triggers, but thats probably down to my background. Although I'm begining to see some advatages in using triggers for MP. For example, the above event handler version will not support respawns on it's own. You are going to have to re-attach the handler yourself if the chopper is respawned. With triggers you don't have to worry about such things. Triggers do have the potential to take up more resources, but in this case, I doubt such a trigger will cause you any problems. Share this post Link to post Share on other sites
Synide 0 Posted August 29, 2007 thanks UNN, just got home and this is off my 'todo' list... cool. yeah, my 'rule of thumb' is... try and use events as much as possible... and use triggers only when necessary and/or it makes no difference or the trigger is more efficient. Share this post Link to post Share on other sites