Witam chciałbym przerobić funkcje StopEvent, aby kasowała każdy event który gracz ma rozpoczęty bo niestety tak się nie dzieje. Przykład: mamy rozpoczęty na graczu 1 addevent i zaczniemy 2 to 1 i tak zostanie wykonany, chciałbym aby był był nadpisany "nowy" no albo po prostu all czyściło zrobi się nową funkcje i wsio oraz najlepiej dodać nowy parametr ze dla danego gracza.
o to funkcja
Czy ktoś wie jak to szybko napisać ? nie chce kombinować wiec postanowiłem napisać na forum?
Proszę o pomoc.
o to funkcja
Code:
int32_t LuaInterface::luaStopEvent(lua_State* L)
{
//stopEvent(eventid)
uint32_t eventId = popNumber(L);
ScriptEnviroment* env = getEnv();
LuaInterface* interface = env->getInterface();
if(!interface)
{
errorEx("No valid script interface!");
lua_pushboolean(L, false);
return 1;
}
LuaTimerEvents::iterator it = interface->m_timerEvents.find(eventId);
if(it != interface->m_timerEvents.end())
{
Scheduler::getInstance().stopEvent(it->second.eventId);
for(std::list<int32_t>::iterator lt = it->second.parameters.begin(); lt != it->second.parameters.end(); ++lt)
luaL_unref(interface->m_luaState, LUA_REGISTRYINDEX, *lt);
it->second.parameters.clear();
luaL_unref(interface->m_luaState, LUA_REGISTRYINDEX, it->second.function);
interface->m_timerEvents.erase(it);
lua_pushboolean(L, true);
}
else
lua_pushboolean(L, false);
return 1;
}
Czy ktoś wie jak to szybko napisać ? nie chce kombinować wiec postanowiłem napisać na forum?
Proszę o pomoc.