[Release] KGV-Blackjack

really in need of an essentialmode version, what can i do?

to anyone using essentialmode without esx, download the esx module and replace the code with this
it worked for me

function SetExports()
    exports["kgv-blackjack"]:SetGetChipsCallback(function(source)
        local cash = 0
		TriggerEvent('es:getPlayerFromId', source, function(user)
			if user ~= nil then
				cash = user.getMoney()
			end
		end)
		return cash or 0
    end)

    exports["kgv-blackjack"]:SetTakeChipsCallback(function(source, amount)
        TriggerEvent('es:getPlayerFromId', source, function(user)
			if user ~= nil then
				user.removeMoney(amount)
			end
		end)
    end)

    exports["kgv-blackjack"]:SetGiveChipsCallback(function(source, amount)
        TriggerEvent('es:getPlayerFromId', source, function(user)
			if user ~= nil then
				user.addMoney(amount)
			end
		end)
    end)
end

AddEventHandler("onResourceStart", function(resourceName)
	if ("kgv-blackjack" == resourceName) then
        Citizen.Wait(1000)
        SetExports()
    end
end)

SetExports()
1 Like

This is not working with esx. when i try to play it says this
homo

did you download the esx module?

i am having a lot of fun with this. now all there is needed is poker.

heyo, is it possible to get it working with this money resource?

atm when i sit down at the tables it tells me i dont have enough money to place a bet :frowning:

am pretty sucky at coding so if anyone can tell me how to get it working i would appreciate it :upside_down_face:

It is. You just need to setup the callbacks (in a server script) in your money resource.

exports["kgv-blackjack"]:SetGetChipsCallback(function(source)
		return 0 -- [[ return money ]]
	end)

	exports["kgv-blackjack"]:SetTakeChipsCallback(function(source, amount)
		--[[ money = money - amount? ]]
	end)

	exports["kgv-blackjack"]:SetGiveChipsCallback(function(source, amount)
		--[[ money = money + amount? ]]
	end)

Inside SetGetChipsCallback function, you have to get the players money (cash or bank, depending on what you want to play with.) and return them in return

The other 2, are self-explanatory. Those functions get called whenever a player needs to lose / gain money, and the amount.

Now, the resource that you showed is kinda bad, because it doesn’t seem to save a player’s cash anywhere on the server, so you will have to do a bit of coding to modify that.

hokay thanks man, i kinda understand :laughing:
i’ve always focused more on modelling, coding is beyond me :v:

ill have a play and do some searching see if i can better make sense of it tho.

i think that money resource is being altered atm to be server side and include mysql so i might be better waiting a lil bit anyway, so by time i do understand it might be easier to implement :crossed_fingers:

drag&dropped and it worked, curious how simple is it to switch out the money for chips? on esx? just trying to verify before i break it lol

punching a dealer with a stickybomb or any grenade allows them to stay on the ground for much longer than just punching them normally. standing on them while they are on the ground will kill them eventually. luckily, you can still play games, only without a dealer. the cards will suddenly appear and disappear on the blackjack table. no dealer revival, no teleportation.

STOP BULLY LEAVE THEM ALONE
whaaa

1 Like

I am using QB Core and I am getting the whole not enough money to bet, everything else is spot on, anyone know how to work around this, I am horrible with coding lol…

you need to use the callbacks.

Yeah I understand that part just, I am still learning and I am not sure where to put this and if I need to make any edits to this code, I noticed KGV server lua has this and when I remove the dashes and stuff the script stops working, excuse my dumb ass lol…

@AspireCity How do I connect my Cfx.re account to the game. I cant connect to any of the serverx.

I’m not sure exactly where to put this. I am struggling to find where my money resource is. I am using the default qbcore framework. Having the same issue where I sit down at the table and can’t bet any money despite having cash and bank. Could you help further with this issue please?

Can i use this at my Vrp server if i want to? Or do i have to write it from ESX to VRP

write it from esx to vrp (if by that you mean changing the code of the esx extension to use vrp functions)
i got it working with vanilla essentialmode

Does anyone know how to get it to work with casino chips?

Anyone know where I put the files in qbcore to get the black jack to work in the casino?