InviteToParty
Sends a party invitation - the mode’s /invite.
The server checks both players (connected, not the same, the target in no party and with no invitation pending, the
inviter’s party not full), asks OnPartyInvite, and puts the toast with its countdown on the target’s screen - two
keys answer it, or the mode’s AcceptPartyInvite / DeclinePartyInvite. The party is made when the invitation is
accepted, with the inviter leading, when they have none; an inviter who is already in one invites into it. The
invitation belongs to that party: the inviter leaving it does not withdraw it; the party filling or ending, or a side
disconnecting, does.
Syntax
Section titled “Syntax”InviteToParty(from, target)| Parameter | Type | |
|---|---|---|
from |
number | the inviter |
target |
number | the player to invite |
Returns
Section titled “Returns”true, or false, reason - "not connected", "self", "in a party" (the target), "full", "pending" (the target has one already) or "refused" (OnPartyInvite said no)
Example
Section titled “Example”elseif cmd == "invite" then local target = GetPlayerId(args) if not target then SendClientMessage(pid, COLOUR_RED, "No such player.") return true end local ok, reason = InviteToParty(pid, target) if ok then SendClientMessage(pid, COLOUR_SERVER, "Invited " .. GetPlayerName(target) .. ".") else SendClientMessage(pid, COLOUR_RED, "Cannot invite: " .. reason .. ".") end return trueSee also
Section titled “See also”AcceptPartyInvite · DeclinePartyInvite · OnPartyInvite · GetPlayerPartyInvite · the Parties group of the index
