[FREE][STANDALONE] Speed Traps! - NFS Most Wanted-style speed cameras

Hello y’all :wave:

To celebrate the new tuners update, I decided to create a small-ish speed camera resource to test your new cars.


Dependencies:


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},
}

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!

12 Likes

that’s really a dope menu ,also you can use gif to replace that texture .
now i’m using it everywhere lmao
appreciate for your contribute : )

1 Like

Awesome, and thanks for not slapping it a ridiculous pricetag.

2 Likes

another epic release

1 Like

epic release, good to see some nice standalone free resources

1 Like

Glad you like it!

Its posible not add the dependences? because i only want the speedcam with the money

Yup. Totally possible. Just remove the depency lines from fxmanifest.lua:

dependencies {
    'mysql-async',
    'critLobby'
}

cl_speedtrap_menu.lua deals with everything related to the menu. So that can be removed too.

On the server-side, pretty much everything is related to mysql-async, so if you don’t want that, again, you can just delete them.

if i do that only recieve the invoice right?

invoice?
If you do that, you will have the "lslSpeedtrap.Got_A_Runner" server event triggering everytime a player will go over the speed limit of that speedcam.

how do we open the leaderboard menu?

How do we open the leaderboard menu? I know its /speedboard for the info but what’s the command for the leaderboard?

Every speedcam has a different leaderboard. You need to use /speedboard and then select any speedcam on the left side.

If there are any speeds recorded, it will show up there.

When I press enter nothing happens ad I just go back in game.

I am getting this error:
[ script:mysql-async] [ERROR] [MySQL] An error happens on MySQL for query “SELECT * FROM speedtrapLB WHERE trapid=‘1’ ORDER BY speed DESC {=}”: Access denied for user ‘root’@‘localhost’ (using password: YES)

1 Like

You’re not connected to the database properly.

Could not find dependency critLobby for resource lslSpeedtrap?

Make sure you have all the dependency resources running on your server:

I get a error with MySQL for this: [lslSpeedtrap] An error happens for query “SELECT COUNT(name) AS 'count” FROM ‘speedtrapLB’ WHERE ‘name’ = ? AND ‘trapid’ = ? : [“Comrad Elmo”,1"] ER_NO_SUCH_TABLE : Table ‘framework.speedtraplb’ doesn’t exist

1 Like

Make sure to add the speedtrab table in your SQL db. You can find the table in the github folder.

this is what it is without pressing ‘Go’: