#error creating crew and user

1 messages ยท Page 1 of 1 (latest)

long sinew
long sinew
#

ESX

opaque pier
#

It's just a warning when using the command. Used to be problematic.

Or did it also not work?

long sinew
opaque pier
#

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)

long sinew
#

Aaaa okay I'll look at it

long sinew
opaque pier
#

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

long sinew
opaque pier
#
  1. createracingcrew don't take the source it takes citizenid. Yo can create your crew via the app if you got a user tho
#
  1. createracinguser god 1 breix looks correct. This is the one where you get a message saying you cant pay?
opaque pier
#

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?

long sinew
opaque pier
#

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

long sinew
#

Also when I approach this NPC I get this

opaque pier
#

Yes, you haven't changed to ox targets

#

as stated in the readme, esx requires ox target and ox lib

opaque pier
opaque pier
#

So with bank you just get an error saying you dont have the funds?

long sinew
#

yes

long sinew
opaque pier
#

cash probably wont work on esx. It seems "cash" is "money" there?

opaque pier
# long sinew yes

And, this might sound like a dumb question... but you do have the money right? hahaha

opaque pier
#

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

long sinew
opaque pier
#

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?

long sinew
#

It worked for me

opaque pier
#

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?

long sinew
#

but it doesn't take money out of the bank

opaque pier
#

No it should be taking money from your pockets

#

cash

#

right?

long sinew
#

no

opaque pier
#
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

long sinew
opaque pier
#

what is your MoneyType set to now?

long sinew
#

bank

opaque pier
#
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

long sinew
#

and doesn't open the tablet

opaque pier
#

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

long sinew
#

That already works but now the tablet doesn't go

opaque pier
#

Any error?

long sinew
#

No mistake

opaque pier
#

Uh, not sure what you mean? Is there an issue still?

long sinew
#

Yes, when I want to open the Racing GPS it doesn't open

opaque pier
#

Yeah and I asked you if you are seeing any errors?

long sinew
#

Sorry, no error comes out

opaque pier
#

That's to bad. Not sure I can be of more help then. I need something to go on to debug the issue