• 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!

Lua Function doPlayerLeaveParty(cid)

Syntax

Developer
Joined
Oct 10, 2007
Messages
2,890
Reaction score
458
Location
Texas
Example:
Code:
doPlayerLeaveParty(cid)

luascript.cpp
After the line: lua_register(m_luaState, "doPlayerJoinParty", LuaInterface::luaDoPlayerJoinParty);
ADD:
Code:
	//doPlayerLeaveParty(cid)
	lua_register(m_luaState, "doPlayerLeaveParty", LuaInterface::luaDoPlayerLeaveParty);
After the function: int32_t LuaInterface::luaDoPlayerJoinParty(lua_State* L) ADD:
Code:
int32_t LuaInterface::luaDoPlayerLeaveParty(lua_State* L) //lifeline feature
{
	//doPlayerLeaveParty(cid)
	ScriptEnviroment* env = getEnv();

	Player* player = env->getPlayerByUID(popNumber(L));
	if(!player)
	{
		errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
		lua_pushboolean(L, false);
	}
	g_game.playerLeaveParty(player->getID());
	lua_pushboolean(L, true);
	return 1;
}
luascript.h
After the line: static int32_t luaDoPlayerJoinParty(lua_State* L);
ADD:
Code:
		static int32_t luaDoPlayerLeaveParty(lua_State* L); //lifeline feature

Enjoy.
 
works fine, but i don't find useful it, right click in your char, click on leave party is the same thing
 
-.- its for a script maybe?..

EG. If player attacks party member -> doplayerleaveparty... something like that. Be grateful :p
 
I mean it doesn't works when the player is attacking, only leave the party when you haven't pz, test it
 
ah so it does. ok, well that last idea is out then, still useful to someone out there.
 
Its a great script for forcing a player to leave a party with gm command or such, thx :)
 
This is untested but it contains a fix, so you can force a leave even when the player is pz locked.

Code:
doPlayerLeaveParty(cid[, ignorePZ = false])
Code:
int32_t LuaInterface::luaDoPlayerLeaveParty(lua_State* L) //lifeline feature
{
	//doPlayerLeaveParty(cid[, ignorePZ])
	ScriptEnviroment* env = getEnv();
	bool ignorePZ = false;
        int32_t params = lua_gettop(L);
	
	if(params > 1)
		ignorePZ = popNumber(L);

	Player* player = env->getPlayerByUID(popNumber(L));
	if(!player || player->isRemoved())
	{
		errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
		lua_pushboolean(L, false);
	}
	if(!player->getParty() || player->hasCondition(CONDITION_INFIGHT) && !ingorePZ)
	{
		lua_pushboolean(L, false);
	}
	player->getParty()->leave(player);
	lua_pushboolean(L, true);
	return 1;
}


kind regards, Evil Hero
 
Last edited:
Is there a function that make like i got a item i can only use it one time
(but i will dont make item)
 
I've edited it, should be working fine now.

kind regards, Evil Hero.
 
Back
Top