EntityStreamIn: Difference between revisions
No edit summary |
m (category) |
||
| (3 intermediate revisions by one other user not shown) | |||
| Line 6: | Line 6: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{Parameters}} | {{Parameters}} | ||
* '''entity''' - | * '''entity''' - the streamed in entity, expects '''RAGE.Elements.Entity''' | ||
{{Example}} | {{Example}} | ||
The example below sends a message to client when an entity comes within stream range, showing the entity | The example below sends a message to client when an entity comes within stream range, showing the entity model, position and remoteId. | ||
<syntaxhighlight lang="c#"> | <syntaxhighlight lang="c#"> | ||
Events.OnEntityStreamIn += OnEntityStreamIn; | Events.OnEntityStreamIn += OnEntityStreamIn; | ||
| Line 31: | Line 31: | ||
</pre> | </pre> | ||
}} | }} | ||
[[Category:Entity API]] | |||
[[Category:Client-side Event]] | |||
Latest revision as of 11:06, 30 April 2019
This event is triggered when a car or player enters the stream zone
Client-Side Event
C# Syntax
public delegate void OnEntityStreamInDelegate(Entity entity);
Parameters
- entity - the streamed in entity, expects RAGE.Elements.Entity
Example
The example below sends a message to client when an entity comes within stream range, showing the entity model, position and remoteId.
Events.OnEntityStreamIn += OnEntityStreamIn;
public void OnEntityStreamIn(RAGE.Elements.Entity entity)
{
RAGE.Chat.Output($"{entity.Model} streamed in at {entity.Position} with serverside id:{entity.RemoteId}");
}
JavaScript Syntax
Example
// Other player streams in
mp.events.add('entityStreamIn', (entity) => {
const isInvincible = entity.getVariable('isInvincible');
entity.setInvincible(!!isInvincible);
});