#error creating crew and user
1 messages ยท Page 1 of 1 (latest)
ESX
It's just a warning when using the command. Used to be problematic.
Or did it also not work?
but the chat shows an error of insufficient information
Is the input not correct?
If it works like you expect and you wanted to create a user with type racer and username pepe then you can ignore the printout.
It's not an error, it's just displaying your input and warning you to make sure it looks correct (many people don't read the readme or the command when using the command so I had to add it lol)
Aaaa okay I'll look at it
It comes out as if I don't have money when I do it with a username and when I make a crew it puts this on me but the profile does not appear on the tablet
That error is for creating a crew not a profile
and your inputs seem kinda weird for a crew also ๐
Exactly what command are you trying to use, and with what inputs are you using, paste it here
createracingcrew breixx 1 santos
or
createracinguser god 1 breixx
- createracingcrew don't take the source it takes citizenid. Yo can create your crew via the app if you got a user tho
- createracinguser god 1 breix looks correct. This is the one where you get a message saying you cant pay?
yes
someone on cfx mentioned that also. It might be an ESX issue with the conversion. I didn't do it and I don't know how ESX works ๐
It seems to be failing on doing this
local xPlayer = ESX.GetPlayerFromId(src)
if xPlayer.getAccount(moneyType).money >= cost then
return true
end
Is the Config.Options.MoneyType set to a value that ESX uses?
Where do I look at that in the config.lua
yes. It's a table called Config.Options, and near the bottom there's a MoneyType
if you search for "MoneyType" in Config.lua you'll find it easy
it seems to default to crypto
If you change it to Bank and it remains the same
Also when I approach this NPC I get this
Yes, you haven't changed to ox targets
as stated in the readme, esx requires ox target and ox lib
did you set it to bank or Bank because I think ESX might make a difference for that
I tried both and nothing
So with bank you just get an error saying you dont have the funds?
yes
And with cash the same
cash probably wont work on esx. It seems "cash" is "money" there?
This function gets details (returned in an table) for an account.
And, this might sound like a dumb question... but you do have the money right? hahaha
yes
Aha! I think I know
the removeMoney is done incorrectly
local xPlayer = ESX.GetPlayerFromId(src)
return xPlayer.removeAccountMoney(moneyType, math.floor(amount))
This only removes from bank accounts right? And it should take an account not the type of money
I have no idea how to find the correct "account" of a user tho
Where do I change this?
One sec i'll give you code to test
in server/functions.lua file, change out the function removeMoney for this
function removeMoney(src, moneyType, amount, reason)
if Config.Core == 'qb' then
local Player = QBCore.Functions.GetPlayer(src)
return Player.Functions.RemoveMoney(moneyType, math.floor(amount))
elseif Config.Core == 'esx' then
local xPlayer = ESX.GetPlayerFromId(src)
if canPay(src, 'money', amount) then
xPlayer.removeMoney(math.floor(amount))
return true
end
end
return false
end
Added a minor change incase you were fast ^
It will remove the cash you have only tho
I think?
It worked for me
Alright. Hmm. Guess it'll have to be a cash only for ESX then
๐
or how does "accounts" work with ESX?
xPlayer.removeAccountMoney(account, money)
For example with this, where would I get the account?
can it be a config option?
but it doesn't take money out of the bank
no
function removeMoney(src, moneyType, amount, reason)
if Config.Core == 'qb' then
local Player = QBCore.Functions.GetPlayer(src)
return Player.Functions.RemoveMoney(moneyType, math.floor(amount))
elseif Config.Core == 'esx' then
local xPlayer = ESX.GetPlayerFromId(src)
if canPay(src, moneyType, amount) then
xPlayer.removeAccountMoney(moneyType, math.floor(amount))
return true
end
end
return false
end
Try this
what is your MoneyType set to now?
bank
function removeMoney(src, moneyType, amount, reason)
if Config.Core == 'qb' then
local Player = QBCore.Functions.GetPlayer(src)
return Player.Functions.RemoveMoney(moneyType, math.floor(amount))
elseif Config.Core == 'esx' then
local xPlayer = ESX.GetPlayerFromId(src)
print('moneytype', moneyType)
print('amount', amount)
if canPay(src, moneyType, amount) then
xPlayer.removeAccountMoney(moneyType, math.floor(amount))
return true
end
end
return false
end
Try this
and check your server logs after
and doesn't open the tablet
AHA
found it
thanks
In server/main.lua file, at line 1699 there's a local tradeType
Change this block out to
local tradeType = {
moneyType = Config.Options.MoneyType,
racingUserCosts = {
racer = 0,
creator = 0,
master = 0,
god = 0
},
}
it was hard coded to use cash as moneytype
That already works but now the tablet doesn't go
Any error?
No mistake
Uh, not sure what you mean? Is there an issue still?
Yes, when I want to open the Racing GPS it doesn't open
Yeah and I asked you if you are seeing any errors?
Sorry, no error comes out
That's to bad. Not sure I can be of more help then. I need something to go on to debug the issue