Skip to main content

Entity::setNoCollision

Calling this function, regardless of the 'unknown' value, disabled collision between two entities.

Importance of entity1 and 2 order is unclear.

Syntax​

entity.setNoCollision(entity2, enableThisFrame);

Required Arguments​

  • entity2: Entity handle
  • enableThisFrame: Boolean
    • false = disabled forever, true = disabled only this frame

Return value​

  • Undefined

Example​

Client-Side

//to re-enable collision just stop executing the code, the game will re-enable it on its own.
mp.events.add('render', () => {
if (!mp.players.local.vehicle) return;
mp.players.forEachInRange(mp.players.local.position, 50, (target) => {
if (!target.vehicle) return;
mp.players.local.vehicle.setNoCollision(target.vehicle.handle, true);
target.vehicle.setNoCollision(mp.players.local.vehicle.handle, true);
});
});