mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-14 03:58:18 +00:00
SvShotgunBulletSound
also added protection to shotgun stucks, needs to be tested when a random crazy shotgun bullet gets stuck loaded the score file before saving to avoid corruption added freeze and unfreeze in rcon added protection in some rcon commands Signed-off-by: GreYFoXGTi <GreYFoXGTi@GMaiL.CoM>
This commit is contained in:
parent
05f8edb880
commit
51c6af1303
|
@ -933,14 +933,14 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
|
||||||
}
|
}
|
||||||
if(level != -1)
|
if(level != -1)
|
||||||
{
|
{
|
||||||
char buf[128]="Authentication successful. Remote console access granted, with level=%d";
|
char buf[128]="Authentication successful. Remote console access grantedfor cid=%d with level=%d";
|
||||||
CMsgPacker Msg(NETMSG_RCON_AUTH_STATUS);
|
CMsgPacker Msg(NETMSG_RCON_AUTH_STATUS);
|
||||||
Msg.AddInt(1);
|
Msg.AddInt(1);
|
||||||
SendMsgEx(&Msg, MSGFLAG_VITAL, ClientId, true);
|
SendMsgEx(&Msg, MSGFLAG_VITAL, ClientId, true);
|
||||||
|
|
||||||
m_aClients[ClientId].m_Authed = level;
|
m_aClients[ClientId].m_Authed = level;
|
||||||
GameServer()->OnSetAuthed(ClientId, m_aClients[ClientId].m_Authed);
|
GameServer()->OnSetAuthed(ClientId, m_aClients[ClientId].m_Authed);
|
||||||
str_format(buf,sizeof(buf),buf,level);
|
str_format(buf,sizeof(buf),buf,ClientId,level);
|
||||||
SendRconLine(ClientId, buf);
|
SendRconLine(ClientId, buf);
|
||||||
dbg_msg("server", "ClientId=%d authed with Level=%d", ClientId, level);
|
dbg_msg("server", "ClientId=%d authed with Level=%d", ClientId, level);
|
||||||
m_aClients[ClientId].m_PwTries = 0;
|
m_aClients[ClientId].m_PwTries = 0;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
//===============================
|
//===============================
|
||||||
/* DDRace */
|
/* DDRace */
|
||||||
//MACRO_CONFIG_STR(SvEntities, sv_entities, 64, "Latest", CFGFLAG_SERVER, "The type of entities used") still need to think of a way
|
//MACRO_CONFIG_STR(SvEntities, sv_entities, 64, "Latest", CFGFLAG_SERVER, "The type of entities used") still need to think of a way
|
||||||
|
MACRO_CONFIG_INT(SvShotgunBulletSound, sv_shotgun_bullet_sound, 1, 0, 1, CFGFLAG_SERVER, "Annoying Shotgun sound on/off")
|
||||||
MACRO_CONFIG_INT(SvEndlessSuperHook, sv_endless_super_hook, 0, 0, 1, CFGFLAG_SERVER, "Endless hook for super players on/off")
|
MACRO_CONFIG_INT(SvEndlessSuperHook, sv_endless_super_hook, 0, 0, 1, CFGFLAG_SERVER, "Endless hook for super players on/off")
|
||||||
MACRO_CONFIG_INT(SvEmotionalTees, sv_emotional_tees, 1, 0, 1, CFGFLAG_SERVER, "Emotional Tees on/off")
|
MACRO_CONFIG_INT(SvEmotionalTees, sv_emotional_tees, 1, 0, 1, CFGFLAG_SERVER, "Emotional Tees on/off")
|
||||||
MACRO_CONFIG_INT(SvOldShotgun, sv_old_shotgun, 0, 0, 1, CFGFLAG_SERVER, "Makes Shotgun laser pull towards the shooter, rather than the last bounce origin")
|
MACRO_CONFIG_INT(SvOldShotgun, sv_old_shotgun, 0, 0, 1, CFGFLAG_SERVER, "Makes Shotgun laser pull towards the shooter, rather than the last bounce origin")
|
||||||
|
|
|
@ -79,7 +79,8 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos)
|
||||||
|
|
||||||
GameServer()->m_World.InsertEntity(this);
|
GameServer()->m_World.InsertEntity(this);
|
||||||
m_Alive = true;
|
m_Alive = true;
|
||||||
|
dbg_msg("m_RconFreeze","%d",m_pPlayer->m_RconFreeze);
|
||||||
|
if(m_pPlayer->m_RconFreeze) Freeze(-1);
|
||||||
GameServer()->m_pController->OnCharacterSpawn(this);
|
GameServer()->m_pController->OnCharacterSpawn(this);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -559,19 +560,24 @@ void CCharacter::Tick()
|
||||||
|
|
||||||
m_pPlayer->m_ForceBalanced = false;
|
m_pPlayer->m_ForceBalanced = false;
|
||||||
}
|
}
|
||||||
m_Armor=10-(m_FreezeTime/15);
|
m_Armor=(m_FreezeTime != -1)?10-(m_FreezeTime/15):0;
|
||||||
if(m_Input.m_Direction != 0 || m_Input.m_Jump != 0)
|
if(m_Input.m_Direction != 0 || m_Input.m_Jump != 0)
|
||||||
m_LastMove = Server()->Tick();
|
m_LastMove = Server()->Tick();
|
||||||
|
|
||||||
if(m_FreezeTime > 0) {
|
if(m_FreezeTime > 0 || m_FreezeTime == -1)
|
||||||
if (m_FreezeTime % Server()->TickSpeed() == 0)
|
{
|
||||||
|
if (m_FreezeTime % Server()->TickSpeed() == 0 || m_FreezeTime == -1)
|
||||||
{
|
{
|
||||||
GameServer()->CreateDamageInd(m_Pos, 0, m_FreezeTime / Server()->TickSpeed());
|
GameServer()->CreateDamageInd(m_Pos, 0, m_FreezeTime / Server()->TickSpeed());
|
||||||
}
|
}
|
||||||
m_FreezeTime--;
|
(m_FreezeTime != -1)?m_FreezeTime--:0;
|
||||||
m_Input.m_Direction = 0;
|
m_Input.m_Direction = 0;
|
||||||
m_Input.m_Jump = 0;
|
m_Input.m_Jump = 0;
|
||||||
m_Input.m_Hook = 0;
|
m_Input.m_Hook = 0;
|
||||||
|
m_Ninja.m_ActivationTick = Server()->Tick();
|
||||||
|
m_aWeapons[WEAPON_NINJA].m_Got=true;
|
||||||
|
m_aWeapons[WEAPON_NINJA].m_Ammo =0;
|
||||||
|
m_ActiveWeapon=WEAPON_NINJA;
|
||||||
//m_Input.m_Fire = 0;
|
//m_Input.m_Fire = 0;
|
||||||
if (m_FreezeTime == 1) {
|
if (m_FreezeTime == 1) {
|
||||||
UnFreeze();
|
UnFreeze();
|
||||||
|
@ -944,7 +950,7 @@ void CCharacter::TickDefered()
|
||||||
|
|
||||||
bool CCharacter::Freeze(int Time)
|
bool CCharacter::Freeze(int Time)
|
||||||
{
|
{
|
||||||
if (Time <= 1 || m_Super)
|
if ((Time <= 1 || m_Super || m_FreezeTime == -1) && Time != -1)
|
||||||
return false;
|
return false;
|
||||||
if (m_FreezeTick < Server()->Tick() - Server()->TickSpeed())
|
if (m_FreezeTick < Server()->Tick() - Server()->TickSpeed())
|
||||||
{
|
{
|
||||||
|
@ -964,7 +970,7 @@ bool CCharacter::Freeze(int Time)
|
||||||
bool CCharacter::Freeze()
|
bool CCharacter::Freeze()
|
||||||
{
|
{
|
||||||
int Time = Server()->TickSpeed()*3;
|
int Time = Server()->TickSpeed()*3;
|
||||||
if (Time <= 1 || m_Super)
|
if (Time <= 1 || m_Super || m_FreezeTime == -1)
|
||||||
return false;
|
return false;
|
||||||
if (m_FreezeTick < Server()->Tick() - Server()->TickSpeed())
|
if (m_FreezeTick < Server()->Tick() - Server()->TickSpeed())
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,11 +71,14 @@ void CPickup::Tick()
|
||||||
for(int i=WEAPON_SHOTGUN;i<NUM_WEAPONS;i++)
|
for(int i=WEAPON_SHOTGUN;i<NUM_WEAPONS;i++)
|
||||||
{
|
{
|
||||||
if (pChr->m_aWeapons[i].m_Got)
|
if (pChr->m_aWeapons[i].m_Got)
|
||||||
|
{
|
||||||
|
if(!(pChr->m_FreezeTime && i == WEAPON_NINJA))
|
||||||
{
|
{
|
||||||
pChr->m_aWeapons[i].m_Got = false;
|
pChr->m_aWeapons[i].m_Got = false;
|
||||||
pChr->m_aWeapons[i].m_Ammo = 0;
|
pChr->m_aWeapons[i].m_Ammo = 0;
|
||||||
sound = true;
|
sound = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(pChr->m_FreezeTime)
|
if(pChr->m_FreezeTime)
|
||||||
{
|
{
|
||||||
pChr->m_aWeapons[WEAPON_GUN].m_Ammo = 0;
|
pChr->m_aWeapons[WEAPON_GUN].m_Ammo = 0;
|
||||||
|
@ -90,7 +93,7 @@ void CPickup::Tick()
|
||||||
pChr->m_LastWeapon = WEAPON_GUN;
|
pChr->m_LastWeapon = WEAPON_GUN;
|
||||||
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_ARMOR);
|
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_ARMOR);
|
||||||
}
|
}
|
||||||
pChr->m_ActiveWeapon = WEAPON_HAMMER;
|
if(!pChr->m_FreezeTime) pChr->m_ActiveWeapon = WEAPON_HAMMER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case POWERUP_WEAPON:
|
case POWERUP_WEAPON:
|
||||||
|
@ -117,7 +120,7 @@ void CPickup::Tick()
|
||||||
case POWERUP_NINJA:
|
case POWERUP_NINJA:
|
||||||
{
|
{
|
||||||
// activate ninja on target player
|
// activate ninja on target player
|
||||||
pChr->GiveNinja();
|
if(!pChr->m_FreezeTime) pChr->GiveNinja();
|
||||||
//RespawnTime = g_pData->m_aPickups[m_Type].m_Respawntime;
|
//RespawnTime = g_pData->m_aPickups[m_Type].m_Respawntime;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -3,8 +3,18 @@
|
||||||
#include <engine/shared/config.h>
|
#include <engine/shared/config.h>
|
||||||
#include "projectile.h"
|
#include "projectile.h"
|
||||||
|
|
||||||
CProjectile::CProjectile(CGameWorld *pGameWorld, int Type, int Owner, vec2 Pos, vec2 Dir, int Span,
|
CProjectile::CProjectile(
|
||||||
bool Freeze, bool Explosive, float Force, int SoundImpact, int Weapon)
|
CGameWorld *pGameWorld,
|
||||||
|
int Type,
|
||||||
|
int Owner,
|
||||||
|
vec2 Pos,
|
||||||
|
vec2 Dir,
|
||||||
|
int Span,
|
||||||
|
bool Freeze,
|
||||||
|
bool Explosive,
|
||||||
|
float Force,
|
||||||
|
int SoundImpact,
|
||||||
|
int Weapon)
|
||||||
: CEntity(pGameWorld, NETOBJTYPE_PROJECTILE)
|
: CEntity(pGameWorld, NETOBJTYPE_PROJECTILE)
|
||||||
{
|
{
|
||||||
m_Type = Type;
|
m_Type = Type;
|
||||||
|
@ -19,6 +29,11 @@ CProjectile::CProjectile(CGameWorld *pGameWorld, int Type, int Owner, vec2 Pos,
|
||||||
m_Weapon = Weapon;
|
m_Weapon = Weapon;
|
||||||
m_StartTick = Server()->Tick();
|
m_StartTick = Server()->Tick();
|
||||||
m_Explosive = Explosive;
|
m_Explosive = Explosive;
|
||||||
|
m_BouncePos=vec2(0,0);
|
||||||
|
m_ReBouncePos=vec2(0,0);
|
||||||
|
m_AvgPos=vec2(0,0);
|
||||||
|
m_LastBounce=vec2(0,0);
|
||||||
|
m_PrevLastBounce=vec2(0,0);
|
||||||
|
|
||||||
GameWorld()->InsertEntity(this);
|
GameWorld()->InsertEntity(this);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +70,8 @@ vec2 CProjectile::GetPos(float Time)
|
||||||
return CalcPos(m_Pos, m_Direction, Curvature, Speed, Time);
|
return CalcPos(m_Pos, m_Direction, Curvature, Speed, Time);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CProjectile::SetBouncing(int Value) {
|
void CProjectile::SetBouncing(int Value)
|
||||||
|
{
|
||||||
m_Bouncing = Value;
|
m_Bouncing = Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,9 +112,27 @@ void CProjectile::Tick()
|
||||||
m_StartTick = Server()->Tick();
|
m_StartTick = Server()->Tick();
|
||||||
m_Pos = NewPos;
|
m_Pos = NewPos;
|
||||||
if (m_Bouncing == 1)
|
if (m_Bouncing == 1)
|
||||||
|
{
|
||||||
m_Direction.x = -m_Direction.x;
|
m_Direction.x = -m_Direction.x;
|
||||||
|
m_LastBounce = m_Pos;
|
||||||
|
if(!m_BouncePos.x)
|
||||||
|
m_BouncePos=m_Pos;
|
||||||
|
else if (!m_ReBouncePos.x)
|
||||||
|
m_ReBouncePos=m_Pos;
|
||||||
|
else if(!m_AvgPos.x)
|
||||||
|
m_AvgPos = vec2((m_BouncePos.x+m_ReBouncePos.x)/2,(m_BouncePos.y+m_ReBouncePos.y)/2);
|
||||||
|
}
|
||||||
else if (m_Bouncing == 2)
|
else if (m_Bouncing == 2)
|
||||||
|
{
|
||||||
|
m_LastBounce = m_Pos;
|
||||||
m_Direction.y =- m_Direction.y;
|
m_Direction.y =- m_Direction.y;
|
||||||
|
if(!m_BouncePos.y)
|
||||||
|
m_BouncePos=m_Pos;
|
||||||
|
else if (!m_ReBouncePos.y)
|
||||||
|
m_ReBouncePos=m_Pos;
|
||||||
|
else if(!m_AvgPos.y)
|
||||||
|
m_AvgPos = vec2((m_BouncePos.x+m_ReBouncePos.x)/2,(m_BouncePos.y+m_ReBouncePos.y)/2);
|
||||||
|
}
|
||||||
m_Pos += m_Direction;
|
m_Pos += m_Direction;
|
||||||
}
|
}
|
||||||
else if (m_Weapon == WEAPON_GUN)
|
else if (m_Weapon == WEAPON_GUN)
|
||||||
|
@ -114,6 +148,10 @@ void CProjectile::Tick()
|
||||||
{
|
{
|
||||||
GameServer()->m_World.DestroyEntity(this);
|
GameServer()->m_World.DestroyEntity(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if((!(m_PrevLastBounce == m_BouncePos && m_LastBounce == m_ReBouncePos) && !(m_LastBounce == m_BouncePos && m_PrevLastBounce == m_ReBouncePos))&&m_AvgPos.x)
|
||||||
|
m_Pos=m_AvgPos;
|
||||||
|
m_PrevLastBounce=m_LastBounce;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CProjectile::FillInfo(CNetObj_Projectile *pProj)
|
void CProjectile::FillInfo(CNetObj_Projectile *pProj)
|
||||||
|
|
|
@ -29,6 +29,11 @@ private:
|
||||||
int m_Bouncing;
|
int m_Bouncing;
|
||||||
bool m_Freeze;
|
bool m_Freeze;
|
||||||
bool m_Collised;
|
bool m_Collised;
|
||||||
|
vec2 m_AvgPos;
|
||||||
|
vec2 m_BouncePos;
|
||||||
|
vec2 m_ReBouncePos;
|
||||||
|
vec2 m_LastBounce;
|
||||||
|
vec2 m_PrevLastBounce;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1350,7 +1350,7 @@ void CGameContext::ConSetlvl(IConsole::IResult *pResult, void *pUserData, int c
|
||||||
int cid1 = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
|
int cid1 = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
|
||||||
int level = clamp(pResult->GetInteger(1), 0, 3);
|
int level = clamp(pResult->GetInteger(1), 0, 3);
|
||||||
|
|
||||||
if (pSelf->m_apPlayers[cid1] && (pSelf->m_apPlayers[cid1]->m_Authed > level) && (compare_players(pSelf->m_apPlayers[cid],pSelf->m_apPlayers[cid1])))
|
if (pSelf->m_apPlayers[cid1] && (pSelf->m_apPlayers[cid1]->m_Authed > level) && (compare_players(pSelf->m_apPlayers[cid],pSelf->m_apPlayers[cid1]) || cid == cid1))
|
||||||
{
|
{
|
||||||
pSelf->m_apPlayers[cid1]->m_Authed = level;
|
pSelf->m_apPlayers[cid1]->m_Authed = level;
|
||||||
}
|
}
|
||||||
|
@ -1388,12 +1388,16 @@ void CGameContext::ConNinja(IConsole::IResult *pResult, void *pUserData, int cid
|
||||||
if(!pSelf->CheatsAvailable(cid)) return;
|
if(!pSelf->CheatsAvailable(cid)) return;
|
||||||
int cid1 = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
|
int cid1 = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
|
||||||
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
||||||
if(chr) {
|
if(chr)
|
||||||
|
{
|
||||||
|
if (pSelf->m_apPlayers[cid1] && compare_players(pSelf->m_apPlayers[cid],pSelf->m_apPlayers[cid1]))
|
||||||
|
{
|
||||||
chr->GiveNinja();
|
chr->GiveNinja();
|
||||||
if(!g_Config.m_SvCheatTime)
|
if(!g_Config.m_SvCheatTime)
|
||||||
chr->m_RaceState = RACE_CHEAT;
|
chr->m_RaceState = RACE_CHEAT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CGameContext::ConHammer(IConsole::IResult *pResult, void *pUserData, int cid)
|
void CGameContext::ConHammer(IConsole::IResult *pResult, void *pUserData, int cid)
|
||||||
|
@ -1413,6 +1417,8 @@ void CGameContext::ConHammer(IConsole::IResult *pResult, void *pUserData, int ci
|
||||||
serv->SendRconLine(cid, "Select hammer between 0 and 3");
|
serv->SendRconLine(cid, "Select hammer between 0 and 3");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (pSelf->m_apPlayers[cid1] && compare_players(pSelf->m_apPlayers[cid],pSelf->m_apPlayers[cid1]))
|
||||||
{
|
{
|
||||||
chr->m_HammerType = type;
|
chr->m_HammerType = type;
|
||||||
if(!g_Config.m_SvCheatTime)
|
if(!g_Config.m_SvCheatTime)
|
||||||
|
@ -1421,6 +1427,7 @@ void CGameContext::ConHammer(IConsole::IResult *pResult, void *pUserData, int ci
|
||||||
serv->SendRconLine(cid1, buf);
|
serv->SendRconLine(cid1, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CGameContext::ConHammerMe(IConsole::IResult *pResult, void *pUserData, int cid)
|
void CGameContext::ConHammerMe(IConsole::IResult *pResult, void *pUserData, int cid)
|
||||||
{
|
{
|
||||||
|
@ -1458,6 +1465,7 @@ void CGameContext::ConSuper(IConsole::IResult *pResult, void *pUserData, int cid
|
||||||
if(chr)
|
if(chr)
|
||||||
{
|
{
|
||||||
chr->m_Super = true;
|
chr->m_Super = true;
|
||||||
|
chr->UnFreeze();
|
||||||
if(!g_Config.m_SvCheatTime)
|
if(!g_Config.m_SvCheatTime)
|
||||||
chr->m_RaceState = RACE_CHEAT;
|
chr->m_RaceState = RACE_CHEAT;
|
||||||
}
|
}
|
||||||
|
@ -1489,6 +1497,7 @@ void CGameContext::ConSuperMe(IConsole::IResult *pResult, void *pUserData, int c
|
||||||
if(chr)
|
if(chr)
|
||||||
{
|
{
|
||||||
chr->m_Super = true;
|
chr->m_Super = true;
|
||||||
|
chr->UnFreeze();
|
||||||
if(!g_Config.m_SvCheatTime)
|
if(!g_Config.m_SvCheatTime)
|
||||||
chr->m_RaceState = RACE_CHEAT;
|
chr->m_RaceState = RACE_CHEAT;
|
||||||
}
|
}
|
||||||
|
@ -1573,10 +1582,13 @@ void CGameContext::ConTimerStop(IConsole::IResult *pResult, void *pUserData, int
|
||||||
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
||||||
if (!chr)
|
if (!chr)
|
||||||
return;
|
return;
|
||||||
|
if (pSelf->m_apPlayers[cid1] && compare_players(pSelf->m_apPlayers[cid],pSelf->m_apPlayers[cid1]))
|
||||||
|
{
|
||||||
chr->m_RaceState=RACE_CHEAT;
|
chr->m_RaceState=RACE_CHEAT;
|
||||||
str_format(buf, sizeof(buf), "Cid=%d Hasn't time now (Timer Stopped)",cid1);
|
str_format(buf, sizeof(buf), "Cid=%d Hasn't time now (Timer Stopped)",cid1);
|
||||||
serv->SendRconLine(cid1, buf);
|
serv->SendRconLine(cid1, buf);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1596,10 +1608,13 @@ void CGameContext::ConTimerStart(IConsole::IResult *pResult, void *pUserData, in
|
||||||
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
||||||
if (!chr)
|
if (!chr)
|
||||||
return;
|
return;
|
||||||
|
if (pSelf->m_apPlayers[cid1] && compare_players(pSelf->m_apPlayers[cid],pSelf->m_apPlayers[cid1]))
|
||||||
|
{
|
||||||
chr->m_RaceState = RACE_STARTED;
|
chr->m_RaceState = RACE_STARTED;
|
||||||
str_format(buf, sizeof(buf), "Cid=%d Has time now (Timer Started)",cid1);
|
str_format(buf, sizeof(buf), "Cid=%d Has time now (Timer Started)",cid1);
|
||||||
serv->SendRconLine(cid1, buf);
|
serv->SendRconLine(cid1, buf);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1618,12 +1633,15 @@ void CGameContext::ConTimerZero(IConsole::IResult *pResult, void *pUserData, int
|
||||||
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
||||||
if (!chr)
|
if (!chr)
|
||||||
return;
|
return;
|
||||||
|
if (pSelf->m_apPlayers[cid1] && compare_players(pSelf->m_apPlayers[cid],pSelf->m_apPlayers[cid1]))
|
||||||
|
{
|
||||||
chr->m_StartTime = pSelf->Server()->Tick();
|
chr->m_StartTime = pSelf->Server()->Tick();
|
||||||
chr->m_RefreshTime = pSelf->Server()->Tick();
|
chr->m_RefreshTime = pSelf->Server()->Tick();
|
||||||
chr->m_RaceState=RACE_CHEAT;
|
chr->m_RaceState=RACE_CHEAT;
|
||||||
str_format(buf, sizeof(buf), "Cid=%d time has been reset & stopped.",cid1);
|
str_format(buf, sizeof(buf), "Cid=%d time has been reset & stopped.",cid1);
|
||||||
CServer* serv = (CServer*)pSelf->Server();
|
CServer* serv = (CServer*)pSelf->Server();
|
||||||
serv->SendRconLine(cid1, buf);
|
serv->SendRconLine(cid1, buf);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1638,12 +1656,55 @@ void CGameContext::ConTimerReStart(IConsole::IResult *pResult, void *pUserData,
|
||||||
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
||||||
if (!chr)
|
if (!chr)
|
||||||
return;
|
return;
|
||||||
|
if (pSelf->m_apPlayers[cid1] && compare_players(pSelf->m_apPlayers[cid],pSelf->m_apPlayers[cid1]))
|
||||||
|
{
|
||||||
chr->m_StartTime = pSelf->Server()->Tick();
|
chr->m_StartTime = pSelf->Server()->Tick();
|
||||||
chr->m_RefreshTime = pSelf->Server()->Tick();
|
chr->m_RefreshTime = pSelf->Server()->Tick();
|
||||||
chr->m_RaceState=RACE_STARTED;
|
chr->m_RaceState=RACE_STARTED;
|
||||||
str_format(buf, sizeof(buf), "Cid=%d time has been reset & stopped.",cid1);
|
str_format(buf, sizeof(buf), "Cid=%d time has been reset & stopped.",cid1);
|
||||||
CServer* serv = (CServer*)pSelf->Server();
|
CServer* serv = (CServer*)pSelf->Server();
|
||||||
serv->SendRconLine(cid1, buf);
|
serv->SendRconLine(cid1, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameContext::ConFreeze(IConsole::IResult *pResult, void *pUserData, int cid)
|
||||||
|
{
|
||||||
|
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||||
|
//if(!pSelf->CheatsAvailable(cid)) return;
|
||||||
|
char buf[128];
|
||||||
|
int time=-1;
|
||||||
|
int cid1 = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
|
||||||
|
if(pResult->NumArguments()>1)
|
||||||
|
time = clamp(pResult->GetInteger(1), -1, 29999);
|
||||||
|
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
||||||
|
if (!chr)
|
||||||
|
return;
|
||||||
|
if (pSelf->m_apPlayers[cid1] && compare_players(pSelf->m_apPlayers[cid],pSelf->m_apPlayers[cid1]))
|
||||||
|
{
|
||||||
|
chr->Freeze(((time!=0&&time!=-1)?(pSelf->Server()->TickSpeed()*time):(-1)));
|
||||||
|
chr->m_pPlayer->m_RconFreeze = true;
|
||||||
|
str_format(buf, sizeof(buf), "Cid=%d has been Frozen.",cid1);
|
||||||
|
CServer* serv = (CServer*)pSelf->Server();
|
||||||
|
serv->SendRconLine(cid1, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameContext::ConUnFreeze(IConsole::IResult *pResult, void *pUserData, int cid)
|
||||||
|
{
|
||||||
|
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||||
|
//if(!pSelf->CheatsAvailable(cid)) return;
|
||||||
|
char buf[128];
|
||||||
|
int cid1 = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
|
||||||
|
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
||||||
|
if (!chr)
|
||||||
|
return;
|
||||||
|
chr->m_FreezeTime=2;
|
||||||
|
chr->m_pPlayer->m_RconFreeze = false;
|
||||||
|
str_format(buf, sizeof(buf), "Cid=%d has been UnFreezed.",cid1);
|
||||||
|
CServer* serv = (CServer*)pSelf->Server();
|
||||||
|
serv->SendRconLine(cid1, buf);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1651,7 +1712,8 @@ void CGameContext::OnConsoleInit()
|
||||||
{
|
{
|
||||||
m_pServer = Kernel()->RequestInterface<IServer>();
|
m_pServer = Kernel()->RequestInterface<IServer>();
|
||||||
m_pConsole = Kernel()->RequestInterface<IConsole>();
|
m_pConsole = Kernel()->RequestInterface<IConsole>();
|
||||||
|
Console()->Register("freeze", "i?i", CFGFLAG_SERVER, ConFreeze, this, "Freezes Player i1 for i2 seconds Default Infinity",2);
|
||||||
|
Console()->Register("unfreeze", "i", CFGFLAG_SERVER, ConUnFreeze, this, "UnFreezes Player i",2);
|
||||||
Console()->Register("timerstop", "i", CFGFLAG_SERVER, ConTimerStop, this, "Stops The Timer of Player i",2);
|
Console()->Register("timerstop", "i", CFGFLAG_SERVER, ConTimerStop, this, "Stops The Timer of Player i",2);
|
||||||
Console()->Register("timerstart", "i", CFGFLAG_SERVER, ConTimerStart, this, "Starts The Timer of Player i",2);
|
Console()->Register("timerstart", "i", CFGFLAG_SERVER, ConTimerStart, this, "Starts The Timer of Player i",2);
|
||||||
Console()->Register("timerrestart", "i", CFGFLAG_SERVER, ConTimerReStart, this, "Starts The Timer of Player i with the time of 00:00:00",2);
|
Console()->Register("timerrestart", "i", CFGFLAG_SERVER, ConTimerReStart, this, "Starts The Timer of Player i with the time of 00:00:00",2);
|
||||||
|
|
|
@ -68,6 +68,8 @@ class CGameContext : public IGameServer
|
||||||
|
|
||||||
static void ConPhook(IConsole::IResult *pResult, void *pUserData, int cid);
|
static void ConPhook(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||||
|
|
||||||
|
static void ConFreeze(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||||
|
static void ConUnFreeze(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||||
static void ConTimerStop(IConsole::IResult *pResult, void *pUserData, int cid);
|
static void ConTimerStop(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||||
static void ConTimerStart(IConsole::IResult *pResult, void *pUserData, int cid);
|
static void ConTimerStart(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||||
static void ConTimerReStart(IConsole::IResult *pResult, void *pUserData, int cid);
|
static void ConTimerReStart(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||||
|
|
|
@ -179,7 +179,7 @@ bool IGameController::OnEntity(int Index, vec2 Pos, bool Front)
|
||||||
true, //Freeze
|
true, //Freeze
|
||||||
true, //Explosive
|
true, //Explosive
|
||||||
0,
|
0,
|
||||||
SOUND_GRENADE_EXPLODE,
|
(g_Config.m_SvShotgunBulletSound)?SOUND_GRENADE_EXPLODE:-1,
|
||||||
WEAPON_SHOTGUN);
|
WEAPON_SHOTGUN);
|
||||||
bullet->SetBouncing(2 - (i % 2));
|
bullet->SetBouncing(2 - (i % 2));
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ public:
|
||||||
int m_SentAfkWarning; // afk timer's 1st warning after 50% of sv_max_afk_time
|
int m_SentAfkWarning; // afk timer's 1st warning after 50% of sv_max_afk_time
|
||||||
int m_SentAfkWarning2; // afk timer's 2nd warning after 90% of sv_max_afk_time
|
int m_SentAfkWarning2; // afk timer's 2nd warning after 90% of sv_max_afk_time
|
||||||
char m_pAfkMsg[160];
|
char m_pAfkMsg[160];
|
||||||
|
bool m_RconFreeze;
|
||||||
private:
|
private:
|
||||||
CCharacter *Character;
|
CCharacter *Character;
|
||||||
CGameContext *m_pGameServer;
|
CGameContext *m_pGameServer;
|
||||||
|
|
|
@ -106,6 +106,7 @@ CPlayerScore *CScore::SearchName(const char *name)
|
||||||
|
|
||||||
void CScore::ParsePlayer(const char *name, float score)
|
void CScore::ParsePlayer(const char *name, float score)
|
||||||
{
|
{
|
||||||
|
Load();
|
||||||
CPlayerScore *player = SearchName(name);
|
CPlayerScore *player = SearchName(name);
|
||||||
if (player)
|
if (player)
|
||||||
{
|
{
|
||||||
|
@ -131,7 +132,7 @@ std::list<std::string> CScore::Top5Draw(int id, int debut) //Thanks nevi
|
||||||
//char buf[512];
|
//char buf[512];
|
||||||
|
|
||||||
res.push_back("----------- Top 5 -----------");
|
res.push_back("----------- Top 5 -----------");
|
||||||
for (std::list<CPlayerScore>::iterator i = top.begin(); i != top.end() && pos <= 5+debut; i++)
|
for (std::list<CPlayerScore>::iterator i = top.begin(); i != top.end() && pos <= ((debut)?4:5)+debut; i++)
|
||||||
{
|
{
|
||||||
if(i->m_Score < 0)
|
if(i->m_Score < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue