mirror of
https://github.com/dashr9230/SA-MP.git
synced 2025-01-03 16:13:34 +08:00
[bot] Implement CGameMode::Frame()
This commit is contained in:
parent
0d0d4bb6af
commit
94e372378f
@ -1,6 +1,8 @@
|
||||
|
||||
#include "main.h"
|
||||
|
||||
void AMXPrintError(CGameMode* pGameMode, AMX *amx, int error);
|
||||
|
||||
char szGameModeFileName[256];
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
@ -26,3 +28,35 @@ void CGameMode::Unload()
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
void CGameMode::Frame(float fElapsedTime)
|
||||
{
|
||||
if (!m_bInitialised)
|
||||
return;
|
||||
|
||||
if (!m_bSleeping)
|
||||
return;
|
||||
|
||||
if (m_fSleepTime > 0.0f)
|
||||
{
|
||||
m_fSleepTime -= fElapsedTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
cell ret;
|
||||
int err = amx_Exec(&m_amx, &ret, AMX_EXEC_CONT);
|
||||
if (err == AMX_ERR_SLEEP)
|
||||
{
|
||||
m_bSleeping = true;
|
||||
m_fSleepTime = ((float)ret / 1000.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bSleeping = false;
|
||||
AMXPrintError(this, &m_amx, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
|
||||
void Unload();
|
||||
|
||||
void Frame(float fElapsedTime);
|
||||
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user