[bot] Implement/match n_KillTimer(...)

* Implement/match `CScriptTimers::Kill(...)`
This commit is contained in:
RD42 2024-08-29 23:15:47 +08:00
parent 323f51a166
commit 02b4a7b509
3 changed files with 18 additions and 2 deletions

View File

@ -45,8 +45,9 @@ static cell AMX_NATIVE_CALL n_SetTimer(AMX *amx, cell *params)
// native KillTimer(timerid) // native KillTimer(timerid)
static cell AMX_NATIVE_CALL n_KillTimer(AMX *amx, cell *params) static cell AMX_NATIVE_CALL n_KillTimer(AMX *amx, cell *params)
{ {
// TODO: n_KillTimer pNetGame->GetTimers()->Kill(params[1]);
return 0;
return 1;
} }
// native GetTickCount() // native GetTickCount()

View File

@ -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;
}
}
//-----------------------------------------------------------

View File

@ -28,6 +28,7 @@ public:
~CScriptTimers(); ~CScriptTimers();
DWORD New(char* szScriptFunc, int iInterval, BOOL bRepeating, AMX* pAMX); DWORD New(char* szScriptFunc, int iInterval, BOOL bRepeating, AMX* pAMX);
void Kill(DWORD dwTimerId);
void FreeMem(ScriptTimer_s* Timer); void FreeMem(ScriptTimer_s* Timer);
}; };