Object::ObjectWeak: Difference between revisions
(Created page with "{{SharedFunctionJS}} Creates an instance of a multiplayer object from a game object handle {{JSContainer| ==Syntax== {{SharedCode| <pre> mp.objects.newWeak(handle); </pre>...") |
No edit summary |
||
| Line 1: | Line 1: | ||
{{ | {{ClientsideJsFunction}} | ||
{{JSContainer| | |||
Converts a static game object into RAGEMP's objects api. | |||
==Required Params== | |||
*'''handle:''' {{RageType|number}} | |||
==Return Value== | |||
*''' {{RageType|ObjectMp}} ''' | |||
==Syntax== | ==Syntax== | ||
<pre> | <pre> | ||
mp.objects.newWeak(handle); | mp.objects.newWeak(handle); | ||
</pre> | |||
==Example== | |||
{{ClientsideCode| | |||
<pre> | |||
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. | |||
} | |||
</pre> | </pre> | ||
}} | }} | ||
}} | }} | ||
==See also== | |||
{{Object_definition_c}} | |||
[[Category: | [[Category:Clientside API]] | ||
Latest revision as of 10:00, 19 August 2024
Client-Side Function
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
- Functions:
- Object::Object
- Object::ObjectWeak
- Object::ObjectWeapon
- Object.hasBeenBroken
- Object.isVisible
- Object.markForDeletion
- Object.placeOnGroundProperly
- Object.setActivatePhysicsAsSoonAsItIsUnfrozen
- Object.setPhysicsParams
- Object.setTargettable
- Object.slide
- Object.createGlowStyle
- Object.releaseGlowStyle
- Object.modifyGlowStyle
- Object.enableGlow