Jump to content
Sign in to follow this  
Vasil

What is the used function to detect if player has left guild?

Recommended Posts

I am trying to upgrade my Levelable Guild Membership System.I've made it now to give stats & glow only if the player is into a guild.The only thing left for me is to make it detect if player has left guild to RemoveState after the player left guild.

Share this post


Link to post
Share on other sites

There is no current function that GameServer calls when player leaves a guild.
You can implement this @ src level (recently i did, so if i remember correctly, the lua function was called inside Guild::cmd_GuildLeave,

or copy structures and start function forwarding to Guild struct/class for DLL.

or...a workaround @ lua level:

if HasGuild(role) then
    tempArr[role] = true
end
if tempArr[role] and not HasGuild(role) then
    { ... } // where you execute your codes
end
 


kong.png

a2.png

Share this post


Link to post
Share on other sites

You did it using serialize, sure? What you used to save a guild on it? You can do when guild leader register it, save .txt file as Guild ID, it will be more easy to detect on State..

 

Registration Example:

 

GuildMemberREG = function(role)
	local GuildID 				= GetChaGuildID(role)
	local IsInGuild	   	 		= HasGuild(role)
	local PlayerName			= GetChaDefaultName(role)
	local GuildName				= GetGuildName(GuildID)	
	if(file_exists(Alliance.Path..""..GuildID..".txt") == false) then
		if IsInGuild ~= 0 then
			table.save({Guild = GuildName, Level = 0, Exp = 0, Gold = 0},Alliance.Path..""..GuildID..".txt","w")		
			HelpInfo(role,0,"The Alliance ["..GetGuildName(GuildID).."'s] has been registered into Reel Society battle center. For more info visit Kaiser in Thundoria Castle.")
			return LUA_TRUE
		else
			HelpInfo(role,0,"Kaiser: You are not in a guild yet..")	
				return LUA_FALSE
		end
	end
end

 

State Detection:

	local GuildID = GetChaGuildID(role)
	if(file_exists(Alliance.Path..""..GuildID..".txt") == true) then
		...

 

 


lelouch_signature_by_vahntheknight-d4uafwj.png

Share this post


Link to post
Share on other sites
3 minutes ago, Satan said:

You did it using serialize, sure? What you used to save a guild on it? You can do when guild leader register it, save .txt file as Guild ID, it will be more easy to detect on State..

 

Registration Example:

 


GuildMemberREG = function(role)
	local GuildID 				= GetChaGuildID(role)
	local IsInGuild	   	 		= HasGuild(role)
	local PlayerName			= GetChaDefaultName(role)
	local GuildName				= GetGuildName(GuildID)	
	if(file_exists(Alliance.Path..""..GuildID..".txt") == false) then
		if IsInGuild ~= 0 then
			table.save({Guild = GuildName, Level = 0, Exp = 0, Gold = 0},Alliance.Path..""..GuildID..".txt","w")		
			HelpInfo(role,0,"The Alliance ["..GetGuildName(GuildID).."'s] has been registered into Reel Society battle center. For more info visit Kaiser in Thundoria Castle.")
			return LUA_TRUE
		else
			HelpInfo(role,0,"Kaiser: You are not in a guild yet..")	
				return LUA_FALSE
		end
	end
end

 

State Detection:


	local GuildID = GetChaGuildID(role)
	if(file_exists(Alliance.Path..""..GuildID..".txt") == true) then
		...

 

 

i don't use levelable guild , i use Levelable Guild Membership , and i serialize only the chars registered and their membership lv.

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Sign in to follow this  

×
×
  • Create New...