SetPlayerDiscordJoinParams: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Server function}} __NOTOC__ This function allows you to set a user's Discord join/invite parameters. It's necessary to use this function to enable that option on Discord....")
 
m (likely to change)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Server function}}
{{Server function}} __NOTOC__
__NOTOC__
{{Important Note|The name of this function will change, so you should first check that the function exists before using it.<syntaxhighlight lang="lua">
This function allows you to set a user's Discord join/invite parameters.
if setPlayerDiscordJoinParams then
It's necessary to use this function to enable that option on Discord.
    setPlayerDiscordJoinParams(...)
end</syntaxhighlight>}}
{{New feature/item|3.0160|1.6|20463|This function allows you to set a user's Discord join/invite parameters.
It's necessary to use this function to enable that option on Discord.}}
 
Use empty string for '''key''' parameter to disable join/invite feature.


==Syntax==  
==Syntax==  
Line 12: Line 17:
===Required Arguments===  
===Required Arguments===  
*'''thePlayer:''' The [[player]] whose discord join parameters will be set on.
*'''thePlayer:''' The [[player]] whose discord join parameters will be set on.
*'''key:''' The key which will be called upon invited users (or users who joined the game by clicking "Join") onPlayerJoin event. (Limited to >=5 and <=64 characters)
*'''key:''' The key which will be called upon invited users (or users who joined the game by clicking "Join") onPlayerJoin event. (Limited to 64 characters, must not contain space character)
*'''partyId:''' Changing the partyId is useful to make invites expire. (Limited to >=5 and <=64 characters)
*'''partyId:''' Changing the partyId is useful to make invites expire. (Limited to 64 characters, must not contain space character)
*'''partyCurrentSize:''' The current number of used capacity for other users to join. (Can't be more than partyMaxSize)
*'''partyCurrentSize:''' The current number of used capacity for other users to join. (Can't be more than partyMaxSize)
*'''partyMaxSize:''' The total capacity for users inside the party.
*'''partyMaxSize:''' The total capacity for users inside the party. (Can't be greater than server max players)


===Returns===
===Returns===

Latest revision as of 10:22, 30 March 2020

[[{{{image}}}|link=|]] Important Note: The name of this function will change, so you should first check that the function exists before using it.
if setPlayerDiscordJoinParams then
    setPlayerDiscordJoinParams(...)
end

This function allows you to set a user's Discord join/invite parameters. It's necessary to use this function to enable that option on Discord.

Use empty string for key parameter to disable join/invite feature.

Syntax

bool setPlayerDiscordJoinParams ( element thePlayer, string key, string partyId, int partyCurrentSize, int partyMaxSize )

OOP Syntax Help! I don't understand this!

Method: player:setDiscordJoinParams(...)


Required Arguments

  • thePlayer: The player whose discord join parameters will be set on.
  • key: The key which will be called upon invited users (or users who joined the game by clicking "Join") onPlayerJoin event. (Limited to 64 characters, must not contain space character)
  • partyId: Changing the partyId is useful to make invites expire. (Limited to 64 characters, must not contain space character)
  • partyCurrentSize: The current number of used capacity for other users to join. (Can't be more than partyMaxSize)
  • partyMaxSize: The total capacity for users inside the party. (Can't be greater than server max players)

Returns

Returns true if the value was set successfully, false otherwise.

Example

Click to collapse [-]
Server
function makeSomeParty ( playerSource, cmdName )
    setPlayerDiscordJoinParams(playerSource, "abcdefghijklmnopqrstuvwxyz", "abc123456", 1, 5)
end

addCommandHandler ( "makeParty", makeSomeParty )

See Also

Shared