Jump to content
×
×
  • Create New...
  • 0

Kick functions like /dc with LUA


stefano9876

Question

10 answers to this question

Recommended Posts

  • 0
  • Moon

 

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

  • 0

I've tried, but it works only if you aren't a GM_PLAYER (a normal player).

It says, "This command doesn't exists".

I need a script that kicks the player if he/she doesn't meet some requisites.

This script needs to run with every "normal" character.

Link to comment
Share on other sites

  • 0
  • Moon

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

  • 0

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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


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.