local cashMoney = 0
local bankMoney = 0
RegisterCommand("addcash", function()
cashMoney = cashMoney + 1
MySQL.Async.execute("INSERT INTO police (`identifier`) VALUES ('"..identifier.."')", { ['@identifier'] = identifier}, "INSERT INTO moneyammount (`money`) VALUES ('"..cashMoney.."')", { ['@cashMoney'] = money})
print("Cash Money: " .. cashMoney)
end)
RegisterCommand("addbank", function()
bankMoney = bankMoney + 1
print("Bank Money: " .. bankMoney)
end)
AddEventHandler("playerSpawned", function(spawn)
print("Is this getting fired?")
local time = 0
local messagetime = 100000000000000000000000000000000000000000000000000000
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
while time ~= messagetime do
Citizen.Wait(0)
-- print("Cash Money: " .. cashMoney)
-- print("Bank Money: " .. bankMoney)
DrawText1("~b~Cash Money: ~g~$ " .. cashMoney)
DrawText2("~b~Bank Money: ~g~$ " .. bankMoney)
end
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
while time ~= messagetime do
Citizen.Trace(time)
Citizen.Wait(1000)
time = time +1
end
end
end)
end)
function DrawText1(text)
SetTextFont(0)
SetTextProportional(1)
SetTextScale(0.0, 0.50)
SetTextDropshadow(1, 0, 0, 0, 255)
SetTextEdge(1, 0, 0, 0, 255)
SetTextDropShadow()
SetTextOutline()
SetTextEntry("STRING")
AddTextComponentString(text)
DrawText(0.10, 0.10)
end
function DrawText2(text)
SetTextFont(0)
SetTextProportional(1)
SetTextScale(0.0, 0.50)
SetTextDropshadow(1, 0, 0, 0, 255)
SetTextEdge(1, 0, 0, 0, 255)
SetTextDropShadow()
SetTextOutline()
SetTextEntry("STRING")
AddTextComponentString(text)
DrawText(0.425, 0.13)
end
Hi I am trying to connect my money system with a db but not sure how to exactly Can some one tell me what I am doing wrong?