people can noclip while racing
Having this as well, going to re-do the port_sv again see if it fixes. This is the error I get
@StreetRaces/port_sv.lua:3: in function 'getMoney'
@StreetRaces/races_sv.lua:90: in upvalue 'handler'
citizen:/scripting/lua/scheduler.lua:169: in function <citizen:/scripting/lua/scheduler.lua:168>
Error resuming coroutine: @StreetRaces/port_sv.lua:3: attempt to index a nil value (global 'ESX')
stack traceback:
EDIT:
This was whilst pressing āeā to join the created race, nothing would happen and that error would appear in the console
Looks nice, and I havenāt tried it yetā¦ Either way a concern that I have is with addon maps such as the Nuremberg track. You canāt do the entire track based off the pause menu map because there arenāt roads layed out with addon tracks. Iām hoping to use this in order to prevent racers from cutting corners. Due to the massive size itās impossible to watch all the drivers. Any who I have a few suggestions that would really make this an amazing resource.
1st, Make a way for a client to add a checkpoint on them self (like a circle around their position) by command or hotkey.
2nd, Allow for a single stop/start waypoint thatāll make the ability to run laps on a given course.
Iām not ātellingā you to do these things itās just some suggestions. Thanks!
awesome script!!! love it.
one suggestion i would have is:
a rallymode where the players can start after each other with a ~20 seconds delay and everybody from the same starting position.
also i think some nicer way of showing the time results instead of chat would be interesting, also your place while driving the race would be interesting
Also very useful would be a way, that the saved races are usable by everyone or better: SOME of the saved raced (eg. made by a gamemaster/admin)ā¦ any idea how to achieve that?
keep one, great script!
Iām trying to do this for VRPEX but itās not working.
local Tunnel = module("vrp", "lib/Tunnel")
local Proxy = module("vrp", "lib/Proxy")
vRP = Proxy.getInterface("vRP")
vRPclient = Tunnel.getInterface("vRP")
-- Helper function for getting player money
function getMoney(source)
-- Add framework API's here (return large number by default)
local user_id = vRP.getUserID(source)
local money = vRP.getMoney(user_id)
return money
end
-- Helper function for removing player money
function removeMoney(source, amount)
-- Add framework API's here
local user_id = vRP.getUserID(source)
vRP.tryFullPayment(user_id,amount)
end
-- Helper function for adding player money
function addMoney(source, amount)
local user_id = vRP.getUserID(source)
vRP.giveMoney(user_id,amount)
-- Add framework API's here
end
-- Helper function for getting player name
function getName(source)
-- Add framework API's here
return GetPlayerName(source)
end
-- Helper function for notifying players
function notifyPlayer(source, msg)
-- Add custom notification here (use chat by default)
TriggerClientEvent('chatMessage', source, "[StreetRaces]", {255, 0, 0}, msg)
end
-- Saved player data and file
local playersData = nil
local playersDataFile = "./StreetRaces_saveData.txt"
-- Helper function for loading saved player data
function loadPlayerData(source)
-- Load data from file if not already initialized
if playersData == nil then
playersData = {}
local file = io.open(playersDataFile, "r")
if file then
local contents = file:read("*a")
playersData = json.decode(contents);
io.close(file)
end
end
-- Get player steamID from source and use as key to get player data
local playerId = string.sub(GetPlayerIdentifier(source, 0), 7, -1)
local playerData = playersData[playerId]
-- Return saved player data
if playerData == nil then
playerData = {}
end
return playerData
end
-- Helper function for saving player data
function savePlayerData(source, data)
-- Load data from file if not already initialized
if playersData == nil then
playersData = {}
local file = io.open(playersDataFile, "r")
if file then
local contents = file:read("*a")
playersData = json.decode(contents);
io.close(file)
end
end
-- Get player steamID from source and use as key to save player data
local playerId = string.sub(GetPlayerIdentifier(source, 0), 7, -1)
playersData[playerId] = data
-- Save file
local file = io.open(playersDataFile, "w+")
if file then
local contents = json.encode(playersData)
file:write(contents)
io.close(file)
end
end
attempt to call a nil value (global āgetMoneyā)
You need to add {} berfore () example you did vRP.tryFullPayment(user_id,amount) it needs to be vRP.tryFullPayment({user_id,amount}) and so on so on for all the vrp functions
Only when outside the main framework. If you modify the framework files you should not do that.
Well i changed it to vrp and the only worked when i did {}
when using this, we have to save the race ? is there any way to set 1 random waypoint and start the race ?
if u wanna use waypoint just set a waypoint at /race start money time
Strixx1 appreciate your suggestion but it didnāt work for me. Can you help me only with port.lua?
Love your script, nice work man, congrats! . It works perfectly, iĀ“m using it on ESX. For those that are asking how to make it work on esx [Release] StreetRaces - Multiplayer Races with Checkpoints, HUD and more [v1.00] @CosmoKramer posted it.
Hi I got this error when trying to press E to join the race
SCRIPT ERROR: @streetraces/port_sv.lua:6: attempt to index a nil value (global āESXā)
handler (@streetraces/races_sv.lua:90)
port_sv.lua is exactly the one CosmosKramer provided for Maple later on
Thanks
I have problem please i need help
when i write ( race start 500 15 )
I created race with race record but when i start it no thing
error is :
System.InvalidOperationException: Only extension types 10/11 (Citizen funcref) a
re handled by this class.
at CitizenFX.Core.MsgPackDeserializer.UnpackExt (System.IO.BinaryReader reader
, System.Int32 length) [0x00030] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\clien
t\clrcore\MsgPackDeserializer.cs:357
at CitizenFX.Core.MsgPackDeserializer.UnpackExt8 (System.Byte a, System.IO.Bin
aryReader reader) [0x00007] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clr
core\MsgPackDeserializer.cs:316
at CitizenFX.Core.MsgPackDeserializer.UnpackAny (System.IO.BinaryReader reader
) [0x0000f] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clrcore\MsgPackDese
rializer.cs:32
at CitizenFX.Core.MsgPackDeserializer.UnpackArray (System.IO.BinaryReader read
er, System.Int32 length) [0x0000a] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\cli
ent\clrcore\MsgPackDeserializer.cs:56
at CitizenFX.Core.MsgPackDeserializer.UnpackFixArray (System.Byte a, System.IO
.BinaryReader reader) [0x00005] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client
\clrcore\MsgPackDeserializer.cs:217
at CitizenFX.Core.MsgPackDeserializer.UnpackAny (System.IO.BinaryReader reader
) [0x0000f] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clrcore\MsgPackDese
rializer.cs:32
at CitizenFX.Core.MsgPackDeserializer.Deserialize (System.Byte[] data, System.
String netSource) [0x0001b] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clr
core\MsgPackDeserializer.cs:24
at CitizenFX.Core.InternalManager.TriggerEvent (System.String eventName, Syste
m.Byte[] argsSerialized, System.String sourceString) [0x00021] in C:\gl\builds\4
ff63adb\0\cfx\fivem\code\client\clrcore\InternalManager.cs:194
System.InvalidOperationException: Only extension types 10/11 (Citizen funcref) a
re handled by this class.
at CitizenFX.Core.MsgPackDeserializer.UnpackExt (System.IO.BinaryReader reader
, System.Int32 length) [0x00030] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\clien
t\clrcore\MsgPackDeserializer.cs:357
at CitizenFX.Core.MsgPackDeserializer.UnpackExt8 (System.Byte a, System.IO.Bin
aryReader reader) [0x00007] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clr
core\MsgPackDeserializer.cs:316
at CitizenFX.Core.MsgPackDeserializer.UnpackAny (System.IO.BinaryReader reader
) [0x0000f] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clrcore\MsgPackDese
rializer.cs:32
at CitizenFX.Core.MsgPackDeserializer.UnpackArray (System.IO.BinaryReader read
er, System.Int32 length) [0x0000a] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\cli
ent\clrcore\MsgPackDeserializer.cs:56
at CitizenFX.Core.MsgPackDeserializer.UnpackFixArray (System.Byte a, System.IO
.BinaryReader reader) [0x00005] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client
\clrcore\MsgPackDeserializer.cs:217
at CitizenFX.Core.MsgPackDeserializer.UnpackAny (System.IO.BinaryReader reader
) [0x0000f] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clrcore\MsgPackDese
rializer.cs:32
at CitizenFX.Core.MsgPackDeserializer.Deserialize (System.Byte[] data, System.
String netSource) [0x0001b] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clr
core\MsgPackDeserializer.cs:24
at CitizenFX.Core.InternalManager.TriggerEvent (System.String eventName, Syste
m.Byte[] argsSerialized, System.String sourceString) [0x00021] in C:\gl\builds\4
ff63adb\0\cfx\fivem\code\client\clrcore\InternalManager.cs:194
System.InvalidOperationException: Only extension types 10/11 (Citizen funcref) a
re handled by this class.
at CitizenFX.Core.MsgPackDeserializer.UnpackExt (System.IO.BinaryReader reader
, System.Int32 length) [0x00030] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\clien
t\clrcore\MsgPackDeserializer.cs:357
at CitizenFX.Core.MsgPackDeserializer.UnpackExt8 (System.Byte a, System.IO.Bin
aryReader reader) [0x00007] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clr
core\MsgPackDeserializer.cs:316
at CitizenFX.Core.MsgPackDeserializer.UnpackAny (System.IO.BinaryReader reader
) [0x0000f] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clrcore\MsgPackDese
rializer.cs:32
at CitizenFX.Core.MsgPackDeserializer.UnpackArray (System.IO.BinaryReader read
er, System.Int32 length) [0x0000a] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\cli
ent\clrcore\MsgPackDeserializer.cs:56
at CitizenFX.Core.MsgPackDeserializer.UnpackFixArray (System.Byte a, System.IO
.BinaryReader reader) [0x00005] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client
\clrcore\MsgPackDeserializer.cs:217
at CitizenFX.Core.MsgPackDeserializer.UnpackAny (System.IO.BinaryReader reader
) [0x0000f] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clrcore\MsgPackDese
rializer.cs:32
at CitizenFX.Core.MsgPackDeserializer.Deserialize (System.Byte[] data, System.
String netSource) [0x0001b] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clr
core\MsgPackDeserializer.cs:24
at CitizenFX.Core.InternalManager.TriggerEvent (System.String eventName, Syste
m.Byte[] argsSerialized, System.String sourceString) [0x00021] in C:\gl\builds\4
ff63adb\0\cfx\fivem\code\client\clrcore\InternalManager.cs:194
hitch warning: frame time of 230 milliseconds
Sending heartbeat to live-internal.fivem.net:30110
please i need help
Having issues getting it to work on the live server
Tried it on the test server and it worked flawlessly
Once transferred to the live server you can attempt to start the race but once the prompt comes up to press E to Join nothing happens
Will Onesync affect this
Any help is appreciate thanks
no thing happen when put /start race 500 15
press E to Join not show
there fix ?
try
/race start 500 15
instead
I finally had a chance to play with this, and it works great in testingā¦ now to get a couple more people on the test server and make sure it all syncs.
A couple of things that I donāt currently know how to do but might be helpfulā¦
Can you set something similar to the finish-line object at the starting line so people can very clearly see they are in the right place (yes, I know thereās a yellow line telling them exactly where to go). Also, if there could be a countdown timer to the race start that follows the player rather than hanging in space where they joined the race that would be cool. Neither is obviously a big deal, but, just in case you were looking for things to add inā¦
Thanks for the fun resource. Thanks also to @CosmoKramer for the ESX code blocks.
When players in my server start a race with 50k bet, they donāt lose any money and the winner doesnāt get the money.
are you using ESX? If so, there is some modification required: