OnPlayerJoin: Difference between revisions
From Onset Developer Wiki
Created page with "{{Info|Event|Server|1.0}} {{FuncDescription|Called when a player is fully connected to the server. The game has started on the client.}} {{FuncSyntax|OnPlayerJoin(player)}}..." |
No edit summary |
||
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.}} | {{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.}} | ||
{{FuncSyntax|OnPlayerJoin(player)}} | {{FuncSyntax|OnPlayerJoin(player)}} | ||
Line 9: | Line 9: | ||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua"> | |||
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)..' from '..GetPlayerLocale(player)..' joined the server</>') | |||
AddPlayerChatAll('<span color="#eeeeeeaa">There are '..GetPlayerCount()..' players on the server</>') | |||
end | |||
AddEvent("OnPlayerJoin", OnPlayerJoin) | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
{{ServerEvents}} | {{ServerEvents}} |
Revision as of 19:11, 22 March 2019
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.
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)..' from '..GetPlayerLocale(player)..' joined the server</>')
AddPlayerChatAll('<span color="#eeeeeeaa">There are '..GetPlayerCount()..' players on the server</>')
end
AddEvent("OnPlayerJoin", OnPlayerJoin)
See also
Player
- OnPlayerServerAuth
- OnPlayerSteamAuth
- OnPlayerDownloadFile
- OnPlayerStreamIn
- OnPlayerStreamOut
- OnPlayerPickupHit
- OnPlayerJoin
- OnPlayerQuit
- OnPlayerSpawn
- OnPlayerDeath
- OnPlayerWeaponShot
- OnPlayerDamage
- OnPlayerChat
- OnPlayerChatCommand
- OnPlayerInteractDoor
- OnPlayerChangeDimension
Vehicle
- OnPlayerEnterVehicle
- OnPlayerLeaveVehicle
- OnPlayerStateChange
- OnVehicleRespawn
- OnVehicleStreamIn
- OnVehicleStreamOut
- OnVehicleDamage
- OnVehicleChangeDimension
- OnVehicleCreated
- OnVehicleDestroyed
Game
Package
NPC
- OnNPCReachTarget
- OnNPCDamage
- OnNPCSpawn
- OnNPCDeath
- OnNPCStreamIn
- OnNPCStreamOut
- OnNPCChangeDimension
- OnNPCCreated
- OnNPCDestroyed
Object
- OnObjectStopMoving
- OnObjectChangeDimension
- OnObjectCreated
- OnObjectDestroyed
- OnObjectStreamIn
- OnObjectStreamOut