• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Searching function

Shawak

Intermediate OT User
Joined
Sep 11, 2008
Messages
1,984
Solutions
2
Reaction score
119
Location
Germany
GitHub
Shawak
I am searching for a function to kick a player from a party, someone know a good one?
I still don't find anything.
 
You can write this function if you know c++.
Helpful function to write lua function(kick player from party) will be bool Party::leave(Player* player); in party.h and party.cpp
It's very easy.
 
In luascript.cpp
Code:
int32_t LuaScriptInterface::luaDoKickPlayerFromParty(lua_State* L)
{
	uint32_t cid = popNumber(L);

	ScriptEnviroment* env = getScriptEnv();
	if(Player* player = env->getPlayerByUID(cid))
	{
		if(Party* party = player->getParty())
			g_game.playerLeaveParty(player);
		else
			lua_pushnil(L);
	}
	else
	{
		reportErrorFunc(getErrorDesc(LUA_ERROR_PLAYER_NOT_FOUND));
		lua_pushboolean(L, false);
	}

	return 1;
}
Try it :)
using:
Code:
DoKickPlayerFromParty(cid)
In luascript.h
Code:
static int32_t luaDoKickPlayerFromParty(lua_State* L);
In luascript.cpp(in function -> void LuaScriptInterface::registerFunctions())
Code:
lua_register(m_luaState, "DoKickPlayerFromParty", LuaScriptInterface::luaDoKickPlayerFromParty);
 
Back
Top