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:
GreYFoXGTi 2010-08-23 00:46:39 +02:00
parent 66750a3220
commit 3cb59795a6
3 changed files with 9 additions and 4 deletions

View file

@ -81,6 +81,9 @@ void CPickup::Tick()
pChr->m_aWeapons[WEAPON_GUN].m_Ammo = 0; pChr->m_aWeapons[WEAPON_GUN].m_Ammo = 0;
pChr->m_aWeapons[WEAPON_HAMMER].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) if (sound)
{ {

View file

@ -652,7 +652,7 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
{ {
CCharacter* chr = p->GetCharacter(); 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->SaveCharacter();
p->SetTeam(-1); p->SetTeam(-1);
@ -664,7 +664,7 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
//p->LoadCharacter();//TODO:Check if this system Works //p->LoadCharacter();//TODO:Check if this system Works
} }
else 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) //if(chr->m_RaceState==RACE_STARTED)
// chr->m_RaceState = RACE_PAUSE; // chr->m_RaceState = RACE_PAUSE;

View file

@ -232,9 +232,11 @@ void CPlayer::LoadCharacter() {
Character->m_RaceState = m_PauseInfo.m_RaceState; Character->m_RaceState = m_PauseInfo.m_RaceState;
Character->m_RefreshTime = Server()->Tick(); Character->m_RefreshTime = Server()->Tick();
for(int i = 0; i < NUM_WEAPONS; ++i) { 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); Character->GiveWeapon(i, -1);
} else
Character->GiveWeapon(i, 0);
} }
Character->m_FreezeTime = m_PauseInfo.m_FreezeTime; Character->m_FreezeTime = m_PauseInfo.m_FreezeTime;
Character->m_Doored = m_PauseInfo.m_Doored; Character->m_Doored = m_PauseInfo.m_Doored;