mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix crash in kill protection
This commit is contained in:
parent
4311df0c62
commit
05dd0b4af7
|
@ -1480,9 +1480,13 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
|
||||||
if(pPlayer->m_Paused)
|
if(pPlayer->m_Paused)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
CCharacter* pChr = pPlayer->GetCharacter();
|
||||||
|
if(!pChr)
|
||||||
|
return;
|
||||||
|
|
||||||
//Kill Protection
|
//Kill Protection
|
||||||
int CurrTime = (Server()->Tick() - pPlayer->GetCharacter()->m_StartTime) / Server()->TickSpeed();
|
int CurrTime = (Server()->Tick() - pChr->m_StartTime) / Server()->TickSpeed();
|
||||||
if(g_Config.m_SvKillProtection != 0 && CurrTime >= (60 * g_Config.m_SvKillProtection) && pPlayer->GetCharacter()->m_DDRaceState == DDRACE_STARTED)
|
if(g_Config.m_SvKillProtection != 0 && CurrTime >= (60 * g_Config.m_SvKillProtection) && pChr->m_DDRaceState == DDRACE_STARTED)
|
||||||
{
|
{
|
||||||
SendChatTarget(ClientID, "Kill Protection enabled. If you really want to kill, write /kill");
|
SendChatTarget(ClientID, "Kill Protection enabled. If you really want to kill, write /kill");
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue