mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-01-27 14:08:00 +03:00
Optimize CBasePlayer::SendWeatherInfo (#159)
* Optimize CBasePlayer::SendWeatherInfo
This commit is contained in:
parent
09e714e339
commit
419603ff52
@ -6751,27 +6751,28 @@ void CBasePlayer::SendHostageIcons()
|
||||
|
||||
void CBasePlayer::SendWeatherInfo()
|
||||
{
|
||||
CBaseEntity *pPoint = UTIL_FindEntityByClassname(NULL, "env_rain");
|
||||
CBaseEntity *pPoint2 = UTIL_FindEntityByClassname(NULL, "func_rain");
|
||||
CBaseEntity *pEnt;
|
||||
|
||||
if (pPoint || pPoint2)
|
||||
auto SendReceiveW = [&](BYTE byte)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgReceiveW, NULL, pev);
|
||||
WRITE_BYTE(1); // rainy weather
|
||||
WRITE_BYTE(byte);
|
||||
MESSAGE_END();
|
||||
}
|
||||
else
|
||||
{
|
||||
pPoint = UTIL_FindEntityByClassname(NULL, "env_snow");
|
||||
pPoint2 = UTIL_FindEntityByClassname(NULL, "func_snow");
|
||||
};
|
||||
|
||||
if (pPoint || pPoint2)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgReceiveW, NULL, pev);
|
||||
WRITE_BYTE(2); // snowy weather
|
||||
MESSAGE_END();
|
||||
}
|
||||
}
|
||||
/* Rain */
|
||||
if ((pEnt = UTIL_FindEntityByClassname(NULL, "env_rain")))
|
||||
return SendReceiveW(1);
|
||||
|
||||
if ((pEnt = UTIL_FindEntityByClassname(NULL, "func_rain")))
|
||||
return SendReceiveW(1);
|
||||
|
||||
/* Snow */
|
||||
if ((pEnt = UTIL_FindEntityByClassname(NULL, "env_snow")))
|
||||
return SendReceiveW(2);
|
||||
|
||||
if ((pEnt = UTIL_FindEntityByClassname(NULL, "func_snow")))
|
||||
return SendReceiveW(2);
|
||||
}
|
||||
|
||||
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, UpdateClientData)
|
||||
|
Loading…
x
Reference in New Issue
Block a user