├── shared └── config.lua ├── fxmanifest.lua └── client └── client.lua /shared/config.lua: -------------------------------------------------------------------------------- 1 | Config = { 2 | AfkTimer = 1, -- Minutes to be considered AFK 3 | 4 | Notify = function(title, message, type, src, length) 5 | local length = length or 5000 6 | 7 | if src then 8 | TriggerClientEvent("QBCore:Notify", src, message, type, length) 9 | else 10 | TriggerEvent("QBCore:Notify", message, type, length) 11 | end 12 | end 13 | } -------------------------------------------------------------------------------- /fxmanifest.lua: -------------------------------------------------------------------------------- 1 | fx_version 'cerulean' 2 | game 'gta5' 3 | author 'atiysu' 4 | lua54 'yes' 5 | discord 'https://discord.gg/dvPMYsRFNx' 6 | 7 | games { 8 | "gta5", 9 | "rdr3" 10 | } 11 | 12 | shared_scripts{ 13 | "shared/*.lua", 14 | } 15 | 16 | client_scripts { 17 | "client/utils.lua", 18 | "client/*.lua", 19 | } 20 | 21 | local isEscrowed = false 22 | if isEscrowed then 23 | escrow_ignore { 24 | "shared/*.lua", 25 | "client/open.lua", 26 | } 27 | else 28 | escrow_ignore { 29 | "shared/*.lua", 30 | "client/**/*", 31 | } 32 | end -------------------------------------------------------------------------------- /client/client.lua: -------------------------------------------------------------------------------- 1 | afkTimer = Config.AfkTimer * 60 2 | 3 | AfkTime = 0 4 | IsAfk = false 5 | camera = nil 6 | 7 | CreateThread(function() 8 | while true do 9 | Wait(1000) 10 | 11 | if NetworkIsPlayerActive(PlayerId()) then 12 | local ped = PlayerPedId() 13 | local isMoving = IsPedRunning(ped) == true or IsPedWalking(ped) == true or IsPedJumping(ped) == true or IsPedSprinting(ped) == true or IsPedFalling(ped) == true or GetEntitySpeed(ped) > 0.0 and not IsControlPressed(0, 1) and not IsControlPressed(0, 2) and not IsControlPressed(0, 3) and not IsControlPressed(0, 4) 14 | 15 | if isMoving and AfkTime > 0 then 16 | AfkTime = 0 17 | IsAfk = false 18 | elseif not isMoving and not IsAfk then 19 | AfkTime = AfkTime + 1 20 | 21 | if afkTimer - AfkTime == 10 then 22 | Config.Notify("Afk", "You will be marked as AFK in 10 seconds.", "error", source, 5000) 23 | end 24 | 25 | if AfkTime >= afkTimer then 26 | IsAfk = true 27 | StartAFKAnimation() 28 | end 29 | end 30 | end 31 | end 32 | end) 33 | 34 | function StartAFKAnimation() 35 | Config.Notify("Afk", "You are now marked as AFK.", "error", source, 5000) 36 | 37 | CreateThread(function() 38 | DoScreenFadeOut(300) 39 | while not IsScreenFadedOut() do Wait(0) end 40 | 41 | local ped = PlayerPedId() 42 | local inVehicle = IsPedInAnyVehicle(ped, false) 43 | if inVehicle then 44 | TaskStartScenarioInPlace(ped, "WORLD_HUMAN_DRIVER", 0, true) 45 | else 46 | TaskStartScenarioInPlace(ped, "WORLD_HUMAN_STAND_MOBILE", 0, true) 47 | end 48 | 49 | local pedCoords = GetEntityCoords(ped) 50 | local radius = 8.0 51 | local angle = 0.0 52 | 53 | camera = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", pedCoords.x, pedCoords.y, pedCoords.z + 0.5, 0.0, 0.0, 0.0, 30.0, true, 2) 54 | SetCamActive(camera, true) 55 | RenderScriptCams(true, false, 0, true, true) 56 | 57 | CreateThread(function() 58 | while true do 59 | if not camera then break end 60 | 61 | for i = 0, 1.0, 1.0 do 62 | DrawRect(0.0, 0.0, 2.0, 0.2, 0, 0, 0, 255) 63 | DrawRect(0.0, i, 2.0, 0.2, 0, 0, 0, 255) 64 | end 65 | 66 | angle = angle + 0.05 67 | if angle >= 360.0 then 68 | angle = 0.0 69 | end 70 | 71 | local offsetX = pedCoords.x + radius * math.cos(math.rad(angle)) 72 | local offsetY = pedCoords.y + radius * math.sin(math.rad(angle)) 73 | local offsetZ = pedCoords.z + 1.0 -- Kameranın yüksekliği 74 | 75 | SetCamCoord(camera, offsetX, offsetY, offsetZ) 76 | PointCamAtCoord(camera, pedCoords.x, pedCoords.y, pedCoords.z) 77 | 78 | if IsControlPressed(0, 1) or IsControlPressed(0, 2) or IsControlPressed(0, 3) or IsControlPressed(0, 4) then 79 | AfkTime = 0 80 | IsAfk = false 81 | StopAFKAnimation() 82 | break 83 | end 84 | 85 | Wait(0) 86 | end 87 | end) 88 | 89 | DoScreenFadeIn(300) 90 | while not IsScreenFadedIn() do Wait(0) end 91 | end) 92 | end 93 | 94 | function CalculateRoundPos(pos) 95 | return vector3(math.floor(pos.x * 100) / 100, math.floor(pos.y * 100) / 100, math.floor(pos.z * 100) / 100) 96 | end 97 | 98 | function StopAFKAnimation() 99 | if camera then 100 | RenderScriptCams(false, false, 0, true, true) 101 | DestroyCam(camera, false) 102 | camera = nil 103 | end 104 | 105 | ClearPedTasks(PlayerPedId()) 106 | 107 | Config.Notify("Afk", "You are no longer AFK.", "success", source, 5000) 108 | end 109 | --------------------------------------------------------------------------------