Vasil 71 Report post Posted October 10, 2016 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. Quote Share this post Link to post Share on other sites
MonkeyCode 453 Report post Posted October 10, 2016 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 Quote Share this post Link to post Share on other sites
Eviles 179 Report post Posted October 10, 2016 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 ... Quote Share this post Link to post Share on other sites
Vasil 71 Report post Posted October 10, 2016 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. Quote Share this post Link to post Share on other sites