Object::ObjectWeak

From RAGE Multiplayer Wiki
Revision as of 10:00, 19 August 2024 by Shr0x (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Client-Side
Function

 JavaScript



JavaScript Syntax

Converts a static game object into RAGEMP's objects api.

Required Params

  • handle: number

Return Value

  • ObjectMp

Syntax

mp.objects.newWeak(handle);

Example

Client-Side
let convertedObject = null;
const {x, y, z} = mp.players.local.position;
const gameobjectHandle = mp.game.object.getClosestObjectOfType(x, y, z, 10.0, mp.game.joaat("apa_heist_apart2_door"), false, false, false);

if (gameobjectHandle) {
    convertedObject = mp.objects.newWeak(gameobjectHandle);
    //now you can use RAGEMP's object api methods to control the newly converted object.
}



See also