legion7698 0 Posted October 3, 2010 Hey All, I'm trying to setup a line to go into a vehicles init line that will check if a players in the vehicle and if so add the vehcile to an array. I've been trying all morning but due to there not being enough coffee and tobacco in my house to wake up I'm having difficulties. If anyone can help then that would be great. Thanks in advance. regards, LEGION7698. Share this post Link to post Share on other sites
ProfTournesol 956 Posted October 3, 2010 Hey All,I'm trying to setup a line to go into a vehicles init line that will check if a players in the vehicle and if so add the vehcile to an array. I've been trying all morning but due to there not being enough coffee and tobacco in my house to wake up I'm having difficulties. If anyone can help then that would be great. Thanks in advance. regards, LEGION7698. Well, you can do it this way with a trigger : put a trigger on the map, repeatable, with the following code in the condition line (instead of "this") : player in my_car considering you've named the vehicle "my_car". In the "on activation" line of the same trigger, write : my_array = my_array + [my_car] Attention, the array must be initialized somewhere before, in the player init line or the init.sqs script : my_array=[] Share this post Link to post Share on other sites
legion7698 0 Posted October 3, 2010 Hey ProfTournesol, That seems to of done the trick, kept trying to add a question mark for the player in my_car bit. Also is this MP friendly at all? Regards, LEGION7698. Share this post Link to post Share on other sites
SilverRanger 11 Posted October 5, 2010 as I understand it you want to use this for multiple vehicles. in that case, player in my_car will do the trick, but you will have to place a trigger for each vehicle you want this to work for a more efficient way would be to run a script like this #in @ vehicle player != player (this will check if the player is inside a vehicle) newVehicle = vehicle player (assign the player's vehicle to a variable) ? newVehicle in vehicleArray : goto "out" (check if it is already in the array) vehicleArray = vehicleArray + [newVehicle] (add the new vehicle in the array) #out @ vehicle player == player goto "in" (wait until the player leaves the vehicle and restart) this way, all you need to do is define an empty vehicleArray in init.sqs (or anywhere you want). depending on what you want to do, you can setup a single trigger or another script to activate once the vehicle you want is in the array, or even add it to this script before the #out part... Share this post Link to post Share on other sites
legion7698 0 Posted October 5, 2010 Hey SilverRanger, This would work even better, cheers for the help. Regards, LEGION7698. Share this post Link to post Share on other sites