Jump to content

Recommended Posts

Hello dev, i need problem, functions guild.get_name() or guild.name() dont work in my quests. I have 40k game

Spoiler

quest guild_name begin
    state start begin
        when 11000.chat."Gname" begin
            say(""..guild.get_name().."")
        end
    end
end

Where can be problem? Or how to fix it?

Thanks for your tips.

Link to comment
https://metin2.dev/topic/12979-guildget_name-not-work/
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

	int guild_get_name(lua_State * L)
	{
		if (!lua_isnumber(L, 1))
		{
			lua_pushstring(L,  "");
			return 1;
		}

		CGuild * pkGuild = CGuildManager::instance().FindGuild((DWORD) lua_tonumber(L, 1));

		if (pkGuild)
			lua_pushstring(L, pkGuild->GetName());
		else
			lua_pushstring(L, "");

		return 1;
	}

That means, you have to enter the guild id. The function will return empty string if you don't

- Jodie

Link to comment
https://metin2.dev/topic/12979-guildget_name-not-work/#findComment-74303
Share on other sites

38 minutes ago, Jodie said:

	int guild_get_name(lua_State * L)
	{
		if (!lua_isnumber(L, 1))
		{
			lua_pushstring(L,  "");
			return 1;
		}

		CGuild * pkGuild = CGuildManager::instance().FindGuild((DWORD) lua_tonumber(L, 1));

		if (pkGuild)
			lua_pushstring(L, pkGuild->GetName());
		else
			lua_pushstring(L, "");

		return 1;
	}

That means, you have to enter the guild id. The function will return empty string if you don't

- Jodie

Yes, it works when i type  guild.get_name(1), but i need use:
g_name = mysql_query("SELECT name FROM player.guild_dungeon WHERE id='1' LIMIT 1")[1][1]
if guild.get_name() == g_name then
 

and updating for name is:
update = mysql_query("UPDATE player.guild_dungeon SET name='"..guild.get_name().."' WHERE id='1' LIMIT 1")[1]

and i need to work automatically

 can you help me please?

Link to comment
https://metin2.dev/topic/12979-guildget_name-not-work/#findComment-74319
Share on other sites

5 minutes ago, Jodie said:

Then use, pc.get_guild(). It returns guild id if you have a guild. Otherwise it will return zero.


guild.get_name(player.get_guild())

- Jodie

Thank you very much! problem solved :)
btw.. pc.get_guild() 

Link to comment
https://metin2.dev/topic/12979-guildget_name-not-work/#findComment-74321
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.