Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.

Latest commit

 

History

History
102 lines (81 loc) · 2.84 KB

File metadata and controls

102 lines (81 loc) · 2.84 KB

Archiving Older Repos (Focus on ps-mdt v3)

To help streamline things a bit around here (for the little work we actually do 😅), I’m going to be archiving the repos listed below. This doesn’t mean they’re broken or unusable, it just means we won’t be pushing any further updates to them for now.

Our main focus moving forward will be ps-mdt v3 and its dependencies.

ps-zones

image

Purpose

The purpose of this script is to create and handle polyzones more efficiently for zone enter/leave events. Every zone is added to a overarching combozone which greatly improves perfomance looping over the normal distance checking via coords/distance of a point.

The data passed into the exports is optional and not required.

Each Polyzone needs to have a UNIQUE NAME otherwise it will get triggered each time there is a zone.

Dependency:

Events

These events are triggered when a player enters/leaves a zone.

Client

RegisterNetEvent("ps-zones:enter", function(ZoneName, ZoneData)
    -- Code here
end)

RegisterNetEvent("ps-zones:leave", function(ZoneName, ZoneData)
    -- Code here
end)

Server

RegisterServerEvent("ps-zones:enter", function(ZoneName, ZoneData)
    -- Code here
end)

RegisterServerEvent("ps-zones:leave", function(ZoneName, ZoneData)
    -- Code here
end)

Client Exports:

exports["ps-zones"]:CreatePolyZone(name, points, data)

exports["ps-zones"]:CreateBoxZone(name, point, length, width, data)

exports["ps-zones"]:CreateCircleZone(name, point, radius, data)

exports["ps-zones"]:CreateEntityZone(name, entity, data)

exports["ps-zones"]:DestroyZone(name)

Examples:

-- Create Polyzone
exports["ps-zones"]:CreatePolyZone("poly-test", {
      vector2(-7.88, -1058.93),
      vector2(0.03, -1058.67),
      vector2(-3.75, -1054.05),
    }, {
        debugPoly = true,
        minZ =  38.16 - 1,
        maxZ =  38.16 + 1,
})

-- Create Box Zone
RegisterCommand("box", function()
    local ped = PlayerPedId()
    local coords = GetEntityCoords(ped)
    exports["ps-zones"]:CreateBoxZone("box-test", coords, 2.0, 2.0, {
        debugPoly = true,
        heading = 0.0,
        minZ = coords.z - 1,
        maxZ = coords.z + 1,
    })
end)

-- Create Circle Zone
RegisterCommand("circle", function()
    local ped = PlayerPedId()
    local coords = GetEntityCoords(ped)
    exports["ps-zones"]:CreateCircleZone("circle-test", coords, 5.0, {
        debugPoly = true,
        minZ = coords.z - 1,
        maxZ = coords.z + 1,
    })
end)

-- Create Entity Zone
RegisterCommand("entity", function()
    local ped = PlayerPedId()
    exports["ps-zones"]:CreateEntityZone("entity-test", ped, {
        debugPoly = true,
        useZ = false,
    })
end)