[Release] Diamond Casino Blackjack

when I start appears this error:
Error loadging script sv_blackjack.lua in resource vrp_blackjack/sv_blackjack.lua:2: attempt to call a nil value (global ‘module’)
stack traceback:
@vrp_blackjack/sv_blackjack.lua:2: in main chunk
Failed to load script sv_blackjack

Can you help me please?

I’m getting this error every time i place a bet and when i lose or win a game, if anyone has idea how to fix,

i believe ive fixed it, some how tostring changed to tostChip and was giving me this error,

do you have a “tostChip” item in the Database ?

yeah did try that, but i have fixed it now, it was the tostring getting change to tostchip that was giving me the error, been testing couple hours and no errors, thanks for the replay

1 Like

2 problems…

  1. pressing ‘hit’ still has the players stand and the dealer doesn’t deal another card to the player…
  2. after leaving the table, a few seconds later the menu pops up like I’m sitting at the table.

after rename and replace 2files

Alert “this seat is taken” in front of dealer and i can’t do game.

what i have to do? …

I had the same issue, but eventually figured it out. There are multiple folders in Mr Brown’s casinointerior folder. I removed casinoprops folder from there and added cassino_props to resources folder (NB! not pasted into Mr Brown’s MLO, but as a standalone resource).

This is my server.cfg resource order:

ensure cassino_props
ensure casinointerior
ensure casinoexterior
ensure casinoV2
ensure DiamondBlackjack

Hope it helps you man!

1 Like

cant quit understand which prop i should take from O_O
enlighten me plz

Thanks for the lines with money. but , Excuse me, i’m having the “seat taken” bug. Can you guide me?. Thanks

Did you make it work with money?
Thanks

i have it where you have to buy chips at the front desk for cash, then you be able to play on the table, then sell the chips you have won or have left over back at the front desk…

Sry but thats not a bug on my side

Well, for everyone looking for this working with chips (buy the chips first). this is the final code of the sv_blackjack.lua working with Chips (es_extended 1.1) (you need to add the chips item with whatever you want in the database first). You can use another script to buy them chips ;p

USE THIS ONE: sv_blackjack.lua

REMEMBER TO SET local enableesx = true , if you have ESX server, on line 1, just like this:

local enableesx = true -- set true if you are using esx
if enableesx then
	ESX = nil
	ChipName = "chip" -- one that you must insert in database also
	TriggerEvent("esx:getSharedObject", function(obj) ESX = obj end)
end

local blackjackTables = {
    --[chairId] == false or source if taken
    [0] = false,
    [1] = false,
    [2] = false,
    [3] = false,
    [4] = false,
    [5] = false,
    [6] = false,
    [7] = false,
    [8] = false,
    [9] = false,
    [10] = false,
    [11] = false,
    [12] = false,
    [13] = false,
    [14] = false,
    [15] = false,
}

local blackjackGameInProgress = {}
local blackjackGameData = {}

function tryTakeChips(source,amount)
	if enableesx then
		local xPlayer = ESX.GetPlayerFromId(source)
		local item = xPlayer.getInventoryItem(ChipName)["count"]

		if item >= amount then
			xPlayer.removeInventoryItem(ChipName, amount)
    		return true
		elseif item < amount then
			return false
		end
	else
    	return true
	end
end

function giveChips(source,amount)
    if enableesx then
		local xPlayer = ESX.GetPlayerFromId(source)

		xPlayer.addInventoryItem(ChipName, amount) -- doesn't check item limit nor new weight system
	end
end

AddEventHandler('playerDropped', function (reason)
    local source = source
    for k,v in pairs(blackjackTables) do
        if v == source then
            blackjackTables[k] = false
        end
    end
end)

RegisterCommand("debugtableserver",function()
    print("blackjackTables")
    print("===============") ------------------ .......................so on

Also, i’m using this map. no problems so far: Map Diamond Casino

and I’ve added some peds from the Peds script (here: add Peds)

and this is my code (if you want also to set an esx_accessories shop inside, and a normal shop. Also i’ve added an NPC for banking just at the right side of the shop. (you can add the coords with new_banking or your bank script right next to it) This will bring some life to the interior, with security guards, dancing gurls, men over the place, idk, you can do a lot of stuff from there

Config = {}


Config.EnableShops                = true    -- If true spawn Some Shop & Interior NPCs

--Cops--
Config.EnableCops                 = false    -- If true spawn All Cops at Departments
--Cops--

--Nightclub--
Config.EnableNightclubs           = true    -- If true spawn Nightclub NPCs (Need a IPL Loader https://github.com/Bob74/bob74_ipl or other) (After Hours DLC)
Config.EnableSolomun              = true    -- If true spawn Solomun at Nightclub DJ
Config.EnableDixon                = false   -- If true spawn Dixon at Nightclub DJ
--Nightclub--

--Biker DLC--
Config.EnableDrugs                = false    -- If true spawn NPCs & Guards at Druglabors (Biker DLC)
Config.EnableWeapons              = true    -- If true spawn Guards with Weapons (can change in main.lua)
--Biker DLC--



-------------------------------------RANDOMSHOPS-------------------------------------
Config.Locations1 = { -- Some Shop & Interior NPCs
	{ x = 241.06,   y = -1378.91, z = 32.74, heading = 148.30 },	-- esx_dmvschool
	{ x = 262.43,   y = -1360.00, z = 23.55, heading = 47.15 },    -- Central Hospital Main
	{ x = 265.91,   y = -1358.64, z = 23.55, heading = 316.30 },    -- Central Hospital Main 2
	{ x = 440.85,   y = -978.41,  z = 29.69, heading = 165.95 },    -- PD Main Welcome
	{ x = 458.97,   y = -1017.28, z = 27.16, heading = 93.50 },    -- PD Main Garage
	{ x = -1117.15, y = -503.20,  z = 34.81, heading = 294.48 },    -- Moneywash Moveact
	{ x = -705.93,  y = -914.33,  z = 18.22, heading = 81.50 },    -- LT Gasoline1
	{ x = -47.14,   y = -1758.82, z = 28.42, heading = 46.58 },    -- LT Gasoline2
	{ x = 2678.57,  y = 3278.88,  z = 54.24, heading = 337.70 },    -- 24/7 Freeway
	{ x = 1960.20,  y = 3739.33,  z = 31.34, heading = 296.50 },    -- 24/7 Sandy Shores
	{ x = -1196.19, y = -892.78,  z = 13.00, heading = 300.42 },    -- Burgershot
	{ x = -32.94,   y = -1103.65, z = 25.42, heading = 77.25 },    -- Cardealer1
	{ x = 1224.68,  y = 2728.74,  z = 37.01, heading = 178.82 },    -- Cardealer2
	{ x = 1133.87,  y = -983.21,  z = 45.42, heading = 274.80 },    -- EL Rancho Robs Li
	{ x = 85.88,    y = -1959.85, z = 20.12, heading = 27.20 },    -- Grove Str Cannabis Dealer
	{ x = 6.80,     y = 6468.32,  z = 30.43, heading = 51.28 },    -- Paleto Bay Meth Dealer
	{ x = -3155.14, y = 1126.35,  z = 19.86, heading = 42.10 },    -- Cusmash opium Dealer
	{ x = 959.31,   y = -121.22,  z = 73.96, heading = 185.45 },    -- Vinewood Coke Dealer
	{ x = 408.06,   y = -1623.68, z = 28.29, heading = 219.45 },    -- Vehicle Impound
	{ x = 24.20,    y = -1347.60, z = 28.50, heading = 271.32 },    -- Strawberry 24/7
	{ x = 1165.09,  y = -323.51,  z = 69.21, heading = 93.72 },    -- LT Gasoline3
	{ x = -1486.41, y = -377.33,  z = 39.16, heading = 138.12 },    -- Morningwood Robs Li
	{ x = 1165.15,  y = 2711.11,  z = 37.16, heading = 176.58 },    -- Route 68 Robs Li
	{ x = 2557.46,  y = 380.49,   z = 107.62,heading = 4.25 },    -- Mountains Freeway 24/7
	{ x = 1391.82,  y = 3606.29,  z = 33.98, heading = 204.25 },    -- Sandy Shores ACE
	{ x = 549.27,   y = 2671.82,  z = 41.16, heading = 100.35 },    -- Sandy Shores 24/7
	{ x = 1697.35,  y = 4923.32,  z = 41.06, heading = 332.42 },    -- Sandy Shores LT Gasoline4
	{ x = 1727.62,  y = 6415.18,  z = 34.04, heading = 241.98 },    -- Chilliad Freeway 24/7
	{ x = -3241.96, y = 999.86,   z = 11.83, heading = 4.68 },    -- cumash Freeway 24/7
	{ x = -3038.68, y = 584.38,   z = 6.91,  heading = 24.72 },    -- Ocean Freeway 24/7
	{ x = -2966.12, y = 391.35,   z = 14.04, heading = 77.04 },    -- Ocean Freeway LT Gasoline5
	{ x = -1819.51, y = 793.72,   z = 137.08,heading = 134.72 },    -- Ocean Freeway LT Gasoline5
	--
	{ x = 1100.57, y = 194.93,   z = -50.44 ,heading = 315.59 },    -- Ropa Casino
	{ x = 1118.84, y = 213.54,   z = -50.44 ,heading = 85.24 }    -- CAJERO AUTOMATICO $ Casino
	--
}

------------------------------------NIGHTCLUBS-------------------------------------
Config.Locations2 = { -- Nightclub Girls1
	{ x = -1593.89,   y = -3008.52, z = -80.01, heading = 209.22 },	-- NClub1
	{ x = -1587.04,   y = -3005.37, z = -80.01, heading = 137.55 },	-- NClub2
	{ x = -1576.61,   y = -3014.49, z = -80.01, heading = 168.78 },	-- NClub3
	{ x = -1590.54,   y = -3018.24, z = -77.00, heading = 317.10 },	-- NClub4
	{ x = -1585.82,   y = -3008.32, z = -77.00, heading = 218.75 },	-- NClub5
	{ x = -1599.40,   y = -3000.15, z = -76.81, heading = 233.95 },	-- NClub6
	--
	{ x = 1117.83,   y = 219.77, z = -50.44, heading = 86.55 }	-- Cajero Casino
	
}

Config.Locations3 = { -- Nightclub Girls Cheering
	{ x = -1594.81,   y = -3014.21, z = -80.01, heading = 71.46 },	-- NClub1
	{ x = -1597.48,   y = -3010.60, z = -80.01, heading = 104.40 },	-- NClub2
	{ x = -1595.69,   y = -3015.98, z = -78.81, heading = 7.77 },	-- NClub3
	{ x = -1590.34,   y = -3012.13, z = -77.00, heading = 92.40 },	-- NClub4
	{ x = -1605.82,   y = -3011.27, z = -78.80, heading = 244.36 }	-- NClub5
}

Config.Locations4 = { -- Nightclub Girls Partying
	{ x = -1597.33,   y = -3009.50, z = -80.01, heading = 170.30 },	-- NClub1
	{ x = -1588.78,   y = -3017.87, z = -77.01, heading = 65.83 },	-- NClub2
	{ x = -1597.09,   y = -3000.30, z = -76.81, heading = 145.02 },	-- NClub3
	{ x = -1577.94,   y = -3014.36, z = -80.01, heading = 225.58 }	-- NClub4
}

Config.Locations5 = { -- Nightclub Girls Slow
	{ x = -1596.56,   y = -3013.57, z = -80.01, heading = 65.55 },	-- NClub1
	{ x = -1591.78,   y = -3010.03, z = -80.01, heading = 116.30 },	-- NClub2
	{ x = -1587.04,   y = -3011.44, z = -77.00, heading = 101.45 },	-- NClub3
	{ x = -1598.90,   y = -3006.84, z = -77.00, heading = 268.78 },	-- NClub4
	{ x = -1575.12,   y = -3006.97, z = -80.01, heading = 157.70 },	-- NClub5
	--
	{ x = 1099.53,    y =  218.68,  z = -49.75, heading = 154.86 }, -- CasinoGirlSlow1(plataforma)
	{ x = 1100.7,   y = 221.97, z = -49.75, heading = 169.3 },	-- CasinoGirlSlow2(plataforma)
	{ x = 1100.39,   y = 219.82, z = -49.75, heading = 23.14 },	-- CasinoGirlSlow3(plataforma)
	{ x = 1102.06,   y = 218.07, z = -49.75, heading = 234.4 }	-- CasinoGirlSlow4(plataforma)
	--
	
}

Config.Locations6 = { -- Nightclub Girls Tops
	{ x = -1598.59,   y = -3015.69, z = -79.21, heading = 282.30 },	-- NCTop1
	{ x = -1596.21,   y = -3007.97, z = -79.21, heading = 151.05 },	-- NCTop2
	--
	{ x = 1110.96,   y = 227.45, z = -50.64, heading = 194.03 },	-- CasinoGirlTop1
	--
}

Config.Locations7 = { -- Nightclub Mens1
	{ x = -1599.30,   y = -3012.06, z = -80.01, heading = 316.20 },	-- NClub1
	{ x = -1587.75,   y = -3007.00, z = -80.01, heading = 354.15 },	-- NClub2
	{ x = -1575.79,   y = -3008.55, z = -80.01, heading = 324.48 },	-- NClub3
	--
	{ x = 1104.19,   y = 215.21, z = -49.99, heading = 39.48 }	-- Mens1 Casino ?
	--
}

Config.Locations8 = { -- Nightclub Mens2
	{ x = -1592.69,   y = -3008.70, z = -80.01, heading = 133.05 },	-- NClub1
	{ x = -1606.27,   y = -3014.39, z = -78.80, heading = 337.85 },	-- NClub2
	{ x = -1575.75,   y = -3012.27, z = -80.01, heading = 135.35 },	-- NClub3
	{ x = -1588.74,   y = -3011.59, z = -77.00, heading = 277.38 },	-- NClub4
	{ x = -1599.36,   y = -3002.17, z = -76.81, heading = 325.15 },	-- NClub5
	--
	{ x = 1105.17,   y = 217.04, z = -49.99, heading = 57.21 }	-- Mens2 Casino ?
	--
}

Config.Locations9 = { -- Nightclub Mens3
	{ x = -1597.49,   y = -3006.86, z = -77.00, heading = 93.60 },	-- NClub1
	{ x = -1596.35,   y = -3011.46, z = -80.01, heading = 107.00 },	-- NClub2
	{ x = -1611.66,   y = -3009.90, z = -80.01, heading = 119.85 },	-- NClub3
	--
	{ x = 1112.25,   y = 212.55, z = -50.44, heading = 178.4 }	-- Mens3 Casino ?
	--
}

Config.Locations10 = { -- Nightclub Bartender
	{ x = -1584.95,   y = -3012.60, z = -77.01, heading = 92.70 },	-- NClub1
	{ x = -1577.97,   y = -3016.80, z = -80.01, heading = 359.28 },	-- NClub2
	{ x = -1572.20,   y = -3013.56, z = -75.41, heading = 272.63 },	-- NCWelcome
	-- Casino Bartenders
	
	{ x = 1110.53,   y = 208.44, z = -50.44, heading = 80.97 }	-- BARTENDER CASINO 1
}

Config.Locations11 = { -- Nightclub Guards Y CASINO
	{ x = -1576.46,   y = -3010.37, z = -80.01, heading = 79.00 },	-- NClub1
	{ x = -1588.06,   y = -3014.43, z = -80.01, heading = 349.75 },	-- NClub2
	{ x = -1585.96,   y = -3016.78, z = -77.00, heading = 136.40 },	-- NClub3
	{ x = -1605.85,   y = -3013.04, z = -78.80, heading = 288.05 },	-- NClub4
	{ x = -1614.12,   y = -3009.50, z = -76.21, heading = 119.75 },	-- NClub5
	{ x = -1568.17,   y = -3015.47, z = -75.41, heading = 39.15 },	-- NCWelcome
	{ x = 194.45,     y = -3165.86, z = 4.79,   heading = 115.62 },	-- NCOut
	
	-- CASINO Guards
	{ x = 1117.47,    y = 223.36,   z = -50.44, heading = 22.16 },	-- GCasino1 al lado caja
	{ x = 1124.58,    y = 242.79,   z = -51.44, heading = 134.99 },	-- GCasino2 hall mesas in
	{ x = 1143.4,     y = 252.11,   z = -52.04, heading = 220.84 },	-- GCasino3 vipderecha
	{ x = 1134.03,    y = 260.48,   z = -52.04, heading = 34.58 },	-- GCasino4 vipizq
	{ x = 1143.39,    y = 270.54,   z = -52.84, heading = 223.96 },	-- GCasino5 mesas bj
	{ x = 1152.02,    y = 262.01,   z = -52.84, heading = 43.07 },	-- GCasino5 mesas bj
	{ x = 923.57,     y = 43.46,    z = 80.11,  heading = 57.87 },	-- GCasino6 afu1
	{ x = 927.41,     y = 50.81,    z = 80.11,  heading = 108.14 },	-- GCasinoWelcome
	{ x = 1087.65,    y = 209.83,   z = -50.0,  heading = 264.7 },	-- GCasinoOut
	--
	{ x = 123.57,     y = -1290.38, z = 28.29,  heading = 240.82 },	-- Vanilla1
	{ x = 107.82,     y = -1298.90, z = 27.77,  heading = 172.95 },	-- Vanilla2
	{ x = 462.81,     y = -992.30,  z = 23.91,  heading = 349.60 },	-- LSPD Prison1
	{ x = 462.89,     y = -1003.08, z = 23.91,  heading = 347.88 },	-- LSPD Prison2
	{ x = 470.40,     y = -1015.15, z = 25.39,  heading = 154.75 }	-- LSPD Prison3
	
}

Config.Locations12 = { -- Nightclub Solomun
	{ x = -1604.01,   y = -3011.99, z = -78.80, heading = 266.30 }	-- NCSolomun
}

Config.Locations13 = { -- Nightclub Dixon
	{ x = -1604.01,   y = -3011.99, z = -78.80, heading = 266.30 }	-- NCDixon
}


------------------------------------BIKER DLC------------------------------------------
Config.Locations14 = { -- Biker Guards
	{ x = 1090.08,   y = -3191.25, z = -39.99, heading = 22.10 },	-- Guard1 Coca
	{ x = 1087.06,   y = -3187.90, z = -39.99, heading = 212.00 },	-- Guard2
	{ x = 1097.42,   y = -3198.71, z = -39.99, heading = 61.72 },	-- Guard3
	{ x = 1065.86,   y = -3185.16, z = -40.16, heading = 55.12 },	-- Guard4 Weed
	{ x = 1053.91,   y = -3192.39, z = -40.16, heading = 236.00 },	-- Guard5
	{ x = 1039.30,   y = -3196.09, z = -39.17, heading = 237.02 },	-- Guard6
	{ x = 2436.27,   y = 4976.72,  z = 45.57,  heading = 55.40 },	-- Guard7 Opium
	{ x = 2432.61,   y = 4961.56,  z = 45.82,  heading = 277.35 },	-- Guard8
	{ x = 997.14,    y = -3201.97, z = -37.39, heading = 322.08 },	-- Guard9 Meth
	{ x = 1001.31,   y = -3197.73, z = -39.99, heading = 293.75 },	-- Guard10
	{ x = 1014.44,   y = -3201.72, z = -39.99, heading = 36.63 }	-- Guard11
}

Config.Locations15 = { -- Biker Meth Cook
	{ x = 1005.75,   y = -3200.32, z = -39.52, heading = 178.83 }	-- Biker Cook

}

Config.Locations16 = { -- Meth Worker
	{ x = 1006.33,   y = -3197.67, z = -39.99, heading = 265.40 },	-- Biker Worker
	{ x = 1011.74,   y = -3196.86, z = -39.99, heading = 145.00 }	-- Biker Worker

}

Config.Locations17 = { -- Coca & Opium Worker
	{ x = 1091.35,   y = -3196.83, z = -39.99, heading = 359.28 },	-- Biker Worker
	{ x = 1101.37,   y = -3194.05, z = -39.99, heading = 6.90 },	-- Biker Worker
	{ x = 2431.59,   y = 4971.02,  z = 41.35,  heading = 37.75 },	-- Biker Worker
	{ x = 2435.69,   y = 4965.52,  z = 41.35,  heading = 221.82 }	-- Biker Worker

}

Config.Locations18 = { -- Biker Weed Worker
	{ x = 1055.29,   y = -3198.18, z = -40.16, heading = 298.92 },	-- Biker Worker
	{ x = 1063.62,   y = -3192.31, z = -40.10, heading = 210.30 },	-- Biker Worker
	{ x = 1058.15,   y = -3202.37, z = -40.05, heading = 44.00 },	-- Biker Worker
	{ x = 1050.60,   y = -3204.92, z = -40.12, heading = 213.05 }	-- Biker Worker
	
}

Config.Locations19 = { -- Cops Men LSPD
	{ x = 431.19,   y = -978.44, z = 29.71, heading = 206.50 },	-- Cops
	{ x = 431.75,   y = -979.22, z = 29.71, heading = 34.40 },	-- Cops
	{ x = 443.30,   y = -981.24, z = 29.69, heading = 0.70 },	-- Cops
	{ x = 454.05,   y = -980.02, z = 29.69, heading = 90.25 },	-- Cops
	{ x = 456.33,   y = -988.56, z = 29.69, heading = 2.66 },	-- Cops
	{ x = 459.73,   y = -989.61, z = 23.91, heading = 264.81 },	-- Cops
	{ x = 467.73,   y = -1016.14,z = 25.45, heading = 276.80 },	-- Cops
	--Sandy--
	{ x = 1852.67,  y = 3688.85,z = 33.27, heading = 204.98 },	-- Cops
	--PB--
	{ x = -448.19,  y = 6012.36,z = 30.72, heading = 310.80 }	-- Cops
	
}

Config.Locations20 = { -- Cops Men LSPD2
	{ x = 440.24,   y = -975.67, z = 29.69, heading = 24.28 },	-- Cops
	{ x = 437.07,   y = -996.31, z = 29.69, heading = 30.02	},	-- Cops
	{ x = 459.84,   y = -988.52, z = 23.91, heading = 230.57 },	-- Cops
	--Sandy--
	{ x = 1853.15,  y = 3690.16, z = 33.27, heading = 304.32 },	-- Cops
	--PB--
	{ x = -449.49,  y = 6012.42, z = 30.72, heading = 69.25 }	-- Cops
	
}

Config.Locations21 = { -- Cops Girl LSPD3
	{ x = 437.68,   y = -979.22, z = 29.69, heading = 245.80 },	-- Cops
	{ x = 430.80,   y = -979.18, z = 29.71, heading = 277.25 },	-- Cops
	{ x = 420.30,   y = -989.65, z = 29.71, heading = 208.18 },	-- Cops
	{ x = 452.85,   y = -988.00, z = 25.67, heading = 348.15 },	-- Cops
	--Sandy--
	{ x = 1854.39,  y = 3688.27, z = 33.27, heading = 97.55 },	-- Cops
	--PB--
	{ x = -441.35,  y = 6016.41, z = 30.70, heading = 342.40 }	-- Cops
	
}

Config.Locations22 = { -- Guards Weapons 
	{ x = 448.64,   y = -988.45, z = 29.69, heading = 43.60 },	-- LSPDGuards
	{ x = 436.02,   y = -978.95, z = 29.69, heading = 216.95 },	-- LSPDGuards
	{ x = 1064.35,  y = -3187.37,z = -40.13,heading = 140.85 },	-- GuardsWeed
	{ x = 1055.62,  y = -3191.79,z = -40.15,heading = 178.32 },	-- GuardsWeed
	{ x = 1035.94,  y = -3206.06,z = -39.17,heading = 284.78 },	-- GuardsWeed
	{ x = 1042.39,  y = -3194.08,z = -39.16,heading = 180.62 },	-- GuardsWeed
	{ x = 999.07,   y = -3198.55,z = -37.39,heading = 264.22 },	-- GuardsMeth
	{ x = 1016.91,  y = -3198.42,z = -39.99,heading = 122.70 },	-- GuardsMeth
	{ x = 2433.71,  y = 4975.68, z = 45.57, heading = 16.02 },	-- Guardsopium
	{ x = 2437.40,  y = 4966.65, z = 41.35, heading = 66.08 },	-- Guardsopium
	{ x = 1089.90,  y = -3187.78,z = -39.99,heading = 158.60 },	-- GuardsCoca
	{ x = 1099.33,  y = -3199.25,z = -39.99,heading = 347.42 }	-- GuardsCoca
	
}

I hope that people knowing this script for the first time, wont get stuck with this info.

This is an awesome script, and I hope they release Roullete, Texas Hold’em and the Slot machines… :stuck_out_tongue:

<3

byes :smiley:

do you have coords already?

how did you enable players to sell chips?

I Put A Buy/Sell At The Cahier Desk, So When You Arrive You Buy Your Chips For Cash, Then When You Finish Gambling, You Sell Your Chips Back To The Casino Cashier… (1 Chip = 1 Dollar)

Client Side
--- Diamond Casino Chips ---

ESX = nil
local PlayerData              = {}

Citizen.CreateThread(function()
	while ESX == nil do
		TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
		Citizen.Wait(0)
		PlayerData = ESX.GetPlayerData()
	end
end)

RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
    PlayerData = xPlayer
end)

RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(job)
  PlayerData.job = job
end)

function hintToDisplay(text)
	SetTextComponentFormat("STRING")
	AddTextComponentString(text)
	DisplayHelpTextFromStringLabel(0, 0, 1, -1)
end

Citizen.CreateThread(function()
    local blip = AddBlipForCoord(926.98, 45.40, 81.10)

    SetBlipSprite (blip, 617)
	SetBlipDisplay(blip, 4)
	SetBlipScale  (blip, 0.65)
	SetBlipColour (blip, 67)
	SetBlipAsShortRange(blip, true)

	BeginTextCommandSetBlipName("STRING")
	AddTextComponentString("Diamond Casino")
    EndTextCommandSetBlipName(blip)
    
end)

local gym = {
    {x = 1116.07, y = 219.92, z = -49.43}
}

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        for k in pairs(gym) do
            DrawMarker(21, gym[k].x, gym[k].y, gym[k].z, 0, 0, 0, 0, 0, 0, 0.301, 0.301, 0.3001, 0, 153, 255, 255, 0, 0, 0, 0)
        end
    end
end)

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)

        for k in pairs(gym) do
		
            local plyCoords = GetEntityCoords(GetPlayerPed(-1), false)
            local dist = Vdist(plyCoords.x, plyCoords.y, plyCoords.z, gym[k].x, gym[k].y, gym[k].z)

            if dist <= 0.5 then
				hintToDisplay('Press ~INPUT_CONTEXT~ To Open The ~b~Store~w~')
				
				if IsControlJustPressed(0, 46) then
					OpenDiamondCasinoMenu()
				end			
            end
        end
    end
end)

function OpenDiamondCasinoMenu()
    ESX.UI.Menu.CloseAll()

    ESX.UI.Menu.Open(
        'default', GetCurrentResourceName(), 'Diamond_Casino_Menu',
        {
            title    = 'Diamond Casino Chip Exchange',
            elements = {
				{label = 'Buy', value = 'Buy'},
				{label = 'Sell', value = 'Sell'},
            }
        },
        function(data, menu)
            if data.current.value == 'Buy' then
				OpenBuyMenu()
            elseif data.current.value == 'Sell' then
				OpenSellMenu()
            end
        end,
        function(data, menu)
            menu.close()
        end
    )
end

function OpenBuyMenu()
    ESX.UI.Menu.CloseAll()

    ESX.UI.Menu.Open(
        'default', GetCurrentResourceName(), 'Diamond_Casino_Buy_Menu',
        {
            title    = 'Buy Diamond Casino Chips?',
            elements = {
                {label = 'Diamond Casino Chip x1', value = 'Diamond_Casino_Chips_1'},
                {label = 'Diamond Casino Chip x50', value = 'Diamond_Casino_Chips_50'},
                {label = 'Diamond Casino Chip x100', value = 'Diamond_Casino_Chips_100'},
                {label = 'Diamond Casino Chip x500', value = 'Diamond_Casino_Chips_500'},
                {label = 'Diamond Casino Chip x1000', value = 'Diamond_Casino_Chips_1000'},
                {label = 'Diamond Casino Chip x5000', value = 'Diamond_Casino_Chips_5000'},
                {label = 'Diamond Casino Chip x10000', value = 'Diamond_Casino_Chips_10000'},
            }
        },
        function(data, menu)
            if data.current.value == 'Diamond_Casino_Chips_1' then
                TriggerServerEvent('DiamondBlackjack:BuyChips1')
            elseif data.current.value == 'Diamond_Casino_Chips_50' then
                TriggerServerEvent('DiamondBlackjack:BuyChips50')
            elseif data.current.value == 'Diamond_Casino_Chips_100' then
                TriggerServerEvent('DiamondBlackjack:BuyChips100')
            elseif data.current.value == 'Diamond_Casino_Chips_500' then
                TriggerServerEvent('DiamondBlackjack:BuyChips500')
            elseif data.current.value == 'Diamond_Casino_Chips_1000' then
                TriggerServerEvent('DiamondBlackjack:BuyChips1000')
            elseif data.current.value == 'Diamond_Casino_Chips_5000' then
                TriggerServerEvent('DiamondBlackjack:BuyChips5000')
            elseif data.current.value == 'Diamond_Casino_Chips_10000' then
                TriggerServerEvent('DiamondBlackjack:BuyChips10000')
            end
        end,
        function(data, menu)
            menu.close()
        end
    )
end

function OpenSellMenu()
    ESX.UI.Menu.CloseAll()

    ESX.UI.Menu.Open(
        'default', GetCurrentResourceName(), 'Diamond_Casino_Sell_Menu',
        {
            title    = 'Sell Diamond Casino Chip?',
            elements = {
                {label = 'Diamond Casino Chip x1', value = 'Diamond_Casino_Chips_1'},
                {label = 'Diamond Casino Chip x50', value = 'Diamond_Casino_Chips_50'},
                {label = 'Diamond Casino Chip x100', value = 'Diamond_Casino_Chips_100'},
                {label = 'Diamond Casino Chip x500', value = 'Diamond_Casino_Chips_500'},
                {label = 'Diamond Casino Chip x1000', value = 'Diamond_Casino_Chips_1000'},
                {label = 'Diamond Casino Chip x5000', value = 'Diamond_Casino_Chips_5000'},
                {label = 'Diamond Casino Chip x10000', value = 'Diamond_Casino_Chips_10000'},
            }
        },
        function(data, menu)
            if data.current.value == 'Diamond_Casino_Chips_1' then
                TriggerServerEvent('DiamondBlackjack:SellChips1')
            elseif data.current.value == 'Diamond_Casino_Chips_50' then
                TriggerServerEvent('DiamondBlackjack:SellChips50')
            elseif data.current.value == 'Diamond_Casino_Chips_100' then
                TriggerServerEvent('DiamondBlackjack:SellChips100')
            elseif data.current.value == 'Diamond_Casino_Chips_500' then
                TriggerServerEvent('DiamondBlackjack:SellChips500')
            elseif data.current.value == 'Diamond_Casino_Chips_1000' then
                TriggerServerEvent('DiamondBlackjack:SellChips1000')
            elseif data.current.value == 'Diamond_Casino_Chips_5000' then
                TriggerServerEvent('DiamondBlackjack:SellChips5000')
            elseif data.current.value == 'Diamond_Casino_Chips_10000' then
                TriggerServerEvent('DiamondBlackjack:SellChips10000')
            end
        end,
        function(data, menu)
            menu.close()
        end
    )
end
Server Side
--- Diamond Casino Chips ---

ESX = nil

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

-----Buy x1
RegisterServerEvent('DiamondBlackjack:BuyChips1')
AddEventHandler('DiamondBlackjack:BuyChips1', function()
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
	
	if(xPlayer.getMoney() >= 1) then
		xPlayer.removeMoney(1)
        xPlayer.addInventoryItem('Diamond_Casino_Chips', 1)
		TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Success', text = 'You Bought 1 Casino Chips' })
	else
		TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Error', text = 'You Do Not Have Enough Money' })
	end		
end)

-----Buy x50
RegisterServerEvent('DiamondBlackjack:BuyChips50')
AddEventHandler('DiamondBlackjack:BuyChips50', function()
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
	
	if(xPlayer.getMoney() >= 50) then
		xPlayer.removeMoney(50)
		xPlayer.addInventoryItem('Diamond_Casino_Chips', 50)
		TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Success', text = 'You Bought 50 Casino Chips' })
	else
		TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Error', text = 'You Do Not Have Enough Money' })
	end		
end)

-----Buy x100
RegisterServerEvent('DiamondBlackjack:BuyChips100')
AddEventHandler('DiamondBlackjack:BuyChips100', function()
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
	
	if(xPlayer.getMoney() >= 100) then
		xPlayer.removeMoney(100)
		xPlayer.addInventoryItem('Diamond_Casino_Chips', 100)
		TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Success', text = 'You Bought 100 Casino Chips' })
    else
		TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Error', text = 'You Do Not Have Enough Money' })
	end		
end)

-----Buy x500
RegisterServerEvent('DiamondBlackjack:BuyChips500')
AddEventHandler('DiamondBlackjack:BuyChips500', function()
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
	
	if(xPlayer.getMoney() >= 500) then
		xPlayer.removeMoney(500)
		xPlayer.addInventoryItem('Diamond_Casino_Chips', 500)
		TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Success', text = 'You Bought 500 Casino Chips' })
	else
		TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Error', text = 'You Do Not Have Enough Money' })
	end		
end)

-----Buy x1000
RegisterServerEvent('DiamondBlackjack:BuyChips1000')
AddEventHandler('DiamondBlackjack:BuyChips1000', function()
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
	
	if(xPlayer.getMoney() >= 1000) then
		xPlayer.removeMoney(1000)
        xPlayer.addInventoryItem('Diamond_Casino_Chips', 1000)
		TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Success', text = 'You Bought 1000 Casino Chips' })
    else
		TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Error', text = 'You Do Not Have Enough Money' })
	end		
end)

-----Buy x5000
RegisterServerEvent('DiamondBlackjack:BuyChips5000')
AddEventHandler('DiamondBlackjack:BuyChips5000', function()
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
	
	if(xPlayer.getMoney() >= 5000) then
		xPlayer.removeMoney(5000)
        xPlayer.addInventoryItem('Diamond_Casino_Chips', 5000)
		TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Success', text = 'You Bought 5000 Casino Chips' })
    else
		TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Error', text = 'You Do Not Have Enough Money' })
	end		
end)

-----Buy x10000
RegisterServerEvent('DiamondBlackjack:BuyChips10000')
AddEventHandler('DiamondBlackjack:BuyChips10000', function()
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
	
	if(xPlayer.getMoney() >= 10000) then
		xPlayer.removeMoney(10000)
        xPlayer.addInventoryItem('Diamond_Casino_Chips', 10000)
		TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Success', text = 'You Bought 10000 Casino Chips' })
    else
		TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Error', text = 'You Do Not Have Enough Money' })
	end		
end)

-----Sell x1
RegisterServerEvent('DiamondBlackjack:SellChips1')
AddEventHandler('DiamondBlackjack:SellChips1', function()
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
    local Diamond_Casino_Chips_1 = 0

	for i=1, #xPlayer.inventory, 1 do
		local item = xPlayer.inventory[i]

		if item.name == "Diamond_Casino_Chips" then
			Diamond_Casino_Chips_1 = item.count
		end
	end
    
    if Diamond_Casino_Chips_1 > 0 then
        xPlayer.removeInventoryItem('Diamond_Casino_Chips', 1)
        xPlayer.addMoney(1)
        TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Success', text = 'You Sold 1 Casino Chips' })
    else 
        TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Error', text = 'You Do Not Have 1 Chips To Sell' })
    end
end)

-----Sell x50
RegisterServerEvent('DiamondBlackjack:SellChips50')
AddEventHandler('DiamondBlackjack:SellChips50', function()
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
    local Diamond_Casino_Chips_50 = 0

	for i=1, #xPlayer.inventory, 1 do
		local item = xPlayer.inventory[i]

		if item.name == "Diamond_Casino_Chips" then
			Diamond_Casino_Chips_50 = item.count
		end
	end
    
    if Diamond_Casino_Chips_50 > 0 then
        xPlayer.removeInventoryItem('Diamond_Casino_Chips', 50)
        xPlayer.addMoney(50)
        TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Success', text = 'You Sold 50 Casino Chips' })
    else 
        TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Error', text = 'You Do Not Have 50 Chips To Sell' })
    end
end)

-----Sell x100
RegisterServerEvent('DiamondBlackjack:SellChips100')
AddEventHandler('DiamondBlackjack:SellChips100', function()
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
    local Diamond_Casino_Chips_100 = 0

	for i=1, #xPlayer.inventory, 1 do
		local item = xPlayer.inventory[i]

		if item.name == "Diamond_Casino_Chips" then
			Diamond_Casino_Chips_100 = item.count
		end
	end
    
    if Diamond_Casino_Chips_100 > 0 then
        xPlayer.removeInventoryItem('Diamond_Casino_Chips', 100)
        xPlayer.addMoney(100)
        TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Success', text = 'You Sold 100Casino Chips' })
    else 
        TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Error', text = 'You Do Not Have 100 Chips To Sell' })
    end
end)

-----Sell x500
RegisterServerEvent('DiamondBlackjack:SellChips500')
AddEventHandler('DiamondBlackjack:SellChips500', function()
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
    local Diamond_Casino_Chips_500 = 0

	for i=1, #xPlayer.inventory, 1 do
		local item = xPlayer.inventory[i]

		if item.name == "Diamond_Casino_Chips" then
			Diamond_Casino_Chips_500 = item.count
		end
	end
    
    if Diamond_Casino_Chips_500 > 0 then
        xPlayer.removeInventoryItem('Diamond_Casino_Chips', 500)
        xPlayer.addMoney(500)
        TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Success', text = 'You Sold 500 Casino Chips' })
    else 
        TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Error', text = 'You Do Not Have 500 Chips To Sell' })
    end
end)

-----Sell x1000
RegisterServerEvent('DiamondBlackjack:SellChips1000')
AddEventHandler('DiamondBlackjack:SellChips1000', function()
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
    local Diamond_Casino_Chips_1000 = 0

	for i=1, #xPlayer.inventory, 1 do
		local item = xPlayer.inventory[i]

		if item.name == "Diamond_Casino_Chips" then
			Diamond_Casino_Chips_1000 = item.count
		end
	end
    
    if Diamond_Casino_Chips_1000 > 0 then
        xPlayer.removeInventoryItem('Diamond_Casino_Chips', 1000)
        xPlayer.addMoney(1000)
        TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Success', text = 'You Sold 1000 Casino Chips' })
    else 
        TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Error', text = 'You Do Not Have 1000 Chips To Sell' })
    end
end)

-----Sell x5000
RegisterServerEvent('DiamondBlackjack:SellChips5000')
AddEventHandler('DiamondBlackjack:SellChips5000', function()
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
    local Diamond_Casino_Chips_5000 = 0

	for i=1, #xPlayer.inventory, 1 do
		local item = xPlayer.inventory[i]

		if item.name == "Diamond_Casino_Chips" then
			Diamond_Casino_Chips_5000 = item.count
		end
	end
    
    if Diamond_Casino_Chips_5000 > 0 then
        xPlayer.removeInventoryItem('Diamond_Casino_Chips', 5000)
        xPlayer.addMoney(5000)
        TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Success', text = 'You Sold 5000 Casino Chips' })
    else 
        TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Error', text = 'You Do Not Have 5000 Chips To Sell' })
    end
end)

-----Sell x10000
RegisterServerEvent('DiamondBlackjack:SellChips10000')
AddEventHandler('DiamondBlackjack:SellChips10000', function()
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
    local Diamond_Casino_Chips_10000 = 0

	for i=1, #xPlayer.inventory, 1 do
		local item = xPlayer.inventory[i]

		if item.name == "Diamond_Casino_Chips" then
			Diamond_Casino_Chips_10000 = item.count
		end
	end
    
    if Diamond_Casino_Chips_10000 > 0 then
        xPlayer.removeInventoryItem('Diamond_Casino_Chips', 10000)
        xPlayer.addMoney(10000)
        TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Success', text = 'You Sold 10000 Casino Chips' })
    else 
        TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'Error', text = 'You Do Not Have 10000 Chips To Sell' })
    end
end)

Cheers bro, im using vRP but should be able to convert it