[Include] Traffic Lights - controllable traffic lights
#1

Traffic Lights v0.01


[*] Introduction
Hello guys, this is something I've been working during the past hours. I scripted this specially for my racing gamemode, to use it with the "Red Light" races. Would you like to know what a "Red Light" race is? Alright:
Quote:

Red Light races are one-on-one, point-to-point races starting at the nearest red light and ending at a point across town. After completing a Red Light race, players can choose to race back to the starting point.

[*] Video
Watch the video here.


[*] Download
Get it now from GitHub!

Currently only the YSI version is available, as I extracted this piece of code from my gamemode. Feel free to convert it to the ALS hooking method.


[*] Documentation
Here you have all the functions available, I think you don't need documentation for them at all since their names are clear enough.
Код:
CreateTrafficLight(type, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, init_color = TLC_GREEN)
SetTrafficLightColor(idx, color)
GetTrafficLightColor(idx)
DisableTrafficLight(idx)
RemoveTrafficLight(idx)
RemoveAllTrafficLights()
Colors available:
  • TLC_GREEN
  • TLC_AMBER
  • TLC_RED
You might define TL_USE_STREAMER before including this script if you wish to use dynamic objects, but keep in mind that Incognito's streamer requires YSF in order to make use of the attachable objects.


[*] Posts supported
These are all the posts supported currently, I hope I didn't miss any. All these custom objects are defined inside the include, maybe you want to check the SA-MP model ids used in order to avoid mixing them up with your own models.

TL_TYPE_1 (based on 1283)
TL_TYPE_2 (based on 1352)
TL_TYPE_3 (based on 3855)
TL_TYPE_4 (based on 1315)
TL_TYPE_5 (based on 3516)
TL_TYPE_6 (based on 1351)
TL_TYPE_7 (based on 1350)
TL_TYPE_8 (based on 1284)

[*] Bugs
Seems pedestrian traffic lights stopped working, I'm not really sure about why or how do they work. Probably the game handles them internally for specific model ids, I don't know. Feel free to collaborate if you think you can fix them.

On the other hand, I might say the same thing happend for posts type 3, 6 and 7; the upper light stopped working but I've added SA-MP light objects instead. You might check this on the video above, in my opinion the new light fits pretty well.


[*] Credits
Thanks to Southclaws and |stuntman| for some Discord productive conversations, to mschnitzer because I used his generator as script base for creating the amber light, and to prineside.com for providing the object images you can see above.


[*] Other
Thank you for reading my thread, if you want to support what I do you might buy me a coffe! Subscribe to my ******* channel if you wish to follow the development of my gamemode.

If you find any bug, please, let me know.

Best regards.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 6 Guest(s)