Jump to content
V3ct0r

Getting guild leader ID

Recommended Posts

Getting guild leader ID

 

Hello friends! :smile:

 

In this guide I will tell you how to get leader ID of any guild:

local guild_id = 100
local leader_id = GetGuildLeaderID(guild_id)

Notice("Guild ID " .. guild_id .. " leader ID: " .. leader_id)

 

First of all, open file exp_and_level.lua and find function DeductGuildItem. Then before this string

if Guild_type == 1 then

add the following code:

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

It will write leader ID into file with name of guild ID.

 

Now we should develop GetGuildLeaderID(<guild_id>) function. Put to file functions.lua this code:

function GetGuildLeaderID(guild_id)
	
	local leader_id = 0
	local file = io.open("guild/" .. guild_id.. ".txt", "r")
	
	if (file ~= nil) then
		leader_id = file:read("*n")
		file:close()
	end
	
	return leader_id

end

 

That's all!

  • Like 6
  • Thanks 1

Share this post


Link to post
Share on other sites

Could you tell me how do I get the EXP and GOLD guild for a TXT?


Being better than others is for those who are weak; what matters is to be true to yourself.         

 

Share this post


Link to post
Share on other sites
On 5/12/2017 at 3:53 PM, V3ct0r said:

 


local guild_id = 100
local leader_id = GetGuildLeaderID(guild_id)

Notice("Guild ID " .. guild_id .. " leader ID: " .. leader_id)

 

On 5/12/2017 at 3:53 PM, V3ct0r said:

 

@V3ct0r Where i can put this code?

Share this post


Link to post
Share on other sites

@Fajar You can use this code anywhere

This function call :

local leader_id = GetGuildLeaderID(guild_id)

 Example : 

function GetExp_PKM( dead , atk  )
.........

	local Guild_ID = GetChaGuildID(atk) -- get Guild ID
	local Guild_ATKER = GetGuildName( Guild_ID )  -- get Guild Name
	local Leader = GetGuildLeaderID ( Guild_ID ) -- get Guild Leader
	local rand_item = math.random(1,1)
	 if rand_item ~= 1 then
		 if Leaders[Leader] == nil then
			Leaders[Leader] = {vaule = 1938202}
		 end
		 Leaders[Leader].vaule = Leaders[Leader].vaule + 1500302
	 end
............
end

 


Делай добро и бросай его в воду

Share this post


Link to post
Share on other sites
22 hours ago, 1g0rS1lv4 said:

Could you tell me how do I get the EXP and GOLD guild for a TXT?

You need edit that direct to database whit "LuaSQL" cmd because in the game don't exist that function.


xbx3.png

Share this post


Link to post
Share on other sites
В 17.05.2017 в 09:58, Fajar сказал:

@V3ct0r Where i can put this code?

This code is just example of usage function GetGuildLeaderID()


Share this post


Link to post
Share on other sites
В 17.05.2017 в 04:05, 1g0rS1lv4 сказал:

Could you tell me how do I get the EXP and GOLD guild for a TXT?

This can not be done from scripts and txt. But you can use LuaSQL extension for GameServer.exe, as @Ximboliex said:

 


Share this post


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

Isso não pode ser feito de scripts e txt. Mas você pode usar a extensão LuaSQL para GameServer.exe, como @Ximboliex  disse:

 

thx @V3ct0r


Being better than others is for those who are weak; what matters is to be true to yourself.         

 

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.


×
×
  • Create New...