Cóż, funkcja dająca exhausted była mi bardzo potrzebna, więc ją sobie napisałem i postanowiłem się nią podzielić.
Jest ona bardzo prosta:
luascript.cpp
Szukamy:
Kod:
//doPlayerAddSkillTry(cid, skillid, n)
lua_register(m_luaState, "doPlayerAddSkillTry", LuaScriptInterface::luaDoPlayerAddSkillTry);
Kod:
//doPlayerAddExhaust(cid, exhaust)
lua_register(m_luaState, "doPlayerAddExhaust", LuaScriptInterface::luaDoPlayerAddExhaust);
Kod:
int32_t LuaScriptInterface::luaDoPlayerAddSkillTry(lua_State* L)
Kod:
int32_t LuaScriptInterface::luaDoPlayerAddExhaust(lua_State* L)
{
//doPlayerAddExhaust(uid, type, exhaust)
uint32_t exhaust = popNumber(L), type = popNumber(L);
ScriptEnviroment* env = getScriptEnv();
if(Player* player = env->getPlayerByUID(popNumber(L)))
{
player->addExhaust(exhaust, type);
lua_pushboolean(L, LUA_NO_ERROR);
}
else
{
reportErrorFunc(getErrorDesc(LUA_ERROR_PLAYER_NOT_FOUND));
lua_pushboolean(L, LUA_ERROR);
}
return 1;
}
Szukamy:
Kod:
static int32_t luaDoPlayerAddSkillTry(lua_State* L);
Kod:
static int32_t luaDoPlayerAddExhaust(lua_State* L);
Używamy pisząc:
doPlayerAddExhaust(uid, A, B)
Gdzie:
uid - gracz docelowy
A - rodzaj exhausted:
1 - na czary agresywne
2 - na czary nieagresywne
itd.
B - czas, długość exhausted
Zakładki