Efficient Vehicle Looping
#21

An easy way to do this is the following, no need for loops or anything:

* Create an area and attach it to the vehicle.
* Set the streamer item EXTRA_ID value to the vehicle id.
* Detect OnPlayerEnterDynamicArea and obtain the EXTRA_ID value from the area id (that would be the vehicle id).
* Create some array or some variable and assign the vehicle ID to it. (Something like PlayerClosestVehicle)
* Detect OnPlayerLeaveDynamicArea, detect if its a vehicle area and remove it from the variable/array you created previously.


However, you would need Incognito's Streamer functions to achieve this.

I currently use this method for everything, and I don't face any lag or RAM usage problems. (If you need an example code for it PM me, I'm not home right now).
Reply
#22

Quote:
Originally Posted by Marricio
Посмотреть сообщение
An easy way to do this is the following, no need for loops or anything:

* Create an area and attach it to the vehicle.
* Set the streamer item EXTRA_ID value to the vehicle id.
* Detect OnPlayerEnterDynamicArea and obtain the EXTRA_ID value from the area id (that would be the vehicle id).
* Create some array or some variable and assign the vehicle ID to it. (Something like PlayerClosestVehicle)
* Detect OnPlayerLeaveDynamicArea, detect if its a vehicle area and remove it from the variable/array you created previously.


However, you would need Incognito's Streamer functions to achieve this.

I currently use this method for everything, and I don't face any lag or RAM usage problems. (If you need an example code for it PM me, I'm not home right now).
That is the best way let the streamer do the work by utilizing the EXTRA_ID you have an instant reference of the vehicle id.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)