mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 18:18:18 +00:00
Added Protection against cheating to usage of /pause
fixed /pause ammo when freezed Signed-off-by: GreYFoXGTi <GreYFoXGTi@GMaiL.CoM>
This commit is contained in:
parent
66750a3220
commit
3cb59795a6
|
@ -81,6 +81,9 @@ void CPickup::Tick()
|
|||
pChr->m_aWeapons[WEAPON_GUN].m_Ammo = 0;
|
||||
pChr->m_aWeapons[WEAPON_HAMMER].m_Ammo =0;
|
||||
}
|
||||
pChr->m_Ninja.m_ActivationDir=vec2(0,0);
|
||||
pChr->m_Ninja.m_ActivationTick=0;
|
||||
pChr->m_Ninja.m_CurrentMoveTime=0;
|
||||
}
|
||||
if (sound)
|
||||
{
|
||||
|
|
|
@ -652,7 +652,7 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
|
|||
{
|
||||
CCharacter* chr = p->GetCharacter();
|
||||
|
||||
if(!p->GetTeam() && (!chr->m_aWeapons[WEAPON_NINJA].m_Got || chr->m_FreezeTime))
|
||||
if(!p->GetTeam() && (!chr->m_aWeapons[WEAPON_NINJA].m_Got || chr->m_FreezeTime) && chr->IsGrounded() && chr->m_Pos==chr->m_PrevPos)
|
||||
{
|
||||
p->SaveCharacter();
|
||||
p->SetTeam(-1);
|
||||
|
@ -664,7 +664,7 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
|
|||
//p->LoadCharacter();//TODO:Check if this system Works
|
||||
}
|
||||
else
|
||||
SendChatTarget(ClientId, "You are not allowed to pause with ninja");
|
||||
SendChatTarget(ClientId, (chr->m_aWeapons[WEAPON_NINJA].m_Got)?"You can't use /pause while you are a ninja":(!chr->IsGrounded())?"You can't use /pause while you are a in air":"You can't use /pause while you are moving");
|
||||
|
||||
//if(chr->m_RaceState==RACE_STARTED)
|
||||
// chr->m_RaceState = RACE_PAUSE;
|
||||
|
|
|
@ -232,9 +232,11 @@ void CPlayer::LoadCharacter() {
|
|||
Character->m_RaceState = m_PauseInfo.m_RaceState;
|
||||
Character->m_RefreshTime = Server()->Tick();
|
||||
for(int i = 0; i < NUM_WEAPONS; ++i) {
|
||||
if(m_PauseInfo.m_aHasWeapon[i]) {
|
||||
if(m_PauseInfo.m_aHasWeapon[i])
|
||||
if(!m_PauseInfo.m_FreezeTime)
|
||||
Character->GiveWeapon(i, -1);
|
||||
}
|
||||
else
|
||||
Character->GiveWeapon(i, 0);
|
||||
}
|
||||
Character->m_FreezeTime = m_PauseInfo.m_FreezeTime;
|
||||
Character->m_Doored = m_PauseInfo.m_Doored;
|
||||
|
|
Loading…
Reference in a new issue