Object::notifyStreaming: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 6: Line 6:
*'''enable:''' {{RageType|Boolean}}
*'''enable:''' {{RageType|Boolean}}


== Syntax ==
<pre>
object.notifyStreaming = enable;
</pre>
== Example ==
== Example ==


Line 36: Line 40:
     if (!object) return;
     if (!object) return;
     object.notifyStreaming = enable;
     object.notifyStreaming = enable;
     mp.console.logInfo(`Enabled stream-in for object id ${object.remoteId}`);
     mp.console.logInfo(`Changed stream-in value of object remote id ${object.remoteId} to ${enable}`);
})
})
</syntaxhighlight >
</syntaxhighlight >

Latest revision as of 17:06, 24 April 2024

This property, if true, will call EntityStreamIn for the Object.

Default: false

Setter

  • enable: Boolean

Syntax

object.notifyStreaming = enable;

Example

Server-Side
mp.events.addCommand('obj', (player) => {
    mp.objects.new(mp.joaat("bkr_prop_coke_block_01a"), player.position);
    //or you can directly call the event for all players players here eg:
    /*
        const obj = mp.objects.new(mp.joaat("bkr_prop_coke_block_01a"), player.position);
        mp.players.call('client::object:enableStreaming', [obj.id, true])
    */
})

//enable stream in for all players when the object is created
mp.events.add('entityCreated', (entity) => {
    if (entity.type === "object") {
        mp.players.call('client::object:enableStreaming', [entity.id, true])
    }
})


Client-Side
mp.events.add('client::object:enableStreaming', (remoteId, enable) => {
    const object = mp.objects.atRemoteId(remoteId);
    if (!object) return;
    object.notifyStreaming = enable;
    mp.console.logInfo(`Changed stream-in value of object remote id ${object.remoteId} to ${enable}`);
})

See Also