GameMaker Studio · GML · Groups & clans
gmda_sendGroupInvite
Invites a player to the caller's group (leader/officer only).
Signature
gmda_sendGroupInvite(player_key, [message]) -> realWhat it does
POSTs /groups/invitations/send, then queues group_invite_sent { success, response }. e.response is the raw server body: on success the invitation { id, group_id, to_player_key, to_player_name, status, message, created_at, expires_at } is at e.response.invitation. On failure e.error carries the raw server message, e.g. "This player is not accepting invitations", "Invitation already pending", "Group is full", "You cannot invite players", or "Player not found".
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| player_key | string | required | Key of the player to invite. |
| message | string | "" | Optional note (sanitized to max 200 chars). |
How to call it
Call it, then read group_invite_sent from gmda_pollEvent(). The caller needs invite permission. This is the group-to-player direction; the player responds with gmda_respondGroupInvitation().
Result event: group_invite_sent { success, response }
Example
gmda_sendGroupInvite(player_key, "Join us!");
var e = gmda_pollEvent();
while (!is_undefined(e)) {
if (e.event == "group_invite_sent") {
if (e.success) show_debug_message("Invited " + e.response.invitation.to_player_name);
else show_debug_message("Failed: " + e.error);
}
e = gmda_pollEvent();
}Use cases
- Let officers invite a friend into the clan.
- Recruit a player straight from their profile screen.