diff --git a/bot/scrcustom.cpp b/bot/scrcustom.cpp index 55522bd..e1891b6 100644 --- a/bot/scrcustom.cpp +++ b/bot/scrcustom.cpp @@ -45,8 +45,9 @@ static cell AMX_NATIVE_CALL n_SetTimer(AMX *amx, cell *params) // native KillTimer(timerid) static cell AMX_NATIVE_CALL n_KillTimer(AMX *amx, cell *params) { - // TODO: n_KillTimer - return 0; + pNetGame->GetTimers()->Kill(params[1]); + + return 1; } // native GetTickCount() diff --git a/bot/scrtimers.cpp b/bot/scrtimers.cpp index a5983cb..2862979 100644 --- a/bot/scrtimers.cpp +++ b/bot/scrtimers.cpp @@ -55,3 +55,17 @@ DWORD CScriptTimers::New(char* szScriptFunc, int iInterval, BOOL bRepeating, AMX //---------------------------------------------------------------------------------- +void CScriptTimers::Kill(DWORD dwTimerId) +{ + DwordTimerMap::iterator itor; + itor = m_Timers.find(dwTimerId); + if (itor != m_Timers.end()) + { + itor->second->iRemainingTime = 0; + itor->second->bKilled = true; + itor->second->bRepeating = false; + } +} + +//----------------------------------------------------------- + diff --git a/bot/scrtimers.h b/bot/scrtimers.h index 9002159..03b3b61 100644 --- a/bot/scrtimers.h +++ b/bot/scrtimers.h @@ -28,6 +28,7 @@ public: ~CScriptTimers(); DWORD New(char* szScriptFunc, int iInterval, BOOL bRepeating, AMX* pAMX); + void Kill(DWORD dwTimerId); void FreeMem(ScriptTimer_s* Timer); };