OnPlayerConnect: Difference between revisions
Jump to navigation
Jump to search
(New page: __NOTOC__ {{Server event}} This event is triggered when a player attempts to connect to the server. ==Parameters== <syntaxhighlight lang="lua"> string playerNick, string playerIP, string playerUsername,...) |
mNo edit summary |
||
Line 12: | Line 12: | ||
*'''playerUsername''': The player's community username. | *'''playerUsername''': The player's community username. | ||
*'''playerSerial''': The player's serial number. | *'''playerSerial''': The player's serial number. | ||
==Cancel effect== | ==Cancel effect== |
Revision as of 19:51, 10 March 2009
This event is triggered when a player attempts to connect to the server.
Parameters
string playerNick, string playerIP, string playerUsername, string playerSerial
- playerNick: The player's current nickname.
- playerIP: The player's current IP.
- playerUsername: The player's community username.
- playerSerial: The player's serial number.
Cancel effect
If this event is canceled, the player will be disconnected with an error message saying "Disconnected: server refused the connection".
Example
This example cancels connection attempts of people who use the nick "Player" or outputs some data about the connecting player otherwise.
--when a player connects function playerConnect (playerNick, playerIP, playerUsername, playerSerial) if playerNick == "Player" then --check if his nick is "Player" cancelEvent() --in that case refuse the connection else --output some data about the player outputChatBox (playerNick.." just connected to the server.") outputChatBox ("IP: "..playerIP.." Username: "..playerUsername.." Serial: "..playerSerial) end end --add the playerConnect function as a handler for onPlayerConnect addEventHandler ("onPlayerConnect", getRootElement(), playerConnect)
See Also
Player events
- onPlayerACInfo
- onPlayerBan
- onPlayerChangeNick
- onPlayerChat
- onPlayerClick
- onPlayerCommand
- onPlayerConnect
- onPlayerContact
- onPlayerDamage
- onPlayerJoin
- onPlayerLogin
- onPlayerLogout
- onPlayerMarkerHit
- onPlayerMarkerLeave
- onPlayerModInfo
- onPlayerMute
- onPlayerNetworkStatus
- onPlayerPickupHit
- onPlayerPickupLeave
- onPlayerPickupUse
- onPlayerPrivateMessage
- onPlayerQuit
- onPlayerScreenShot
- onPlayerSpawn
- onPlayerStealthKill
- onPlayerTarget
- onPlayerUnmute
- onPlayerVehicleEnter
- onPlayerVehicleExit
- onPlayerVoiceStart
- onPlayerVoiceStop
- onPlayerWasted
- onPlayerWeaponFire
- onPlayerWeaponSwitch
Event functions
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled