OnPlayerSpawn: Difference between revisions

From Onset Developer Wiki
Created page with "<syntaxhighlight lang="Lua"> function OnPlayerSpawn(player) end AddEvent("OnPlayerSpawn", OnPlayerSpawn) </syntaxhighlight>"
 
Chloe (talk | contribs)
mNo edit summary
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Info|Event|Server & Client|1.0}}
{{FuncDescription|Called when a player spawns. This usually happens after they died. Use [[SetPlayerRespawnTime]] to control how long it takes before they respawn.}}
{{FuncSyntax|OnPlayerSpawn(playerid)}}
{{FuncSyntaxClient|OnPlayerSpawn()}}
{{FuncParameters}}
{{FuncParam|playerid|The player who has spawned.}}
== Example ==
<syntaxhighlight lang="Lua">
<syntaxhighlight lang="Lua">
function OnPlayerSpawn(player)
function OnPlayerSpawn(playerid)
 
    AddPlayerChat(playerid, "You have spawned, is this a surprise?")
end
end
AddEvent("OnPlayerSpawn", OnPlayerSpawn)
AddEvent("OnPlayerSpawn", OnPlayerSpawn)
</syntaxhighlight>
</syntaxhighlight>
{{RelatedFunctions}}
{{PlayerEvents}}

Latest revision as of 08:03, 16 January 2020

OnPlayerSpawn

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

Description

Called when a player spawns. This usually happens after they died. Use SetPlayerRespawnTime to control how long it takes before they respawn.

Syntax

OnPlayerSpawn(playerid)
Client Syntax
OnPlayerSpawn()

Parameters

  • playerid
    The player who has spawned.

Example

function OnPlayerSpawn(playerid)
    AddPlayerChat(playerid, "You have spawned, is this a surprise?")
end
AddEvent("OnPlayerSpawn", OnPlayerSpawn)

See also