Revision Difference
GM:PlayerInitialSpawn#565649
<function name="PlayerInitialSpawn" parent="GM" type="hook">
<description>
Called when the player spawns for the first time.
See <page>GM:PlayerSpawn</page> for a hook called every player spawn.
<note>This hook is called before the player has fully loaded, when the player is still in seeing the `Starting Lua` screen. For example, trying to use the <page>Entity:GetModel</page> function will return the default model (`models/player.mdl`).</note>
</description>
<realm>Server</realm>
<args>
<arg name="player" type="Player">The player who spawned.</arg>
<arg name="transition" type="boolean">If `true`, the player just spawned from a map transition.</arg>
<arg name="transition" type="boolean">If `true`, the player just spawned from a [map transition](https://developer.valvesoftware.com/wiki/Level_Transitions). (Specifically via `trigger_changelevel` or `point_changelevel` entities)</arg>
</args>
</function>
<example>
<description>Prints the name of the player joining.</description>
<code>
function GM:PlayerInitialSpawn(ply)
print( ply:Nick() .. " joined the server." )
end
-- That way you are overriding the default hook.
-- You can use hook.Add to make more functions get called when this event occurs.
hook.Add( "PlayerInitialSpawn", "some_unique_name", function( ply )
print( ply:Nick() .." joined the game." )
end)
</code>
<output>
```
Player1 joined the game.
```
</output>
</example>
Garry's Mod
Rust
Steamworks
Wiki Help