Jump to content

Kick functions like /dc with LUA


Go to solution Solved by Aveline™,

Recommended Posts

If you are using 40k source, here ;

	int pc_disconnect(lua_State* L)
	{
		if (!lua_isstring(L, 1))
		{
			LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
			LPDESC d = DESC_MANAGER::instance().FindByCharacterName(ch->GetName());
			DESC_MANAGER::instance().DestroyDesc(d);
		}
		else
		{
			LPDESC d = DESC_MANAGER::instance().FindByCharacterName(lua_tostring(L, 1));
			LPCHARACTER tch = d ? d->GetCharacter() : NULL;
			if (!tch)
			{
				lua_pushnumber(L, 0);
				return 0;
			}
			DESC_MANAGER::instance().DestroyDesc(d);
		}
		return 1;
	}

Add these your questlua_pc.cpp

#include "desc_manager.h"

If you are using r34k, here lua function;

local pc = pc or {}

function pc::disconnect(name)
	if(name == "" or tostring(name) == nil) then
		command("quit")
	else
		local s = pc.select(find_pc_by_name(name))
		command("quit")
		pc.select(s)
	end
end

Best Regards

HaveBeen

  • Love 4

Plain logic saves lives.

Link to comment
Share on other sites

  • Bot

If you are using 40k source, here ;

	int pc_disconnect(lua_State* L)
	{
		if (!lua_isstring(L, 1))
		{
			LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
			LPDESC d = DESC_MANAGER::instance().FindByCharacterName(ch->GetName());
			DESC_MANAGER::instance().DestroyDesc(d);
		}
		else
		{
			LPDESC d = DESC_MANAGER::instance().FindByCharacterName(lua_tostring(L, 1));
			LPCHARACTER tch = d ? d->GetCharacter() : NULL;
			if (!tch)
			{
				lua_pushnumber(L, 0);
				return 0;
			}
			DESC_MANAGER::instance().DestroyDesc(d);
		}
		return 1;
	}

Add these your questlua_pc.cpp

#include "desc_manager.h"

If you are using r34k, here lua function;

local pc = pc or {}

function pc::disconnect(name)
	if(name == "" or tostring(name) == nil) then
		command("quit")
	else
		local s = pc.select(find_pc_by_name(name))
		command("quit")
		pc.select(s)
	end
end

Best Regards

HaveBeen

Thx, but i'm using the 2089 game files.

english_banner.gif

Link to comment
Share on other sites

  • Solution

 

If you are using 40k source, here ;

	int pc_disconnect(lua_State* L)
	{
		if (!lua_isstring(L, 1))
		{
			LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
			LPDESC d = DESC_MANAGER::instance().FindByCharacterName(ch->GetName());
			DESC_MANAGER::instance().DestroyDesc(d);
		}
		else
		{
			LPDESC d = DESC_MANAGER::instance().FindByCharacterName(lua_tostring(L, 1));
			LPCHARACTER tch = d ? d->GetCharacter() : NULL;
			if (!tch)
			{
				lua_pushnumber(L, 0);
				return 0;
			}
			DESC_MANAGER::instance().DestroyDesc(d);
		}
		return 1;
	}

Add these your questlua_pc.cpp

#include "desc_manager.h"

If you are using r34k, here lua function;

local pc = pc or {}

function pc::disconnect(name)
	if(name == "" or tostring(name) == nil) then
		command("quit")
	else
		local s = pc.select(find_pc_by_name(name))
		command("quit")
		pc.select(s)
	end
end

Best Regards

HaveBeen

Thx, but i'm using the 2089 game files.

 

 

 

lua function supported all versions.

 

Best Regards

HaveBeen

  • Love 2

Plain logic saves lives.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 13

      Metin2 Closed Beta Content (2003-2004)

    2. 0

      PRESENTATION PAGE [OLDGODSMT2 RELEASE]

    3. 25

      [SRC] Metin2 on LINUX - The Old Metin2 Project

    4. 2

      United/Club/Midgard serverfiles?

    5. 13

      Metin2 Closed Beta Content (2003-2004)

    6. 13

      Metin2 Closed Beta Content (2003-2004)

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • 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.