#Payout error

1 messages · Page 1 of 1 (latest)

jolly spruce
#

Im getting this error SCRIPT ERROR: @cw-racingapp/server/main.lua:332: attempt to perform arithmetic on a nil value (field '?')
I have not changed anything to do with pay not sure why Im getting this error

local function giveSplit(src, racers, position, pot)
local total = 0
if (racers == 2 or racers == 1) and position == 1 then
total = pot
elseif racers == 3 and (position == 1 or position == 2) then
total = Config.Splits['three'][position] * pot
if UseDebug then print('Payout for ', position, total) end
elseif racers > 3 then
total = Config.Splits['more'][position] * pot
if UseDebug then print('Payout for ', position, total) end
else
if UseDebug then print('No one got a payout') end
end
if total > 0 then
if Config.Options.MoneyType == 'crypto' and Config.UseRenewedCrypto then
exports['qb-phone']:AddCrypto(src, Config.Options.cryptoType, math.floor(total))
TriggerClientEvent('cw-racingapp:client:notify', src,
Lang("participation_trophy_crypto") .. math.floor(total) .. ' ' .. Config.Options.cryptoType, 'success')
else
addMoney(src, Config.Options.MoneyType, math.floor(total))
end
end
end

Config.Splits = {
three = { [1] = 0.7, [2] = 0.3 }, -- If three racers
more = { [1] = 0.6, [2] = 0.3, [3] = 0.1 } -- If more than 3
}

#

Im also getting this for crews
SCRIPT ERROR: @cw-racingapp/server/crews.lua:165: attempt to concatenate a nil value (local 'crewName')

local function inviteToCrew(invitedBySource, invitedCitizenId, crewName)
local playerSrc = getSrcOfPlayerByCitizenId(invitedCitizenId)
if playerSrc ~= nil then
if getRacingCrewThatCitizenIDIsIn(invitedCitizenId) then
TriggerClientEvent('cw-racingapp:client:notify', invitedBySource, Lang("racer_already_in_crew"), 'error')
return false
end
if useDebug then print(invitedBySource, 'is inviting player to crew', playerSrc) end
ActiveInvites[invitedCitizenId] = { crewName = crewName, invitedBySource = invitedBySource }
TriggerClientEvent('cw-racingapp:client:notify', playerSrc, Lang("pending_crew_invite") .. ' ' .. crewName)
return true
else
return false
end
end

#

It seems like the crew is not being updated in the racer_names sql

stable yarrow
#

It seems to be claiming your position isn't included in the "more" table here

jolly spruce
stable yarrow
jolly spruce
#

Error I mean

stable yarrow
#

Ah ok, too bad. I can't really do much then 😅

jolly spruce
#

Every other time I did a crew it never gave an error just never adds the crew to the crew table in the racer_names table sql

#

Like it puts them in the racing crew sql just not the other one