Hi guys! Does anyone know why this export is always a different number ?

Serverside print(xPlayer)

image|339x19

isn’t xPlayer a table? That’s just the table hash, or whatever it’s called. Whenever anything inside the table changes, that table hash / id will change too.

Ah okay I see… Do you have any idea how I get the identifier of the owner of the requested vehicle ? !

I want to send a bill to the owner of the specific vehicle

you select “owner”, is it the owner identifier of the vehicle plate specified? If so, just get the identifier by result[1].owner

like this? Or how I get the identifier by result[1].owner?

local xPlayer = ESX.GetPlayerFromId(result[1].owner)

No like this:

local xPlayer = ESX.GetPlayerFromIdentifier(result[1].owner)

if xPlayer then
    -- If the player is connected
else
    -- else it means that he's not connected
end
1 Like

@ErwinAT_official solved?

Will try it on monday or sunday evening and give you feedback then :blush:

1 Like

Got no errors, but also no bill for this action… There is a Client-side event which triggers this server-event…

I guess, it does not find the “xPlayer” as a target to send the bill

image

RegisterServerEvent(‘esx_policejob:sendinvoice’)
AddEventHandler(‘esx_policejob:sendinvoice’, function(plate, summe, type)

MySQL.Async.fetchAll('SELECT owner FROM owned_vehicles WHERE plate = @plate', {
	['@plate'] = plate
}, function(result)

	local retrivedInfo = {
		plate = plate
	}

	if result[1] then
		local xPlayer = ESX.GetPlayerFromIdentifier(result[1].owner)
			if xPlayer then	

				TriggerServerEvent('esx_billing:sendBill', xPlayer, 'society_police', type, summe)
				print("Looks good! Owner:")
				print(xPlayer)
				
			end	
	else
		print("Does not work :(")
	end
end)

end)

print(json.enconde(xPlayer))

If you want to see what xPlayer contains use print(json.encode(xPlayer))

  • ~40 similar rows