TGIANN Realistic FOV

:arrow_forward: Showcase Video :arrow_forward:

Tebex.io / TGIANN | Realistic FOV

Introduction

This script is designed for GTA 5 FiveM servers to simulate human vision by making NPCs within the player’s field of view semi-transparent. This feature helps players in roleplay scenarios by visually indicating which NPCs and players they haven’t seen, enhancing immersion and realism.

Features

  • Field of View Simulation: NPCs and Players within the character’s field of view are rendered semi-transparent, indicating they haven’t been seen by the player.
  • Immersive Roleplay: Enhances roleplay by providing visual cues about what the character can or cannot see.
  • Efficient Performance: The script is optimized with a low resmon value of 0.01, ensuring minimal impact on server performance.

TGIANN/tgiann-realistic-field-of-view (github.com)


Maybe these will interest you
TGIANN | Scripts (tebex.io)

Code is accessible Yes
Subscription-based No
Lines (approximately) 50+
Requirements None
Support No
16 Likes

Amazing Release Tgiann and very good for big serves. :clap: :clap:

1 Like

Good job making this free. Wild to me that people are charging for <50 lines of code.

Charge to full releases on proprietary gameplay loops and systems. Not for a few natives packaged together.

Good job!

3 Likes

This is the kind of script that one doesn’t know he needs until he sees it, good work lol

2 Likes

rip paid script :rofl: :rofl:

1 Like

yeah I agree with u

this is a cool idea, the only problem i noticed was when driving a car it thinks you can’t see the car you are inside. other than that this is great work.

With this code, when you press C, the character will see what is happening behind and your car will no longer become invisible.
This is all that is necessary for the script to work, the rest can be removed

local viewAngle = 180.0
local alpha = 100


function ChangeEntityAlpha(entity, alpha)
    local entityAlpha = GetEntityAlpha(entity)
    if entityAlpha == 0 then return end
    if entityAlpha == alpha then return end
    SetEntityAlpha(entity, alpha)
end

function CanSeeEntity(direction, playerForwardVector)
    return (direction.x * playerForwardVector.x + direction.y * playerForwardVector.y) > math.cos(math.rad(viewAngle))
end
Citizen.CreateThread(function()
    while true do
        local playerPed = PlayerPedId()
        local playerPos = GetEntityCoords(playerPed)
        local playerForwardVector = GetEntityForwardVector(playerPed)

        if IsControlPressed(0, 26) then 
            playerForwardVector = -playerForwardVector
        end


        local peds = GetGamePool('CPed')
        for _, ped in ipairs(peds) do
            if ped ~= playerPed then
                local pedPos = GetEntityCoords(ped)
                local direction = pedPos - playerPos
                local canSee = CanSeeEntity(direction, playerForwardVector)
                ChangeEntityAlpha(ped, canSee and 255 or alpha)
            end
        end

        local vehicles = GetGamePool('CVehicle')
        local playerVehicle = GetVehiclePedIsIn(playerPed, false)
        for _, vehicle in ipairs(vehicles) do
            if not DoesEntityExist(playerVehicle) and not vehicle == playerVehicle then
                local vehiclePos = GetEntityCoords(vehicle)
                local direction = vehiclePos - playerPos
                local canSee = CanSeeEntity(direction, playerForwardVector)
                ChangeEntityAlpha(vehicle, canSee and 255 or alpha)
            end
        end
        Wait(500)
    end
end)


1 Like

you find a fix for this?