Referência de funções
GameMaker Studio · GML · Groups & clans
gmda_transferGroupLeadership
Transfers leadership from the caller to another member (leader only).
Asynchronous (result via event)
Signature
gmda_transferGroupLeadership(player_key) -> realWhat it does
POSTs /groups/members/transfer-leadership, then queues group_leadership_transferred { success, response }. The current leader hands the leader role to the target member and is typically demoted to admin. On failure e.error carries the raw server message, e.g. "Insufficient rank", "Player is not a member of your group", "You cannot target yourself", or "Player not found".
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| player_key | string | required | Key of the member who becomes the new leader. |
How to call it
Call it, then read group_leadership_transferred from gmda_pollEvent(). Only the current leader may do this; use it instead of gmda_assignGroupRole() to grant the "leader" role.
Result event: group_leadership_transferred { success, response }
Example
gmda_transferGroupLeadership(player_key);
var e = gmda_pollEvent();
while (!is_undefined(e)) {
if (e.event == "group_leadership_transferred") {
if (e.success) show_debug_message("New leader assigned");
else show_debug_message("Failed: " + e.error);
}
e = gmda_pollEvent();
}Use cases
- Hand off a clan before the leader leaves.
- Pass leadership to a co-founder or veteran member.