2023-10-29 22:26:43 +08:00
|
|
|
|
|
|
|
#ifndef SAMPSRV_TIMERS_H
|
|
|
|
#define SAMPSRV_TIMERS_H
|
|
|
|
|
2024-06-24 23:01:04 +08:00
|
|
|
struct ScriptTimer_s
|
|
|
|
{
|
2024-06-24 23:10:26 +08:00
|
|
|
char szScriptFunc[255];
|
|
|
|
int iTotalTime;
|
|
|
|
int iRemainingTime;
|
|
|
|
BOOL bRepeating;
|
|
|
|
BOOL bKilled;
|
|
|
|
AMX* pAMX;
|
|
|
|
int iParamCount;
|
2024-06-24 23:06:46 +08:00
|
|
|
void* cellParams;
|
2024-06-24 23:01:04 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::map<DWORD, ScriptTimer_s*> DwordTimerMap;
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class CScriptTimers
|
2023-10-29 22:26:43 +08:00
|
|
|
{
|
|
|
|
private:
|
2024-06-24 23:01:04 +08:00
|
|
|
DwordTimerMap m_Timers;
|
|
|
|
DWORD m_dwTimerCount;
|
2023-11-16 22:31:06 +08:00
|
|
|
public:
|
|
|
|
CScriptTimers();
|
2024-01-06 23:33:14 +08:00
|
|
|
~CScriptTimers();
|
2024-06-24 23:06:46 +08:00
|
|
|
|
2024-06-24 23:21:47 +08:00
|
|
|
void DeleteForMode(AMX* pEndedAMX);
|
2024-06-24 23:10:26 +08:00
|
|
|
DWORD New(char* szScriptFunc, int iInterval, BOOL bRepeating, AMX* pAMX);
|
2024-06-24 23:19:06 +08:00
|
|
|
DWORD NewEx(char* szScriptFunc, int iInterval, BOOL bRepeating, cell *params, AMX* pAMX);
|
2024-06-25 22:29:12 +08:00
|
|
|
void Delete(DWORD dwTimerId);
|
2024-06-24 23:20:29 +08:00
|
|
|
void Kill(DWORD dwTimerId);
|
2024-06-25 22:29:12 +08:00
|
|
|
void Process(int iElapsedTime);
|
2024-06-24 23:06:46 +08:00
|
|
|
void FreeMem(ScriptTimer_s* Timer);
|
2023-10-29 22:26:43 +08:00
|
|
|
};
|
|
|
|
|
2024-06-24 23:01:04 +08:00
|
|
|
//----------------------------------------------------------------------------------
|
|
|
|
|
2023-10-29 22:26:43 +08:00
|
|
|
#endif
|
2024-06-24 23:01:04 +08:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------
|
|
|
|
// EOF
|