/*==========================================
* @changegm by durf (changed by Lupus)
* Changes Master of your Guild to a specified guild member
*------------------------------------------*/
ACMD_FUNC(changegm)
{
struct guild *g;
struct map_session_data *pl_sd;
nullpo_retr(-1, sd);
if (agit_flag == 1) {
clif_displaymessage(fd, "You cannot use this command when woe is in progress.");
return -1;
}
if (sd->status.guild_id == 0 || (g = guild_search(sd->status.guild_id)) == NULL || strcmp(g->master,sd->status.name))
{
clif_displaymessage(fd, "You need to be a Guild Master to use this command.");
return -1;
}
if( map[sd->bl.m].flag.guildlock )
{
clif_displaymessage(fd, "You cannot change guild leaders on this map.");
return -1;
}
if( !message[0] )
{
clif_displaymessage(fd, "Command usage: @changegm <guildmember name>");
return -1;
}
if((pl_sd=map_nick2sd((char *) message)) == NULL || pl_sd->status.guild_id != sd->status.guild_id) {
clif_displaymessage(fd, "Target character must be online and be a guildmate.");
return -1;
}
guild_gm_change(sd->status.guild_id, pl_sd);
return 0;
}