Could you try to use the original port.lua
file instead of the one ported to ESX and see if you get the GetFunds error when you restart the server?
fxmanifest.lua
fx_version "cerulean"
game "gta5"
lua54 "yes"
dependency "chat"
client_script "races_client.lua"
client_script {
'vehicle_names.lua'
}
shared_script '@es_extended/imports.lua'
server_scripts {
"races_server.lua",
"port.lua"
}
ui_page "html/index.html"
files {
"html/index.css",
"html/index.html",
"html/index.js",
"html/reset.css"
}```
port.lua
ESX = exports["es_extended"]:getSharedObject()
function GetFunds(source)
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer ~= nil then
return xPlayer.getMoney()
else
return -1
end
end
function SetFunds(source, amount)
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer ~= nil then
if amount < 0 then
xPlayer.setMoney(0)
else
xPlayer.setMoney(amount)
end
end
end
function Withdraw(source, amount)
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer ~= nil then
if xPlayer.getMoney() < amount then
xPlayer.setMoney(0)
else
xPlayer.removeMoney(amount)
end
end
end
function Deposit(source, amount)
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer ~= nil then
xPlayer.addMoney(amount)
end
end
function Remove(source)
-- do nothing
end
After changing port.lua to an unmodified version, there is no GetFunds error, but it does not collect information from ox-inventory about the amount of playerās money
Can you post what your server console displays during server startup? Do you see any errors during startup before the GetFunds error? Do you see any errors on the F8 client console?
FYI, the original port.lua
keeps track of its own version of money. It does not do anything with ESX, so you wouldnāt see any changes in money in ESX.
I found this in your log:
[ script:races] SCRIPT ERROR: @es_extended/imports.lua:1: No such export getSharedObject in resource es_extended
[ script:races] SCRIPT ERROR: @races/port.lua:33: No such export getSharedObject in resource es_extended
Thanks for the log by the way. It looks like there may be an issue with your ESX installation. There should be a getSharedObject export.
The error is because
ESX = exports["es_extended"]:getSharedObject()
in your port.lua
file fails to execute because your ESX does not have a getSharedObject export.
I donāt know how to help you with that, sorry.
I installed the latest version of es_extended and the error still appears
Iām guessing here. Your ESX server should have a \resources\[core]\es_extended\server\common.lua
file. In this file should be the following code:
exports("getSharedObject", function()
return ESX
end)
I believe this is where getSharedObject is exported. Maybe your ESX server does not have this?
Something weird is going on. Try making a vanilla ESX server with just my resource and see if you have the same problem. If not, there is something weird going on that I have no idea how to fix.
Iāll ask my developer friend if thereās anything he can do about it. When I find out what causes this error, I will let you know. Thanks so much for all your help.
No problem. I definitely would like to know whatās going on if your friend can figure out what the problem is.
Very useful video, thanks.
This script is great for No Props racing and AI, I love the flexability of the random races features, i may even start using it ago.
A few questions
1.Will your races ever support xml style tracks made with props?
2. Can i take the race results and best times etc and add it to a mysgl database, like I hvae here > https://randomraces.com/results/racing_list.php
3. Any plans to simplify the UI
I remember when You first started with this, it was very good then. It just gets better. Well done for your hard work and continued features etc.
Itās crazy how this is still being improved upon
Thanks for liking the scripts.
- I donāt know exactly what you mean. Do you mean making the track data into xml and using props like a stack of tires or a cone instead of checkpoints?
- I could probably create a CSV or JSON file with the results. Maybe have a field saying the racer is human or AI or a separate file for only human racers.
- What kind of simplifications are you thinking about?
- I mean Like community races, basically loading a map created already, then using your script for checkpoints within that track. I say xml as i use another script that using xml data and lua to race. > [H@mer][GameRoom] Racing (GTA:O Style) + Map Creator
Currently your script is pure racing around the map anywhere, with the function of adding checkpoints and creating a track. (Which is fine)
I can load tracks with a script, then add your checkpoints to that track, but then I would have to keep offloading the track.
basically what im saying is your script with any premade track.
-
That would be good if you could
-
I have always thought the UI was very complicated, could you not use Native UI Or Rage style Menu for UI. I also find it irritating because its always centered and obstructing most of screen, just my constructive thoughts.
- Supporting xml tracks with props looks like a huge amount of work(I might be wrong). Iām probably not going to support it any time soon. Also, what do you mean by āI would have to keep offloading the trackā?
- Iāll create a JSON file of the results in addition to the results_[name].txt file unless you donāt need the results_[name].txt file. I believe I created the results_[name].txt file at your request. If you only need the JSON file, Iāll get rid of results_[name].txt.
- Switching to Rage UI also looks like a big amount of work. One of my goals was not to depend on other resources(except chat). The aim of the UI is to support all possible chat commands, which does make it more complicated.