Hello y’all
To celebrate the new tuners update, I decided to create a small-ish speed camera resource to test your new cars.
Dependencies:
- mysql-async — for the leaderboards functionality
- Lobby menu framework — for the leaderboards menu.
Features:
- Configurable speed camera name, coords and minimumSpeed. (minSpeed is calculated using GetEntitySpeed(), you will see why in a moment)
speedtraps = {
{name = "68th Devil", x = 880.364, y = 2698.003, z = 40.255, minSpeed = 10.0},
{name = "Sandy Driveby", x = 1212.397, y = 3536.227, z = 34.568, minSpeed = 22.35},
{name = "Tongva Valley Spy", x = -1511.871, y = 1445.777, z = 120.061, minSpeed = 22.35},
{name = "Paleto Problems", x = -110.463, y = 6266.835, z = 30.543, minSpeed = 22.35},
}
-
Scaleforms UI
-
Lobby-style “Speedboard” menu
-
Automatic location name.
– You will automatically see the location on the leaderboard…umm… SPEEDboard menu, based on the speed camera coords. -
Automatic measurement system calculation.
– The speed is automatically calculated based on the clients measurement system’s setting.
Downsides:
- I will most likely not update this script, unless I need to fix a bug.
- I kinda suggest re-writing the server part. Especially the everything related to database loading / saving, since I didn’t give much thought into it.
Adding a new speed camera:
Just add a new row in the speedtraps
table:
{name = "Camera Name", x = 0.0 --[[xCoord]], y = 0.0 --[[yCoord]], z = 0.0 --[[zCoord]], minSpeed = 10.0 --[[float. Is the speed that you get with GetEntitySpeed()]]},
Intercepting a “speeding violation” event:
“lslSpeedtrap.Got_A_Runner” event will trigger on the server-side whenever a client passes by the speed camera and exceeds the speeding limit.
AddEventHandler("lslSpeedtrap.Got_A_Runner", function(_trapid, _speed)
local src = source
--[[
source = player id
_trapid = speed camera id. First ID is 1!
_speed = GetEntitySpeed() of the player.
]]
end)
Get It!
- Github - https://github.com/CritteRo/lslSpeedtrap
- Tebex - Optional, Pay-what-you-want deal - https://crittero.tebex.io/package/4595260