Hi! Im having a issue where I have written some code for a clockin system but whenever I go to see it when the server restarts it does not work unless i restart the resource.
Client.lua code:
local markerPos = vector3(440.12, -975.72, 30.69)
local HasAlreadyGotMessage = falseCitizen.CreateThread(function()
local ped = GetPlayerPed(-1)
while true do
Citizen.Wait(0)
local playerCoords = GetEntityCoords(ped)
local distance = #(playerCoords - markerPos)
local isInMarker = false
if distance < 300.0 then
DrawMarker(25, markerPos.x, markerPos.y, markerPos.z - 1, 0.0, 0.0, 0.0, 0.0, 180.0, 0.0, 2.0, 2.0, 2.0, 255, 128, 0, 50, false, true, 2, nil, nil, false)
if distance < 2.0 then
isInMarker = true
else
HasAlreadyGotMessage = false
end
else
Citizen.Wait(2000)
endif isInMarker and not HasAlreadyGotMessage then TriggerEvent('chatMessage', 'Press E to Interact with clock in system') HasAlreadyGotMessage = true end end
end)
FxManifest code:
fx_version “bodacious”
games {“gta5”}
client_script “client.lua”
Can anyone help! Thanks