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

QuaS

Cykotitan Pwned =/
Joined
Sep 11, 2008
Messages
838
Reaction score
28
Location
Poland/ Wroclaw
I didn't relase anything last time, so here we go.

luascript.h
PHP:
static int32_t luaGetTimeSinceLastMove(lua_State* L);
luascript.cpp

PHP:
 //getTimeSinceLastMove(cid) ms
	lua_register(m_luaState, "getTimeSinceLastMove", LuaInterface::luaGetTimeSinceLastMove);

[...]


int32_t LuaInterface::luaGetTimeSinceLastMove(lua_State* L)
{
    //getTimeSinceLastMove(cid) by quas
	ScriptEnviroment* env = getEnv();
	Creature* creature = env->getCreatureByUID(popNumber(L));
	if(!creature)
	{
		errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND));
		lua_pushboolean(L, false);
		return 1;
	}
	lua_pushnumber(L, creature->getTimeSinceLastMove());
	return 1;
}

Returns Time since last move in ms. Works with rev 3660+;

Example use: http://otland.net/f163/istrapped-cid-getthingsfrompos-pos-except-istileblocking-pos-103626/
 
Last edited:
Can easily be replaced by a LUA code.
Using an addEvent checking the pos of the player
 
@Azi

LAWL ??
GetTimeSinceLastMove
The function checks how much time you are at the same position.
If the player move the function will renew simple

I think you dont understand what this function does.
 
No, he meant if you use addEvent, the player can move and return to his previous position and your timed function will not notice he has moved since it hadn't ran yet....

Also it's more ineffective to use timers......
 
Back
Top