OnPlayerStreamIn: Difference between revisions

From Onset Developer Wiki
(Created page with "{{Info|Event|Server|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|OnPlayerStreamIn}} {{FuncParameters}} == Example == __EDIT_ME__ {{RelatedFunctions}} {{ServerEvents}}")
 
mNo edit summary
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Info|Event|Server|1.0}}
{{Info|Event|Server & Client|1.0}}


{{FuncDescription|__EDIT_ME__}}
{{FuncDescription|Called when another user is streamed in (rendered) for the player.}}


{{FuncSyntax|OnPlayerStreamIn}}
{{FuncSyntax|OnPlayerStreamIn(player, otherplayer)}}
{{FuncSyntaxClient|OnPlayerStreamIn(otherplayer)}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|player|The player for the other player is streamed in.}}
{{FuncParam|otherplayer|The player that streams in for player.}}
== Example ==
== Example ==
__EDIT_ME__
'''A barebones example of syncing player clothing presets:'''
<syntaxhighlight lang="Lua>
function OnPlayerStreamIn(player)
-- Assuming `_modelPreset` is the player's clothing preset id,
-- set their clothing so the client doesn't see them naked.
local _modelPreset = GetPlayerPropertyValue(player, "_modelPreset")
if (_modelPreset ~= nil and _modelPreset > 0) then
SetPlayerClothingPreset(player, _modelPreset)
end
end
AddEvent("OnPlayerStreamIn", OnPlayerStreamIn)
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
{{ServerEvents}}
{{PlayerEvents}}

Latest revision as of 08:04, 16 January 2020

OnPlayerStreamIn

Type: Event
Context: Server & Client
Introduced: v1.0

Description

Called when another user is streamed in (rendered) for the player.

Syntax

OnPlayerStreamIn(player, otherplayer)
Client Syntax
OnPlayerStreamIn(otherplayer)

Parameters

  • player
    The player for the other player is streamed in.
  • otherplayer
    The player that streams in for player.

Example

A barebones example of syncing player clothing presets:

function OnPlayerStreamIn(player)
	-- Assuming `_modelPreset` is the player's clothing preset id,
	-- set their clothing so the client doesn't see them naked.
	local _modelPreset = GetPlayerPropertyValue(player, "_modelPreset")
	if (_modelPreset ~= nil and _modelPreset > 0) then
		SetPlayerClothingPreset(player, _modelPreset)
	end
end
AddEvent("OnPlayerStreamIn", OnPlayerStreamIn)

See also