[Release] StreetRaces - Multiplayer Races with Checkpoints, HUD and more [v1.00]

I dont get any Money when im done, if i win and Writing that command

2 Likes

Would be possible to add even already placed races?

Although this is really great one! Thank you for that. I will give you feedback later, when I will test this :slight_smile:

1 Like

Do you have to be near the road? I’ve replace the airport at the top with the drag strip, can’t seem to start a race there.

“No such command race.”

2 Likes

Did you implement the functions in the port_sv.lua file? You need to add the code for whatever framework you are using but it shouldn’t be much (e.g. ESX already has getMoney, addMoney and removeMoney functions :wink: )

I’m not quite sure what you mean by already placed races? Eventually I’d like to add the ability to save and load recorded checkpoints so that you can record a track and then race the same track over and over.

The checkpoints actually always use the nearest vehicle node to avoid weird checkpoint placement. The downside to that is some areas like the airfield don’t have path nodes but without that you sometimes get checkpoints that aren’t on the road (or above/below).

1 Like

For ESX users

ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)

-- Helper function for getting player money
function getMoney(source)
    local xPlayer = ESX.GetPlayerFromId(source)
    local getmoney = xPlayer.getMoney()
    return getmoney
end

-- Helper function for removing player money
function removeMoney(source, amount)
    local xPlayer = ESX.GetPlayerFromId(source)
    xPlayer.removeMoney(amount)
end

-- Helper function for adding player money
function addMoney(source, amount)
    local xPlayer = ESX.GetPlayerFromId(source)
    xPlayer.addMoney(amount)
end

9 Likes

Awesome release, only issue we found is that when creating checkpoints, it doesn’t seem to like dirt roads.

Tested with 30 players and work GREATTTT!!!. Thank you so much.!

Awesome release! tested with 12 players! In a future can you make a sistem for premade races? for maps like nürburgring spa etc…

1 Like

I released a new version with this fixed, you should be able to place checkpoints on all the roads and airports now :slight_smile:

That’s great news, thank you for the feedback!

Yes, I’m working on adding a system to save and load recorded checkpoints. With addon maps like Nurburgring it’s a bit tricky since they don’t include a minimap or path notes to place checkpoints but I’'m keeping it in mind and will see what can be done.

2 Likes

Love this script. Perfect for all uses, only issue i’ve noticed on my server is that when you click on the map whilst recording checkpoints, it does place them, however removes them visually on the map straight away so you can’t go back and remove them etc.

Minor bug but works fine for me other wise. Works perfect for ESX using Cosmo’s code posted above.

do we just copy pasta over everything in port lua? i must be missing something, everything else is fine except it wont let me press E to start the race,

No. Dont overwrite anything that isnt changed. Keep the functions for getName and notifyPlayer as is.

I tried that during all my tests, but i keep getting this, i’m not sure why it isnt removing money.

Paste your code here and I’ll see what’s wrong

ESX = nil
TriggerEvent(‘esx:getSharedObject’, function(obj) ESX = obj end)

– Helper function for getting player money
function getMoney(source)
local xPlayer = ESX.GetPlayerFromId(source)
local getmoney = xPlayer.getMoney()
return getmoney
end

– Helper function for removing player money
function getMoney(source)
local xPlayer = ESX.GetPlayerFromId(source)
local getmoney = xPlayer.getMoney()
return getmoney
end

– Helper function for adding player money
function getMoney(source)
local xPlayer = ESX.GetPlayerFromId(source)
local getmoney = xPlayer.getMoney()
return getmoney
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, “[RACE]”, {255,64,64}, msg)
end

when to do / race start 1500 10 no exposure nothing else

1 Like

All of your functions are getMoney.
You literally have no removeMoney, nor addMoney. Just use this (replace everything):

ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)

-- Helper function for getting player money
function getMoney(source)
    local xPlayer = ESX.GetPlayerFromId(source)
    local getmoney = xPlayer.getMoney()
    return getmoney
end

-- Helper function for removing player money
function removeMoney(source, amount)
    local xPlayer = ESX.GetPlayerFromId(source)
    xPlayer.removeMoney(amount)
end

-- Helper function for adding player money
function addMoney(source, amount)
    local xPlayer = ESX.GetPlayerFromId(source)
    xPlayer.addMoney(amount)
end

-- Helper function for getting player name
function getName(source)
    return GetPlayerName(source)
end

-- Helper function for notifying players
function notifyPlayer(source, msg)   
    TriggerClientEvent('chatMessage', source, "[RACE]", {255,64,64}, msg)
end
2 Likes

LOL derrrr, thank you so much, and i feel dumb now, haha. i’ve been staring at different scripts for a few hours now, my brain just did not see that.

i can’t creat a checkpoint on the map. please help me !!!