Price
UnknownA script by CritteR
Price
UnknownHeyo 
CritteR’s Impromptu Races is a simple 1 vs. 1 racing resource that aims to provide an easy environment for players to challenge their driving skills! Simply add a waypoint where you want to end the race, challenge a player (with money or not), and start racing!
resources folder.public/server_connection.lua and public/client_connection.lua files.public/client_pracing_public_ui.lua and public/client_pracing_public_menu.lua files.public/sh_utils.lua file./race [source / player name] (entry bet) by default (command name is editable in sh_utils.lua)Below you can see the hooks that you can use to monitor the races outside of the resource. Those events are server-side only.
AddEventHandler('crit_ImpromptuRaces:RaceInitiated', function(data)
--Event triggered when a player challenges another player to a race.
--[[
data = {
type = "raceInitiated",
raceid = id of the race. starts at 1 every time the resource starts.
endPoint = vector3, coordonates of the finish line
startPoint = vector3, coordonates of the start line
initiator = source of the player that started the race
opponent = source of the player that responded to the race
prize = prize of the race. this is the combined bet money for the two players.
timestamp = os.time() from when the race was initiated.
}
]]
end)
AddEventHandler('crit_ImpromptuRaces:RaceRejected', function(data)
--Event triggered when a player rejects a race challenge.
--[[
data = {
type = "raceRejected",
raceid = id of the race. starts at 1 every time the resource starts.
endPoint = vector3, coordonates of the finish line
startPoint = vector3, coordonates of the start line
initiator = source of the player that started the race
opponent = source of the player that responded to the race
prize = prize of the race. this is the combined bet money for the two players.
timestamp = os.time() from when the race was rejected.
}
]]
end)
AddEventHandler('crit_ImpromptuRaces:RaceAborted', function(data)
--Event triggered when a player aborts a race challenge. Either by canceling it, dying or disconnecting.
--[[
data = {
type = "raceAborted",
raceid = id of the race. starts at 1 every time the resource starts.
endPoint = vector3, coordonates of the finish line
startPoint = vector3, coordonates of the start line
initiator = source of the player that started the race
opponent = source of the player that responded to the race
prize = prize of the race. this is the combined bet money for the two players.
timestamp = os.time() from when the race was aborted.
}
]]
end)
AddEventHandler('crit_ImpromptuRaces:RaceStarted', function(data)
--Event triggered when a player accepts a race challenge, and starts the race.
--[[
data = {
type = "raceStarted",
raceid = id of the race. starts at 1 every time the resource starts.
endPoint = vector3, coordonates of the finish line
startPoint = vector3, coordonates of the start line
initiator = source of the player that started the race
opponent = source of the player that responded to the race
prize = prize of the race. this is the combined bet money for the two players.
timestamp = os.time() from when the race was started. (after the countdown)
}
]]
end)
AddEventHandler('crit_ImpromptuRaces:RaceFinished', function(data)
--Event triggered when a race is finished. Meaning that someone won.
--[[
data = {
type = "raceFinish",
raceid = id of the race. starts at 1 every time the resource starts.
endPoint = vector3, coordonates of the finish line
startPoint = vector3, coordonates of the start line
initiator = source of the player that started the race
opponent = source of the player that responded to the race
prize = prize of the race. this is the combined bet money for the two players.
timestamp = os.time() from when the race finished.
raceTimeMs = how much time it took for the winner to ... win. In miliseconds.
raceTimeString = same as raceTimeMs, but in a more readable format. h m s .ms
}
]]
end)
All of the UI, all text strings, the command name, and all the functions needed for you to connect this to your framework. Other parts of the code can be opened on request. The resource also has a couple of hooks that allows you to see every race that is initiated, accepted, rejected, aborted and finished.
Server-side race logic, blips and checkpoints, and the client-side race logic.
Feel free to reach out to me on the forums, or through Tebex if you need any help, or have any issues with the script. I will gladly explain to you what to change in order to connect this resource to your server, but I cannot tell you how exactly to connect it to your framework, as I don’t use them.
| Code is accessible | UI and hooks yes, the race logic is escrowed. |
| Subscription-based | No |
| Lines (approximately) | ~500 lines locked / ~500 unlocked |
| Requirements | A framework / money resource if you want to use the entry fee feature |
| Support | Yes |
See what others are saying about this script.
Share your experience and help others.