showing results for - "attempt to index a nil value 28global 27esx 27 29"
Alberto
24 Mar 2020
1ESX = nil
2local timer = nil
3local maksut = 0
4local saannit = 0
5
6TriggerEvent('esx:getSharedObject', function(obj) 
7  ESX = obj
8end)
9
10
11RegisterServerEvent('payforplayer2')
12AddEventHandler('payforplayer2',function(winnings)
13	
14	local _source = source
15	local xPlayer  = ESX.GetPlayerFromId(_source)
16	xPlayer.addMoney(winnings)
17end)
18
19RegisterServerEvent('playerpays2')
20AddEventHandler('playerpays2',function(bet)
21
22	local _source = source
23	local xPlayer  = ESX.GetPlayerFromId(_source)
24
25	if xPlayer.get('money') >= bet then
26		xPlayer.removeMoney(bet)
27		TriggerClientEvent('spinit2',_source)
28	else
29		TriggerClientEvent('errormessage2',_source)
30	end
31end)
similar questions