Esc to clear, Enter to open the best match, click an export to open it in its page
World

Zones

A zone is an area of the world (a box, sphere or polygon) that knows when players enter and leave, and can enforce rules inside with no code of your own.

Making a zone

On the client, make one with RegisterZone: a 'box', a 'sphere' or a 'poly' (an outline with a min and max Z). The client checks its zones every Config.ZonePollInterval (300 ms). A zone every player shares, or the server must trust, is declared on the server with EnsureZone or drawn in the Zone Editor; it's saved, and you use its key everywhere (require = { zone = 'mrpd' } on an action).

-- Client, in Whip.register: a safe zone
exports.whip_core:RegisterZone({
    type = 'box', id = 'myres_station', pos = vec3(440, -980, 30), size = vec3(20, 20, 10),
    label = 'Police Station', group = 'police', notify = true,
    rules = { noPvP = true, noWeapons = true, heal = true },
    onEnter = function(zone) end,
    onExit = function(zone) end,
})

Rules#

RuleTypeInside the zone
noWeaponsboolWeapons removed on entry, re-equipping blocked
noPvPboolThe player can't be hurt, fire or melee
noMeleeboolNo punching or melee
disableFiringboolNo firing; carrying is fine
speedLimitnumberVehicle speed cap (km/h)
noVehiclesboolOut of the vehicle on entry: by the door, or bailing out of one that moves. Not a player the seat engine holds in their seat (HoldInSeat)
heal, healRatebool, numberGradual health regen, HP per tick (default 2)
noWantedLevelboolWanted level cleared and prevented
noCollisionboolNo ped-to-ped collision
noFallDamageboolNo fall damage; the player is collision-proof, so crashes and being run over do none either
jobWhitelist, aceWhitelist, charWhitelisttable, string, tableWho's authorised; meeting any one is enough
ejectUnauthorizedboolTeleports unauthorised players out

Events

Any client resource hears the local player cross any zone. On the server, give a zone trackPlayers = true and listen for the server events of the same names.

AddEventHandler('whip_core:zone:entered', function(zone)
    if zone.group == 'police' then --[[ zone.zoneId, zone.label ]] end
end)
AddEventHandler('whip_core:zone:exited', function(zone) end)

The Zone EditorServer owners#

/whip → World → Zones → Open the editor gives you a free camera: 1 / 2 / 3 draw a box, sphere or poly, scroll sizes it.