int32_t LuaInterface::luaGetInFightTicks(lua_State* L)
{
ScriptEnviroment* env = getEnv();
Creature* creature = env->getCreatureByUID(popNumber(L));
Condition* condition = creature->getCondition(CONDITION_INFIGHT, (ConditionId_t)CONDITION_INFIGHT);
if(creature)
{
condition->getEndTime();
lua_pushnumber(L, true);
}else{
errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND));
lua_pushnumber(L, false);
}
return 1;
}
function onSay(cid, words, param, channel)
if not hasCondition(cid, CONDITION_INFIGHT) then
return doPlayerSendCancel(cid, "You Don't Have Pz") and doSendMagicEffect(getThingPos(cid), 2)
end
doPlayerSendTextMessage(cid,27, "You Have To Wait "..getInFightTicks(cid).." Second For Pz.")
return true
end
int32_t LuaScriptInterface::luaGetInFightTicks(lua_State* L)
{
ScriptEnvironment* env = getScriptEnv();
Creature* creature = env->getCreatureByUID(popNumber(L));
Condition* condition = creature->getCondition(CONDITION_INFIGHT, (ConditionId_t)CONDITION_INFIGHT);
if(creature)
{
condition->getEndTime();
pushBoolean(L, true);
}else{
reportErrorFunc(getErrorDesc(LUA_ERROR_CREATURE_NOT_FOUND));
pushBoolean(L, false);
}
return 1;
}
int32_t LuaScriptInterface::luaGetInFightTicks(lua_State* L)
{
Creature* creature = g_game.getCreatureByID(cid);
Condition* condition = creature->getCondition(CONDITION_INFIGHT, (ConditionId_t)CONDITION_INFIGHT);
if(creature)
{
condition->getEndTime();
pushNumber(L, true);
}else{
reportErrorFunc(getErrorDesc(LUA_ERROR_CREATURE_NOT_FOUND));
pushNumber(L, false);
}
return 1;
}
int32_t LuaScriptInterface::luaGetInFightTicks(lua_State* L)
{
uint32_t cid = popNumber(L);
Creature* creature = g_game.getCreatureByID(cid);
Condition* condition = creature->getCondition(CONDITION_INFIGHT, (ConditionId_t)CONDITION_INFIGHT);
if(creature)
{
condition->getEndTime();
pushNumber(L, true);
}else{
reportErrorFunc(getErrorDesc(LUA_ERROR_CREATURE_NOT_FOUND));
pushNumber(L, false);
}
return 1;
}
function onSay(cid, words, param, channel)
if not getCreatureCondition(cid, CONDITION_INFIGHT) then -- before is hasCondition.
return doPlayerSendCancel(cid, "You Don't Have Pz") and doSendMagicEffect(getThingPos(cid), 2)
end
doPlayerSendTextMessage(cid,27, "You Have To Wait "..getInFightTicks(cid).." Second For Pz.")
return true
end
" .. (math.floor(Player(cid):getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT):getEndTime() / 1000) - os.time()) .. "
local pzTime = player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT)
if pzTime then
msg = msg ..
"\n Fight Timer: " ..
player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT):getTicks() / 1000 .. " seconds"
else
msg = msg .. "\n Fight Timer: " .. 0
end
/home/kompilacja/otserv/src/luascript.cpp:16870:9: error: no declaration matches ‘int32_t LuaScriptInterface::luaGetInFightTicks(lua_State*)’
16870 | int32_t LuaScriptInterface::luaGetInFightTicks(lua_State* L)
| ^~~~~~~~~~~~~~~~~~
/home/kompilacja/otserv/src/luascript.cpp:16870:9: note: no functions named ‘int32_t LuaScriptInterface::luaGetInFightTicks(lua_State*)’
In file included from /home/kompilacja/otserv/src/luascript.cpp:25:
/home/kompilacja/otserv/src/luascript.h:203:7: note: ‘class LuaScriptInterface’ defined here
203 | class LuaScriptInterface
| ^~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/tfs.dir/build.make:621: CMakeFiles/tfs.dir/src/luascript.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:102: CMakeFiles/tfs.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
static int32_t luaGetInFightTicks(lua_State* L);
function onSay(player, words, param)
local condition = player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT) or
player:getCondition(CONDITION_INFIGHT, 1) or
player:getCondition(CONDITION_PZBLOCK)
if not condition then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Nie masz pz.")
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
local remaining = math.ceil(condition:getTicks() / 1000)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "PZ zniknie za " .. remaining .. " sekund.")
return false
end