Skip to content

Natives

Remove Citizen. prefix where possible

BAD
Citizen.Wait()
Citizen.CreateThread()
Citizen.SetTimeout()
GOOD
Wait()
CreateThread()
SetTimeout()

Do not use GetHashKey()

Replace string hashes with backticks

BAD
local hashKey = GetHashKey('hash')
GOOD
local hashKey = `hash`

Replace GetHashKey(variable) with joaat(variable)

BAD
local hashKey = GetHashKey(myHash)
GOOD
local hashKey = joaat(myHash)

Use Vector3 math rather than GetDistanceBetweenCoords()

BAD
local distance = GetDistanceBetweenCoords(1, 1, 1, 0, 0, 0)
GOOD
local coord1 = vector3(1, 1, 1)
local coord2 = vector3(0, 0, 0)
local distance = #(coord1 - coord2)

Use PlayerPedId() instead of GetPlayerPed(-1)

BAD
local playerPed = GetPlayerPed(-1)
GOOD
local playerPed = PlayerPedId()