Collision System
The collision system is the core protection mechanism of F5 Safezones. It manages entity ghosting, damage prevention, weapon restrictions, and server-side verification to create a safe, non-violent area.
Overview
When a player enters a safezone, the following systems activate:
Ghosting
Ghosting makes entities non-collidable with the safezone player. Ghosted entities become semi-transparent to visually indicate the effect.
How It Works
- The system scans for vehicles and NPCs within the configured
range(default 100m) - Collision is disabled between the player and detected entities using
SetEntityNoCollisionEntity - Entity transparency is set to the configured
vehicleAlpha(default 200/255) - When a vehicle is very close (< 5m), its transparency increases further (to 150/255) for visual clarity
- Player ghosting is handled separately — players in the same zone also become non-collidable
Player-to-Player Ghosting
When multiple players are in the same zone:
- Each player's collision with others in the zone is disabled
- Players appear semi-transparent to each other (configurable
playerAlpha) - The server coordinates ghosting by notifying all players in the zone when someone enters or leaves
- If a player's vehicle is ghosted, the vehicle is also ghosted for all zone occupants
Disabling Ghosting
Set enableGhosting = false on a zone to disable player and vehicle ghosting for that zone. Players will still be invincible and unable to use weapons, but they will collide normally with vehicles and other players.
Full Ghost Mode
Set collisionDisabled = true on a zone to enable full ghost mode. In this mode, the player passes through all nearby entities — vehicles, NPCs, and world objects (CObject) within the configured range (default 100m). This is the most aggressive collision mode available.
The field name is misleading — collisionDisabled = true does not skip collision processing. It enables maximum ghosting where all collisions are disabled for the player. The collision system runs at full capacity to ghost every entity in range.
Damage Prevention
Weapon Damage (Server-Side)
The server intercepts all weaponDamageEvent events:
- If the victim is in a safezone, damage is cancelled
- If the attacker is in a safezone, damage is cancelled and the attacker receives a notification
- This applies to all weapon types including melee
Vehicle Damage (Server-Side)
The server intercepts vehicleDamageEvent events:
- If any occupant of the target vehicle is in a safezone, vehicle damage is cancelled
- The attacker receives a "Vehicle damage is disabled in safe zones!" notification
Explosion Prevention (Server-Side)
The server intercepts all explosionEvent events:
- If any safezone player is within the configured
explosionRange(default 100m) of the explosion, it is cancelled entirely - The player who triggered the explosion receives a notification
Explosion cancellation protects all safezone players within range, not just the nearest one. However, cancelling the explosion also prevents it from affecting non-safezone players nearby.
Vehicle Protection (Client-Side)
While inside a safezone, the player's current vehicle receives additional protection:
| Protection | Description |
|---|---|
SetEntityCanBeDamaged(false) | Entity cannot take damage |
SetEntityInvincible(true) | Entity is invincible |
SetVehicleCanBeVisiblyDamaged(false) | No visual damage deformation |
SetVehicleEngineCanDegrade(false) | Engine health preserved |
SetVehicleTyresCanBurst(false) | Tires cannot pop |
Player Protection (Client-Side)
| Protection | Description |
|---|---|
SetPlayerInvincible(true) | Player-level invincibility (GTA native) |
SetEntityInvincible(true) | Entity-level invincibility |
SetEntityCanBeDamaged(false) | Player takes no damage |
SetPedSuffersCriticalHits(false) | Disables headshot multiplier |
SetEntityProofs (collision) | Collision-proof from vehicles |
SetPedCanRagdoll(false) | Prevents being knocked down |
SetPedCanBeKnockedOffVehicle(1) | Cannot be pulled from vehicle |
SetPedCanBeDraggedOut(false) | Cannot be dragged from vehicle |
SetPlayerCanBeHassledByGangs(false) | Prevents NPC gang harassment |
ClearPedBloodDamage | Removes blood effects |
ResetPedVisibleDamage | Removes visible damage |
Weapon Restrictions
Inside a safezone:
- The player's weapon is forced to
WEAPON_UNARMED - Firing controls are disabled (triggers, aiming)
- Drive-by is disabled
- Cover system is disabled
- Vehicle weapons are disabled if the zone has
disableVehicleWeaponsenabled (default)
Disabled Controls
The following control groups are disabled while in a safezone:
| Control ID | Action |
|---|---|
| 24, 25 | Attack / Aim |
| 37 | Select Weapon |
| 47 | Weapon (alternate) |
| 58 | Enter/exit vehicle weapon mode |
| 140, 141, 142 | Melee attacks |
| 257 | Attack 2 |
| 263, 264 | Melee |
| 114 | Vehicle fly attack |
| 331 | Vehicle mouse control |
| 99, 100 | Vehicle weapons |
| 357 | Vehicle fly weapon |
Server-Side Verification
F5 Safezones includes server-side anti-cheat verification:
Entry Verification
When a player claims to have entered a safezone, the server:
- Validates the zone name exists and is active
- Retrieves the player's actual server-side coordinates
- Verifies the player is actually within the zone boundaries
- Rejects the entry if verification fails, triggering
f5_safezones:entryRejectedon the client
Periodic Verification
A server-side thread runs every 5 seconds to verify all players in safezones:
- Checks if the player is still connected
- Checks if the player's ped still exists
- Checks if the zone still exists and is active
- Verifies the player's coordinates are still within the zone
Players who fail verification are forcefully exited from the safezone.
Position Tolerance
Server-side position checks include a 5.0 unit tolerance to account for network latency and minor desynchronization.
Cleanup
When a player exits a safezone or the resource stops:
- All ghosted entities have their collision restored
- All entity transparency is reset to original values
- Vehicle weapon restrictions are removed
- Player invincibility and proofs are removed
- Vehicle protection is removed
- Ragdoll physics are re-enabled
The cleanup runs immediately on exit with a comprehensive multi-pass sweep: ghosted players, ghosted entities, processed entities, all vehicles, all peds, and all objects in range are restored in a single operation.
See Also
- Zone Types — Protection Options — per-zone collision settings
- Configuration — Collision System — global collision settings
- Configuration — Performance — tune update intervals