Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating Patrol Route natives #811

Merged
merged 7 commits into from
Oct 30, 2023
Merged

Conversation

XenoS-ITA
Copy link
Contributor

i documented updating information on the two native ADD_PATROL_ROUTE_NODE and ADD_PATROL_ROUTE_LINK.
i attach below the code i used to test the information i wrote:

local _0 = vector3(-1084.17, -477.15, 36.63)
local _1 = vector3(-1083.59, -485.5, 36.58)
local _2 = vector3(-1077.57, -478.0, 36.67)
local _3 = vector3(-1082.03, -463.55, 36.58)

RequestModel(`mp_m_securoguard_01`)

while not HasModelLoaded(`mp_m_securoguard_01`) do
    Citizen.Wait(1)
end

local ped= CreatePed(`mp_m_securoguard_01`, _0, 0.0, true)

-- Create the patrol
OpenPatrolRoute("miss_test")
AddPatrolRouteNode(0, "StandGuard", _0, _1, 5000)
AddPatrolRouteNode(1, "StandGuard", _1, _2, 5000)
AddPatrolRouteNode(2, "StandGuard", _2, _3, 5000)
AddPatrolRouteNode(3, "StandGuard", _3, _0, 5000)
AddPatrolRouteLink(0, 1)
AddPatrolRouteLink(1, 2)
AddPatrolRouteLink(2, 3)
AddPatrolRouteLink(3, 0)
ClosePatrolRoute()
CreatePatrolRoute()

-- Draw Lines to see the route
Citizen.CreateThread(function()
    while true do
        DrawLine(_0, _1, 255, 0, 0, 255)
        DrawLine(_1, _2, 0, 255, 0, 255)
        DrawLine(_2, _3, 0, 0, 255, 255)
        DrawLine(_3, _0, 0, 255, 255, 255)
        Citizen.Wait(1)
    end
end)

TaskPatrol(ped, "miss_test", 1, 0, 1)

Copy link
Contributor

@4mmonium 4mmonium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you!

@thorium-cfx thorium-cfx merged commit 99e6a16 into citizenfx:master Oct 30, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants