[Release] Diamond Casino Blackjack

This is awesome man! yesterday we had so much fun playing! works perfectly with very few lines of code with ESX!
Thanks a lot!

2 Likes

how did you get it to work with esx?

1 Like

plz help me How to work with ESX

ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
function tryTakeChips(source,amount)
	local xPlayer = ESX.GetPlayerFromId(source)
	local item = xPlayer.getInventoryItem('khethimaRP_casino_token').count
		if item >= amount then
			xPlayer.removeInventoryItem('khethimaRP_casino_token',amount)
			return true
		else 
			TriggerClientEvent('esx:showNotification', source, 'You dont have enough tokens')
			return false --you dont actually need to return false, since default is false but anw. I like this way
		end
end
function giveChips(source,amount)
    local xPlayer = ESX.GetPlayerFromId(source)
	xPlayer.addInventoryItem('khethimaRP_casino_token', amount)
end

Just make sure you create a new item (e.g. khethimaRP_casino_token) in your database.
Then, just create a shop to buy or sell casino tokens.

7 Likes

You mean add a new item in DateBase and create a shop to sell or buy tokens . Its that right ?But anyway thx to your help!

the new item name is :[e.g. khethimaRP_casino_token] not [khethimaRP_casino_token]

thats an example which i use in my server! your new item should be named something like ‘casino_token’

alright I got, I thought the item name should be specific, but sry my last qustion,How can I create a shop to sell or buy tokens?I only know how to create a shop to buy tokens,Im dummy sry, plz help me

In buy menu you pay money and get an Item
xPlayer.removeMoney(money) -> removes money
xPlayer.addInventoryItem(item, count) -> give item . At this case "casino_token)

For the sell tokens, you just have to copy the buy menu and reverse it.
xPlayer.addMoney(money) -> Gives money to player
xPlayer.removeInventoryItem(item, count) ->removes items

This is very basic. I suggest you to find and see other examples of shops to start understanding what the code is doing.
https://esx-org.github.io/ --> best place for begginers

2 Likes

thx very much!

3 Likes

@Bassemand I believe I have fixed the conflict now

1 Like

Great!! - I’ll try! <3

1 Like

@Robbster nice release man! Also, Everything loaded well, but when I get close to any table it says that the seat is already taken, on every seat :frowning:
Any suggestion?

Thank you!

If you want with money insted of items then here remaket the script form @Andreas_Constandinou

ESX = nil
TriggerEvent(‘esx:getSharedObject’, function(obj) ESX = obj end)
function tryTakeChips(source,amount)
local xPlayer = ESX.GetPlayerFromId(source)
local item = xPlayer.getMoney()
if item >= amount then
xPlayer.removeMoney(amount)
return true
else
TriggerClientEvent(‘esx:showNotification’, source, ‘You dont have enough tokens’)
return false --you dont actually need to return false, since default is false but anw. I like this way
end
end
function giveChips(source,amount)
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.addMoney(amount)
end

1 Like

Pleas say you making roulette it could be awsome

2 Likes

what you mean ?

sv_blackjack.lua (32.3 KB) @Dragic download this try to se if that works

7 Likes

Is there a way to incrase the difficulty ? Like to make it rigged ? x)
I found it too easy to win

that’s silly, the whole concept revolves around it being random

you can’t be “too good” at it since it’s all chance
and making it rigged would ruin the fun of it too

1 Like

From where can i get the casino interior?

1 Like