• 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 onPrepareDeath(cid, deathlist) problem

Xagul

deathzot.net
Joined
Jun 30, 2008
Messages
1,295
Solutions
3
Reaction score
1,039
I am currently using
Code:
onPrepareDeath(cid, deathlist)
to handle how players die. Basically instead of being killed, logged out, then logging back in and rejoining your party I wanted it to just teleport you to temple and handle the deathloss, frags, ect. This is all working fine however when you die and get teleported to temple it does not clear your deathlist so if you go die to a random monster again the player that originally attacked/killed you gets another frag. I am looking for a way to clear deathlist after teleporting them to temple.
 
I don't follow, are you referring to damageMap.clear()? If so can I use this in a lua script?
 
Pseudo code:
[cpp]int32_t LuaInterface::luaDoCreatureClearDamageMap(lua_State *L)
{

ScriptEnviroment *env = getEnv();
if( Creature *creature = env->getCreatureByUID(popNumber(L)) ) {
creature->damageMap.clear();
lua_pushboolean(L, true);
}
else {
errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
lua_pushboolean(L, false);
}

return 1;
}[/cpp]

Should work, give it a shot.
 
Tried it, does not seem to work :( when the player is pked he gets teleported to temple, there doCreatureClearDamageMap(cid) is executed and when he runs back out and dies randomly the first pker gets a second frag regardless if he did damage the second time or not.
 
Back
Top