OnPlayerDiscordJoin
Jump to navigation
Jump to search
Important Note: This event is experimental and can be removed at any time. |
This event is triggered when a player accepts game invites from a user in discord or click on "Join" button from that player.
Parameters
bool justConnected, string key
- justConnected: If true, player connected to the server using game invite, otherwise he's already in the game and not joined the server using discord invite.
- key: The key passed by setPlayerDiscordJoinParams to the player who invited this user.
Source
The source of this event is the player who is invited to the game/clicked the "Join" button.
Example
This example will announce the server that who invited that user from discord.
function discordJoin(justConnected, key) local myName = getPlayerName(source) if justConnected == true then outputChatBox ( myName .. " been referred here by " .. key ) else outputChatBox ( myName .. " wanna play with " .. key ) end local refer = getPlayerFromName(key) setElementData(refer, "myUsers", getElementData(refer, "myUsers") + 1) setPlayerDiscordJoinParams(refer, key, key, getElementData(refer, "myUsers"), 5) end addEventHandler("onPlayerDiscordJoin", getRootElement(), discordJoin) function storeDiscordParams() local myName = getPlayerName(source) setPlayerDiscordJoinParams(source, myName, myName, 1, 5) setElementData(source, "myUsers", 1) end addEventHandler("onPlayerJoin", getRootElement(), storeDiscordParams)
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