Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jim-payments maybe bridge not working 100%? qb script to qbx #210

Closed
D3monkat opened this issue Oct 25, 2023 · 6 comments
Closed

jim-payments maybe bridge not working 100%? qb script to qbx #210

D3monkat opened this issue Oct 25, 2023 · 6 comments
Labels
bug Something isn't working need repro This bug report needs confirmation

Comments

@D3monkat
Copy link

Summary

bridge not working

Reproduction

when using jim-payments and using jim-catcafe or trying to use the cash register command it will throw an error when trying to locate nearest players.

Expected behavior

should pull the closest players and offer to charge the player

Actual behavior

error codes:
[ script:jim-payments] SCRIPT ERROR: @jim-payments/server/server.lua:246: attempt to index a nil value (local 'P')
[ script:jim-payments] > TriggerCallback (@qbx_core/bridge/qb/server/main.lua:81)
[ script:jim-payments] > handler (@qbx_core/bridge/qb/server/main.lua:43)
[ script:qbx_core] SCRIPT ERROR: error object is not a string

Additional context

No response

Last Updated

today

Custom Resources

jim-payments

Resource Rename

no

@D3monkat D3monkat added bug Something isn't working need repro This bug report needs confirmation labels Oct 25, 2023
@Manason
Copy link
Member

Manason commented Oct 25, 2023

Can you copy and paste the calling line? @jim-payments/server/server.lua:246

@CarlBishop
Copy link

local P = QBCore.Functions.GetPlayer(v) onlineList[#onlineList+1] = { value = tonumber(v), text = "["..v.."] - "..P.PlayerData.charinfo.firstname..' '..P.PlayerData.charinfo.lastname } end

@Manason
Copy link
Member

Manason commented Oct 26, 2023

local P = QBCore.Functions.GetPlayer(v) onlineList[#onlineList+1] = { value = tonumber(v), text = "["..v.."] - "..P.PlayerData.charinfo.firstname..' '..P.PlayerData.charinfo.lastname } end

What is the value of v? Could you print it or show additional preceding lines?

@CarlBishop
Copy link

CarlBishop commented Oct 26, 2023

I'm only helping, I cannot reproduce the issue since I guess it happens only when a player is billing another player and I do not have any server with players... so the original issue poster should reply.

By the way this is the server callback:

QBCore.Functions.CreateCallback('jim-payments:MakePlayerList', function(source, cb)
	local onlineList = {}
	for _, v in pairs(QBCore.Functions.GetPlayers()) do
		local P = QBCore.Functions.GetPlayer(v)
		onlineList[#onlineList+1] = { value = tonumber(v), text = "["..v.."] - "..P.PlayerData.charinfo.firstname..' '..P.PlayerData.charinfo.lastname  }
	end
	cb(onlineList)
end)

I guess the nil value is because there was no nearby player, because this code lack for check about nul value, it should contain:

	for _, v in pairs(QBCore.Functions.GetPlayers()) do
		local P = QBCore.Functions.GetPlayer(v)
		if P ~= nil then
			onlineList[#onlineList+1] = { value = tonumber(v), text = "["..v.."] - "..P.PlayerData.charinfo.firstname..' '..P.PlayerData.charinfo.lastname  }
		end
	end

@D3monkat
Copy link
Author

when i go to bill another player. that gets called but it throws the error above.

@Manason
Copy link
Member

Manason commented Oct 31, 2023

I suspect #215 should fix this. Can you pull latest commit and try again?

@Manason Manason closed this as completed Nov 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need repro This bug report needs confirmation
Projects
Status: Done
Development

No branches or pull requests

3 participants