OnPlayerJoin: Difference between revisions

From Onset Developer Wiki
No edit summary
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Info|Event|Server|1.0}}
{{Info|Event|Server|1.0}}


{{FuncDescription|Called when a player is fully connected to the server. The game has started on the client and the player is going to spawn after this event was executed.}}
{{FuncDescription|Called when a player is fully connected to the server. The game has started on the client and the player is going to spawn after this event was executed.
 
Called after [[OnClientConnectionRequest]] and after [[OnPlayerServerAuth]].}}


{{FuncSyntax|OnPlayerJoin(player)}}
{{FuncSyntax|OnPlayerJoin(player)}}
Line 14: Line 16:
SetPlayerSpawnLocation(player, 125773.000000, 80246.000000, 1645.000000, 90.0)
SetPlayerSpawnLocation(player, 125773.000000, 80246.000000, 1645.000000, 90.0)


AddPlayerChatAll('<span color="#eeeeeeaa">'..GetPlayerName(player)..' from '..GetPlayerLocale(player)..' joined the server</>')
AddPlayerChatAll('<span color="#eeeeeeaa">'..GetPlayerName(player)..' ('..player..') joined the server</>')
AddPlayerChatAll('<span color="#eeeeeeaa">There are '..GetPlayerCount()..' players on the server</>')
AddPlayerChatAll('<span color="#eeeeeeaa">There are '..GetPlayerCount()..' players on the server</>')
AddPlayerChat(player, "Welcome to the server!")
end
end
AddEvent("OnPlayerJoin", OnPlayerJoin)
AddEvent("OnPlayerJoin", OnPlayerJoin)
Line 21: Line 24:


{{RelatedFunctions}}
{{RelatedFunctions}}
{{ServerEvents}}
{{PlayerServerEvents}}

Latest revision as of 11:28, 1 September 2020

OnPlayerJoin

Type: Event
Context: Server
Introduced: v1.0

Description

Called when a player is fully connected to the server. The game has started on the client and the player is going to spawn after this event was executed.

Called after OnClientConnectionRequest and after OnPlayerServerAuth.

Syntax

OnPlayerJoin(player)

Parameters

  • player
    The player who has joined.

Example

function OnPlayerJoin(player)
    -- Set where the player is going to spawn.
	SetPlayerSpawnLocation(player, 125773.000000, 80246.000000, 1645.000000, 90.0)

	AddPlayerChatAll('<span color="#eeeeeeaa">'..GetPlayerName(player)..' ('..player..') joined the server</>')
	AddPlayerChatAll('<span color="#eeeeeeaa">There are '..GetPlayerCount()..' players on the server</>')
	AddPlayerChat(player, "Welcome to the server!")
end
AddEvent("OnPlayerJoin", OnPlayerJoin)

See also