Answers for "attempt to index a nil value (global 'esx')"

0

attempt to index a nil value (global 'esx')

attempt to compare number with nil
Posted by: Guest on May-26-2021
0

attempt to index a nil value (global 'esx')

ESX = nil
local timer = nil
local maksut = 0
local saannit = 0

TriggerEvent('esx:getSharedObject', function(obj) 
  ESX = obj
end)


RegisterServerEvent('payforplayer2')
AddEventHandler('payforplayer2',function(winnings)
	
	local _source = source
	local xPlayer  = ESX.GetPlayerFromId(_source)
	xPlayer.addMoney(winnings)
end)

RegisterServerEvent('playerpays2')
AddEventHandler('playerpays2',function(bet)

	local _source = source
	local xPlayer  = ESX.GetPlayerFromId(_source)

	if xPlayer.get('money') >= bet then
		xPlayer.removeMoney(bet)
		TriggerClientEvent('spinit2',_source)
	else
		TriggerClientEvent('errormessage2',_source)
	end
end)
Posted by: Guest on May-10-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language