Jump to content
  • 0

Remote command/way to change the leader of a guild


rqueen

Question


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  82
  • Reputation:   1
  • Joined:  04/30/13
  • Last Seen:  

Hello, first of, I'm not sure if I've posted this in the correct section. If not, my apologies and please feel free to move this.

 

I need a new command or NPC that can change the guild leader of a certain guild. This becomes a problem when we have to block a player and he happens to be holding ownership of an active guild.

Link to comment
Share on other sites

6 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  341
  • Reputation:   43
  • Joined:  01/10/12
  • Last Seen:  


map,x,y,z script Guild Transfer 100,{

if (!getgmlevel())

end;

mes "Input: Old Guild Master Name";

input .@old$;

next;

mes "Input: New Guild Master Name";

input .@new$;

next;

set .@nb, query_sql("select guild_id from guild_member where name in ('" + escape_sql(.@new$) + "', '" + escape_sql(.@old$) + "') order by name", .@GID);

if (.@GID[0] != .@GID[1] && .@GID != getcharid(2, .@old$)) {

mes .@new$ + " and " + .@old$ + " are not in the same guild.";

close;

}

if (getguildmaster(.@GID) != .@old$) {

mes .@old$ + " is not a guild master.";

close;

}

if (guildchangegm(.@GID, .@new$)) {

mes "Successful!";

close;

}

else {

set $changeGM$[getarraysize($changeGM$)], .@new$;

mes "It will be transferred once the user is online.";

close;

}

OnPCLoginEvent:

for (set .@i, 0; .@i < getarraysize($changeGM$); set .@i, .@i + 1)

if (strcharinfo(0) == $changeGM$[.@i]) {

guildchangegm(getcharid(2), $changeGM$[.@i]);

deletearray $changeGM$[.@i], 1;

}

end;

}

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  127
  • Reputation:   36
  • Joined:  01/21/13
  • Last Seen:  

Alternatively (as the server administrator), you could temporarily unblock the player's account and log into it; use @changegm <target player's name> to pass control over to a different player (must be online). Even if you were to run a database change via NPC script, it wouldn't update ownership properly until the server is restarted.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  82
  • Reputation:   1
  • Joined:  04/30/13
  • Last Seen:  

Hi, bumping this. I don't mind if it needs to wait for a server restart. I really just want an NPC to do this.

 

Maybe someone can use this script as a base?

prontera.gat,161,190,5    script    Guild Name Changer    100,{
mes "Hello, can I change your guildname for you at the cost of 1 Emperium?";
if( countitem(714)&&!(select("Yes:No")-1)&&BaseLevel>=23 ) {
goto L_start;
}
mes "Either you don't have Emperium your baselevel isn't 23 or higher or you just don't want to make a guild.";
close;
L_start:
if(!getcharid(2)) {
mes "I'm sorry but you don't have a guild.";
} else {
mes "Tell me what to call your guild.";
set @guildname$,"";
while(@guildname$==""){input(@guildname$);}
query_sql("SELECT `guild_id`,`master`  FROM `guild` WHERE `guild_id` = '"+ getcharid(2) +"';",.@a,.@b$);
if(.@b$!=strcharinfo(0)){ mes "I'm sorry but you're not the leader of "+strcharinfo(2)+"."; close; }
set .@a,"";
query_sql("SELECT `name` FROM `guild` WHERE `name` = '"+ @guildname$ +"';",.@a$);
npctalk .@a$;
if(.@a$!=""){ mes "I'm sorry but you can't take others' guildnames, please try again."; next; goto L_start; }
query_sql("UPDATE `guild` SET `name`='"+escape_sql(@guildname$)+"' WHERE `guild_id`='"+getcharid(2)+"'");
delitem 714, 1;
mes @guildname$+" successfully created!";
mes "Changes will take effect after server restart!";
next;
}
mes "Done!";
close;
}


Except make it an NPC accessible by GMs only, and of course the original request above. Preferably eA-compatible as well. XD

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

[spoiler=Blah]

Lol I made a script to but my computer froze when I posted it.

 

[spoiler=Older Versions]

-	script	GLC	-1,{
OnWhisperGlobal:
	if(@whispervar0$ == ""  || getgmlevel() < 60 || @whispervar1$ == "") end;
	set .@a, getcharid(2,@whispervar0$)?
		getcharid(2,@whispervar0$):atoi(@whispervar0$);
	set .@d$, getguildmaster(.@a);
	if(.@d$ == "null") { message strcharinfo(0),"No guild was found!"; end; }
	else if(.@d$ == @whispervar1$) { message strcharinfo(0),"He's already the guild master!"; end; }
	if(getcharid(3,@whispervar1$)) set .@b$, @whispervar1$;
	else set .@b$, rid2name(atoi(@whispervar1$));
	message strcharinfo(0),guildchangegm(.@a,.@b$)?
		"Guild leader successfully changed!":"Player or guild not found!";
	end;
}

 

-	script	GLC	-1,{
OnWhisperGlobal:
	if(@whispervar0$ == ""  || getgmlevel() < 60 ) end;
	set .@a, getcharid(2,@whispervar0$)?getcharid(2,@whispervar0$):atoi(@whispervar0$);
	set .@e, getcharid(3,@whispervar1$)?getcharid(3,@whispervar1$):atoi(@whispervar1$);
	set .@d$, getguildmaster(.@a);
	if( @whispervar1$=="" && getcharid(0,@whispervar0$) )
		set .@b$, @whispervar0$;
	if( isloggedin(.@e) ) {
		if( rid2name(.@e) == @whispervar1$ ) set .@b$, @whispervar1$;
		else set .@b$, rid2name(atoi(@whispervar1$));
	}	
	if(.@d$ == "null") { message strcharinfo(0),"No guild was found!"; end; }
	else if(.@d$ == .@b$) { message strcharinfo(0),"He's already the guild master!"; end; }
	message strcharinfo(0),guildchangegm(.@a,.@b$)?
		"Guild leader successfully changed!":"Player or guild not found!";
	end;
}
-	script	GLC	-1,{
OnWhisperGlobal:
	if(@whispervar0$ == ""  || getgmlevel() < 60) end;
	set .@a, getcharid(2,@whispervar0$)?getcharid(2,@whispervar0$):atoi(@whispervar0$);
	set .@e, getcharid(3,@whispervar1$)?getcharid(3,@whispervar1$):atoi(@whispervar1$);
	set .@d$, getguildmaster(.@a);
	set .@f$, strcharinfo(0);
	if(isloggedin(.@e)) {
		set .@b$, rid2name(.@e);
		if( rid2name(.@e) == @whispervar1$ )
			set .@b$, @whispervar1$;
	}
	if(@whispervar1$ == "" && .@a) set .@b$, @whispervar0$;
	if(.@d$ == "null") { message .@f$,"No guild was found!"; end; }
	if(.@d$ == .@b$) { message .@f$,"He's already the guild master!"; end; }
	message .@f$, guildchangegm(.@a,.@b$)?
		"Guild leader successfully changed!":"Player not found!";
	end;
}

 

The guild master doesn't have to be online but the person you're switching the guild to has to be in the guild and online at the time!!.

 

Usage: Whisper npc ( I believe rAthena will also accept CharacterID )

NPC:GLC (<GuildID> or <Player Name>)#(<AccountID> or <Character Name>)

 

[spoiler=Examples:]

NPC:GLC 1#LovelyPlayer
NPC:GLC LovelyPlayer#LovelyPlayer
NPC:GLC 1#2000002
NPC:GLC LovelyPlayer#2000002

 

Edit-- Added a shorter options all others still apply though.

NPC:GLC LovelyPlayer
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  82
  • Reputation:   1
  • Joined:  04/30/13
  • Last Seen:  

Hi! Thanks to both of you. I've tried and tested both Joseph's and Skorm's.
I decided to implement them both to our server, in case certain scenarios will need either.

 

Joseph's is working perfectly.

I tried Skorm's, but I keep getting a "No guild was found!" message. I've tried all available ways given above, except the ones that need GID(there's no fast/easy way to get GID here atm).

 

EDIT: Also, if it's not any trouble, could it have an additional function of being able to invite players to a guild even if there are no inviters online?

Edited by rqueen
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

Hi! Thanks to both of you. I've tried and tested both Joseph's and Skorm's.

I decided to implement them both to our server, in case certain scenarios will need either.

 

Joseph's is working perfectly.

I tried Skorm's, but I keep getting a "No guild was found!" message. I've tried all available ways given above, except the ones that need GID(there's no fast/easy way to get GID here atm).

 

EDIT: Also, if it's not any trouble, could it have an additional function of being able to invite players to a guild even if there are no inviters online?

 

No, it definitely works on eAthena... As I said before.

 

The guild master doesn't have to be online but the person you're

switching the guild to has to be in the guild and online at the time!!

 

-	script	GLC	-1,{
function f_recovery;
OnWhisperGlobal:
	if(@whispervar0$ == ""  || getgmlevel() < 60) end;
	set .@a, getcharid(2,@whispervar0$)?getcharid(2,@whispervar0$):atoi(@whispervar0$);
	set .@e, getcharid(3,@whispervar1$)?getcharid(3,@whispervar1$):atoi(@whispervar1$);
	set .@g, getarraysize(.recovery$);
	set .@d$, getguildmaster(.@a);
	set .@f$, strcharinfo(0);
	
	if(@whispervar1$ == "" && .@a) set .@b$, @whispervar0$;
	if(!getcharid(0,@whispervar0$)) {
		if(!f_recovery()) {
			set(.recovery$[.@g],@whispervar0$);
			message .@f$,"Character is offline but will be granted guild leader when logged in."; 
		} else message .@f$,"Character has been removed from the list!";
		end;
	}
	if(isloggedin(.@e)) {
		set .@b$, rid2name(.@e);
		if( rid2name(.@e) == @whispervar1$ )
			set .@b$, @whispervar1$;
	}
	if(!.@a) { message .@f$,"No guild was found!"; end; }
	if(.@d$ == .@b$) { message .@f$,"He's already the guild master!"; end; }
	message .@f$, guildchangegm(.@a,.@b$)?
		"Guild leader successfully changed!":"Player not found!";
	end;

OnPCLoginEvent:
function f_recovery;
	sleep2 2000;
	if(f_recovery())
		guildchangegm(getcharid(2),strcharinfo(0));
	
	function	f_recovery	{
		while(.@i<getarraysize(.recovery$)) {
			if(.recovery$[.@i]==strcharinfo(0)) {
				deletearray .recovery$[.@i],1;
				return 1;
			}
			set .@i,.@i+1;
		} return 0;
	}
}

This one has offline support so it should work either way except I didn't write them to permanent global variables.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...