Lua is the most common scripting language for FiveM resources.
local name = "John"
local age = 25
local isActive = truefunction greet(name)
return "Hello, " .. name
end
local message = greet("World")local player = {
name = "John",
age = 25,
items = {"sword", "shield"}
}
print(player.name) -- "John"
print(player.items[1]) -- "sword"-- Get player
local playerId = GetPlayerPed(-1)
-- Get player coords
local coords = GetEntityCoords(playerId)
-- Trigger event
TriggerEvent('myevent', data)local lastTime = 0
function debouncedAction()
local currentTime = GetGameTimer()
if currentTime - lastTime < 1000 then
return
end
lastTime = currentTime
-- Do action
endCreateThread(function()
while true do
Wait(1000)
-- Do something every second
end
end)