iZone has been reworked from the top of it, please do not use older version than 1.3.
Intro:
iZone is a zone managment system for FiveM.
It offers utlities to create, manage zone and detecting if a player is in a zone.
It also can trap a player in a zone! what a chance!
Dependency: mysql-async
What it looks like?
Admin Panel:
Zone Creation:
Ugly Prompt:
How to install it?
Download this repo:
-
git clone https://github.com/izio38/iZone.git
, or click the download button. - Execute
zones.sql
on your MySQL server.
Be sure to name the directory izone and not iZone
How to use it?
Zone creation is explained in the in-game panel.
Know if a player is in a zone:
Citizen.CreateThread(function()
while true do
Wait(100)
TriggerEvent("izone:isPlayerInZone", "zone1", function(isIn)
print(isIn)
end)
end
end)
TriggerEvent("izone:isPlayerInZone", "zone1", cb(val))
-> val can be either false, true or nil. nil if the zone doesn’t exist.
Trap a player in a zone:
First initiate the trap (it teleport the player in the zone if the player isn’t in there already):
TriggerEvent("izone:initiateATrapZone", "zone1")
Then stuck him to the zone (call every tick or every 100 ms, your call):
TriggerEvent("izone:trapPlayerInZone", "zone1")
See examples in example.lua
NB: Feel free to comment here, open issue, open pull request or just like the topic!