EntityOverlayBatch:destroy

From RAGE Multiplayer Wiki
Revision as of 09:28, 4 August 2024 by Shr0x (talk | contribs) (Created page with " {{ClientsideJsFunction}} {{JSContainer| This method will destroy an entity overlay batch. ===Return value=== *''' {{RageType|void}} ''' ==Syntax== <syntaxhighlight lang="javascript"> batch.destroy(); </syntaxhighlight> ==Example== <syntaxhighlight lang="javascript"> //Enable entity overlay batch mp.game.graphics.setEntityOverlayPassEnabled(true); //Create new entity overlay batch let batch = mp.game.graphics.createEntityOverlayBatch(overlayParams); //Add a vehicle...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Client-Side
Function

 JavaScript



JavaScript Syntax

This method will destroy an entity overlay batch.

Return value

  • void

Syntax

batch.destroy();

Example

//Enable entity overlay batch
mp.game.graphics.setEntityOverlayPassEnabled(true);

//Create new entity overlay batch
let batch = mp.game.graphics.createEntityOverlayBatch(overlayParams);

//Add a vehicle to overlay batch once the player enters in them.
mp.events.add('playerEnterVehicle', (vehicle) => {
    batch.add(vehicle);
});

//Add an event to destroy the created batch, and then call it from where ever you want.
mp.events.add("client_batch_destroy", () => {
    batch.destroy();
    mp.console.logInfo(`Entity overlay batch was destroyed successfully.`);
})


See also