There you go @Briglair
local cash = 0
RegisterCommand("addcash", function()
cash = cash + 1
end)
RegisterCommand("money", function()
TriggerEvent("chatMessage", "MONEY", {255, 255, 255}, "Cash: ^2$"..cash)
end, false)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
DrawText1("Money: ~g~$".. cash)
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(1000)
if Job == 'Tow' then
cash = cash + 300
elseif Job == 'Taxi' then
cash = cash + 200
elseif Job == 'Construction' then
cash = cash + 100
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
local Job
RegisterCommand("job", function()
Job = KeyboardInput("Job:", "", 20)
end, false)
RegisterCommand("jobs", function()
TriggerEvent("jobs",Job)
end, false)
RegisterNetEvent("jobs")
AddEventHandler("jobs", function(Job)
if Job == nil then
TriggerEvent("chatMessage", "JOBS", {255, 255, 255}, "Current Job: None")
TriggerEvent("chatMessage", "", {255, 255, 255}, "Other Jobs: Tow | Taxi | Construction")
else
TriggerEvent("chatMessage", "JOBS", {255, 255, 255}, "Current Job: "..Job)
TriggerEvent("chatMessage", "", {255, 255, 255}, "Other Jobs: Tow | Taxi | Construction")
end
end)
function KeyboardInput(TextEntry, ExampleText, MaxStringLenght)
-- TextEntry --> The Text above the typing field in the black square
-- ExampleText --> An Example Text, what it should say in the typing field
-- MaxStringLenght --> Maximum String Lenght
AddTextEntry('FMMC_KEY_TIP1', TextEntry .. ':') --Sets the Text above the typing field in the black square
DisplayOnscreenKeyboard(1, "FMMC_KEY_TIP1", "", ExampleText, "", "", "", MaxStringLenght) --Actually calls the Keyboard Input
blockinput = true --Blocks new input while typing if **blockinput** is used
while UpdateOnscreenKeyboard() ~= 1 and UpdateOnscreenKeyboard() ~= 2 do --While typing is not aborted and not finished, this loop waits
Citizen.Wait(0)
end
if UpdateOnscreenKeyboard() ~= 2 then
local result = GetOnscreenKeyboardResult() --Gets the result of the typing
Citizen.Wait(500) --Little Time Delay, so the Keyboard won't open again if you press enter to finish the typing
blockinput = false --This unblocks new Input when typing is done
return result --Returns the result
else
Citizen.Wait(500) --Little Time Delay, so the Keyboard won't open again if you press enter to finish the typing
blockinput = false --This unblocks new Input when typing is done
return nil --Returns nil if the typing got aborted
end
end