EntityStreamIn: Difference between revisions
m (Replaced HTML with template) |
No edit summary |
||
| Line 1: | Line 1: | ||
This event is triggered when a car or player enters the stream zone | This event is triggered when a car or player enters the stream zone | ||
{{ClientsideCsJsEvent}} | |||
{{CSharpContainer| | |||
<syntaxhighlight lang="c#"> | |||
public delegate void OnEntityStreamInDelegate(Entity entity); | |||
</syntaxhighlight> | |||
{{Parameters}} | |||
* '''entity''' - vehicle '''RAGE.Elements.Entity''' | |||
== | {{Example}} | ||
{{ | The example below sends a message to client when an entity comes within stream range, showing the entity mode, position and remoteId. | ||
<syntaxhighlight lang="c#"> | |||
Events.OnEntityStreamIn += OnEntityStreamIn; | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="c#"> | |||
public void OnEntityStreamIn(RAGE.Elements.Entity entity) | |||
{ | |||
RAGE.Chat.Output($"{entity.Model} streamed in at {entity.Position} with serverside id:{entity.RemoteId}"); | |||
} | |||
</syntaxhighlight> | |||
}} | |||
{{JSContainer| | |||
{{Example}} | |||
<pre> | <pre> | ||
// Other player streams in | // Other player streams in | ||
Revision as of 14:06, 29 November 2018
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 - vehicle RAGE.Elements.Entity
Example
The example below sends a message to client when an entity comes within stream range, showing the entity mode, 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);
});