Jump to content
Sign in to follow this  
Vasil

Question Guild Detection

Recommended Posts

Hi , i'm actually scripting a new system [Guild Leveling System]

I got blocked on a part.

It's to detect if the member is the Guild Leader and if the player is in guild

 

Guild Leader Detection : To Upgrade the Guild Level

 

Player In Guild Detection : For the bonus of stats of guild & the Glow

 

Any help would be appreciated

Thank's In Advance

Edited by Vasil

Share this post


Link to post
Share on other sites

There is a way to detect if a player belongs to a guild, it will just return the ID of the guild back. If you are using variables/tables to store all things related to your guild system, then that might be a useful thing.

GetChaGuildID(Player)

About a check to see if leader or not, haven't searched enough in files yet.

You may additionally retrieve guild's name when inserting their guild ID with this function.

GetGuildName(GuildID)

Well I tried looking for a function that checks if a player is/isn't leader of the guild it currently is member of and I couldn't find anything. Yet I remember that the NPC that lets bid against other guilds in other to participated in guild wars only allows you to bid only if you are leader (if I'm not mistaken), so maybe it is done internally within the GameServer.

Edited by Angelix

Share this post


Link to post
Share on other sites

Hello @Vasil

 

There is no such function. As a solution you can write leader id to file when he makes guild. Then make function which will read that file and return leader id.


Share this post


Link to post
Share on other sites
4 hours ago, Angelix said:

There is a way to detect if a player belongs to a guild, it will just return the ID of the guild back. If you are using variables/tables to store all things related to your guild system, then that might be a useful thing.


GetChaGuildID(Player)

About a check to see if leader or not, haven't searched enough in files yet.

You may additionally retrieve guild's name when inserting their guild ID with this function.


GetGuildName(GuildID)

Well I tried looking for a function that checks if a player is/isn't leader of the guild it currently is member of and I couldn't find anything. Yet I remember that the NPC that lets bid against other guilds in other to participated in guild wars only allows you to bid only if you are leader (if I'm not mistaken), so maybe it is done internally within the GameServer.

Gonna test it , thank you :)

  • Like 1

Share this post


Link to post
Share on other sites

exp_and_level.lua, function DeductGuildItem()

 

before the line

if Guild_type == 1 then

add

 
    local file = io.open("guild/"..GetChaGuildID(role)..".txt", "w+")
    if file ~= nil then
        file:write (GetRoleID(role))
        file:close()
    end
 

 

functions.lua, add new function IsGuildLeader()

function IsGuildLeader(role)
    local result = 0
    if HasGuild(role) ~= 0 then
        local file = io.open("guild/"..GetChaGuildID(role)..".txt", "r")
        if file ~= nil then
            if GetRoleID(role) == file:read("*n") then
                result = 1
            end
            file:close()
        end
    end
    return result
end

 

Credits to Larein from Russian community

  • Like 2

Share this post


Link to post
Share on other sites
2 hours ago, V3ct0r said:

exp_and_level.lua, function DeductGuildItem()

 

before the line


if Guild_type == 1 then

add


 
    local file = io.open("guild/"..GetChaGuildID(role)..".txt", "w+")
    if file ~= nil then
        file:write (GetRoleID(role))
        file:close()
    end
 

 

functions.lua, add new function IsGuildLeader()


function IsGuildLeader(role)
    local result = 0
    if HasGuild(role) ~= 0 then
        local file = io.open("guild/"..GetChaGuildID(role)..".txt", "r")
        if file ~= nil then
            if GetRoleID(role) == file:read("*n") then
                result = 1
            end
            file:close()
        end
    end
    return result
end

 

Credits to Larein from Russian community

Thank you , i completted my Guild Leveling System now , works perfect .Thank you again :)

Share this post


Link to post
Share on other sites
1 hour ago, Vasil said:

Thank you , i completted my Guild Leveling System now , works perfect .Thank you again :)

 

Can you show us what you did? I am a bit interested

  • Like 1

logo-big.png   logo.png

                                   Sunny Go! Online                                                                    pko.host                                                 

Share this post


Link to post
Share on other sites
1 hour ago, Shako said:

 

Can you show us what you did? I am a bit interested

-[*]Levelable Guild MemberShip System
-[*]Additional Stats For Your Character
-[*]Registration by NPC
-[*]Max Level for the MemberShip is Level 4.
-[*]Made GetGuildLv Function to obtain Member Guild MemberShip Level(Used on NPC)

-[*]Increase Drop Rate Percentage for a Little Bit : Lv1 +5% Drop Rate Lv2 +10% Lv3 +15% Lv4 +20%

-[*]A Bonus of Exp Rate

Share this post


Link to post
Share on other sites

For check if is Guild Leader i've did it:

 

function IsGuildLeader(role)
	local Alliance = GetChaGuildID(role)
	local PlayerID = GetCharID(role)
	local LeaderID = GetGuildLeaderID(Alliance)
		if PlayerID ~= LeaderID then return LUA_FALSE else return LUA_TRUE
	end
end

 

I think GetGuildLeaderID is in V3ct0r GameSv, if i'm sure.

  • Like 1

lelouch_signature_by_vahntheknight-d4uafwj.png

Share this post


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

For check if is Guild Leader i've did it:

 


function IsGuildLeader(role)
	local Alliance = GetChaGuildID(role)
	local PlayerID = GetCharID(role)
	local LeaderID = GetGuildLeaderID(Alliance)
		if PlayerID ~= LeaderID then return LUA_FALSE else return LUA_TRUE
	end
end

 

I think GetGuildLeaderID is in V3ct0r GameSv, if i'm sure.

For sure i'll use these scripts to modify my system.Thanks :)

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...