2011-08-27 15:11:39 +00:00
/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */
# include "gamecontext.h"
2018-06-19 12:45:53 +00:00
# include <engine/engine.h>
2011-08-27 15:11:39 +00:00
# include <engine/shared/config.h>
2014-01-01 21:34:10 +00:00
# include <engine/shared/protocol.h>
2011-08-27 15:11:39 +00:00
# include <game/server/gamemodes/DDRace.h>
2020-09-26 19:41:58 +00:00
# include <game/server/teams.h>
2011-08-27 15:11:39 +00:00
# include <game/version.h>
bool CheckClientID ( int ClientID ) ;
void CGameContext : : ConCredits ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
2013-12-31 12:35:59 +00:00
2018-06-17 03:42:41 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " credits " ,
2016-05-20 16:36:32 +00:00
" DDNet is run by the DDNet staff (DDNet.tw/staff) " ) ;
2018-06-17 03:42:41 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " credits " ,
2016-05-20 16:36:32 +00:00
" Great maps and many ideas from the great community " ) ;
2018-06-17 03:42:41 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " credits " ,
2015-02-05 19:21:37 +00:00
" Help and code by eeeee, HMH, east, CookieMichal, Learath2, " ) ;
2018-06-17 03:42:41 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " credits " ,
2016-05-01 15:14:02 +00:00
" Savander, laxa, Tobii, BeaR, Wohoo, nuborn, timakro, Shiki, " ) ;
2018-06-17 03:42:41 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " credits " ,
2016-05-01 15:14:02 +00:00
" trml, Soreu, hi_leute_gll, Lady Saavik, Chairn, heinrich5991, " ) ;
2018-06-17 03:42:41 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " credits " ,
2017-03-16 18:17:24 +00:00
" swick, oy, necropotame, Ryozuki, Redix, d3fault, marcelherd, " ) ;
2018-06-17 03:42:41 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " credits " ,
2018-01-14 07:11:48 +00:00
" BannZay, ACTom, SiuFuWong, PathosEthosLogos, TsFreddie, " ) ;
2018-06-17 03:42:41 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " credits " ,
2018-07-25 07:04:47 +00:00
" Jupeyy, noby, ChillerDragon, ZombieToad, weez15, z6zzz, " ) ;
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " credits " ,
2019-02-15 10:10:44 +00:00
" Piepow, QingGo, RafaelFF, sctt, jao, daverck, fokkonaut, " ) ;
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " credits " ,
2020-04-07 05:22:38 +00:00
" Bojidar, FallenKN, ardadem, archimede67, sirius1242, Aerll, " ) ;
2019-12-17 20:35:40 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " credits " ,
2020-08-08 12:09:36 +00:00
" trafilaw, Zwelf, Patiga, Konsti, ElXreno, MikiGamer, " ) ;
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " credits " ,
2020-11-05 08:53:03 +00:00
" Fireball, Banana090, axblk, yangfl & others. " ) ;
2018-06-17 03:42:41 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " credits " ,
2013-12-31 12:35:59 +00:00
" Based on DDRace by the DDRace developers, " ) ;
2018-06-17 03:42:41 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " credits " ,
2013-12-31 12:35:59 +00:00
" which is a mod of Teeworlds by the Teeworlds developers. " ) ;
2011-08-27 15:11:39 +00:00
}
void CGameContext : : ConInfo ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " info " ,
2020-09-26 19:41:58 +00:00
" DDraceNetwork Mod. Version: " GAME_VERSION ) ;
2018-03-01 15:50:29 +00:00
if ( GIT_SHORTREV_HASH )
{
char aBuf [ 64 ] ;
str_format ( aBuf , sizeof ( aBuf ) , " Git revision hash: %s " , GIT_SHORTREV_HASH ) ;
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " info " , aBuf ) ;
}
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " info " ,
2020-09-26 19:41:58 +00:00
" Official site: DDNet.tw " ) ;
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " info " ,
2020-09-26 19:41:58 +00:00
" For more info: /cmdlist " ) ;
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " info " ,
2020-09-26 19:41:58 +00:00
" Or visit DDNet.tw " ) ;
2011-08-27 15:11:39 +00:00
}
2020-01-06 16:29:31 +00:00
void CGameContext : : ConList ( IConsole : : IResult * pResult , void * pUserData )
{
CGameContext * pSelf = ( CGameContext * ) pUserData ;
int ClientID = pResult - > m_ClientID ;
2020-09-26 19:41:58 +00:00
if ( ! CheckClientID ( ClientID ) )
return ;
2020-01-06 16:29:31 +00:00
char zerochar = 0 ;
if ( pResult - > NumArguments ( ) > 0 )
pSelf - > List ( ClientID , pResult - > GetString ( 0 ) ) ;
else
pSelf - > List ( ClientID , & zerochar ) ;
}
2011-08-27 15:11:39 +00:00
void CGameContext : : ConHelp ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
2011-08-27 15:11:39 +00:00
2020-09-26 19:41:58 +00:00
if ( pResult - > NumArguments ( ) = = 0 )
2011-08-27 15:11:39 +00:00
{
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " help " ,
2020-09-26 19:41:58 +00:00
" /cmdlist will show a list of all chat commands " ) ;
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " help " ,
2020-09-26 19:41:58 +00:00
" /help + any command will show you the help for this command " ) ;
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " help " ,
2020-09-26 19:41:58 +00:00
" Example /help settings will display the help about /settings " ) ;
2011-08-27 15:11:39 +00:00
}
else
{
const char * pArg = pResult - > GetString ( 0 ) ;
2011-12-25 13:51:04 +00:00
const IConsole : : CCommandInfo * pCmdInfo =
2020-09-26 19:41:58 +00:00
pSelf - > Console ( ) - > GetCommandInfo ( pArg , CFGFLAG_SERVER , false ) ;
if ( pCmdInfo )
2015-12-28 15:14:52 +00:00
{
2020-09-26 19:41:58 +00:00
if ( pCmdInfo - > m_pParams )
2015-12-28 15:14:52 +00:00
{
char aBuf [ 256 ] ;
str_format ( aBuf , sizeof ( aBuf ) , " Usage: %s %s " , pCmdInfo - > m_pName , pCmdInfo - > m_pParams ) ;
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " help " , aBuf ) ;
}
2020-09-26 19:41:58 +00:00
if ( pCmdInfo - > m_pHelp )
2015-12-28 15:14:52 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " help " , pCmdInfo - > m_pHelp ) ;
}
2011-08-27 15:11:39 +00:00
else
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print (
2020-09-26 19:41:58 +00:00
IConsole : : OUTPUT_LEVEL_STANDARD ,
" help " ,
" Command is either unknown or you have given a blank command without any parameters. " ) ;
2011-08-27 15:11:39 +00:00
}
}
void CGameContext : : ConSettings ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
2011-08-27 15:11:39 +00:00
2020-09-26 19:41:58 +00:00
if ( pResult - > NumArguments ( ) = = 0 )
2011-08-27 15:11:39 +00:00
{
2018-06-13 23:33:07 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " settings " ,
2020-09-26 19:41:58 +00:00
" to check a server setting say /settings and setting's name, setting names are: " ) ;
2018-06-13 23:33:07 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " settings " ,
2020-09-26 19:41:58 +00:00
" teams, cheats, collision, hooking, endlesshooking, me, " ) ;
2018-06-13 23:33:07 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " settings " ,
2020-09-26 19:41:58 +00:00
" hitting, oldlaser, timeout, votes, pause and scores " ) ;
2011-08-27 15:11:39 +00:00
}
else
{
const char * pArg = pResult - > GetString ( 0 ) ;
char aBuf [ 256 ] ;
float ColTemp ;
float HookTemp ;
pSelf - > m_Tuning . Get ( " player_collision " , & ColTemp ) ;
pSelf - > m_Tuning . Get ( " player_hooking " , & HookTemp ) ;
2020-09-26 19:41:58 +00:00
if ( str_comp ( pArg , " teams " ) = = 0 )
2011-08-27 15:11:39 +00:00
{
2018-06-13 23:33:07 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " %s %s " ,
2020-09-26 19:41:58 +00:00
g_Config . m_SvTeam = = 1 ?
" Teams are available on this server " :
( g_Config . m_SvTeam = = 0 | | g_Config . m_SvTeam = = 3 ) ?
" Teams are not available on this server " :
" You have to be in a team to play on this server " , /*g_Config.m_SvTeamStrict ? "and if you die in a team all of you die" : */
" and all of your team will die if the team is locked " ) ;
2018-06-13 23:33:07 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " settings " , aBuf ) ;
}
2020-09-26 19:41:58 +00:00
else if ( str_comp ( pArg , " cheats " ) = = 0 )
2018-06-13 23:33:07 +00:00
{
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " settings " ,
2018-06-13 23:33:07 +00:00
g_Config . m_SvTestingCommands ?
2020-09-26 19:41:58 +00:00
" Cheats are enabled on this server " :
" Cheats are disabled on this server " ) ;
2011-08-27 15:11:39 +00:00
}
2020-09-26 19:41:58 +00:00
else if ( str_comp ( pArg , " collision " ) = = 0 )
2011-08-27 15:11:39 +00:00
{
2018-06-13 23:33:07 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " settings " ,
ColTemp ?
2020-09-26 19:41:58 +00:00
" Players can collide on this server " :
" Players can't collide on this server " ) ;
2011-08-27 15:11:39 +00:00
}
2020-09-26 19:41:58 +00:00
else if ( str_comp ( pArg , " hooking " ) = = 0 )
2011-08-27 15:11:39 +00:00
{
2020-09-26 19:41:58 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " settings " ,
2018-06-13 23:33:07 +00:00
HookTemp ?
2020-09-26 19:41:58 +00:00
" Players can hook each other on this server " :
" Players can't hook each other on this server " ) ;
2011-08-27 15:11:39 +00:00
}
2020-09-26 19:41:58 +00:00
else if ( str_comp ( pArg , " endlesshooking " ) = = 0 )
2011-08-27 15:11:39 +00:00
{
2018-06-13 23:33:07 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " settings " ,
g_Config . m_SvEndlessDrag ?
2020-09-26 19:41:58 +00:00
" Players hook time is unlimited " :
" Players hook time is limited " ) ;
2011-08-27 15:11:39 +00:00
}
2020-09-26 19:41:58 +00:00
else if ( str_comp ( pArg , " hitting " ) = = 0 )
2011-08-27 15:11:39 +00:00
{
2018-06-13 23:33:07 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " settings " ,
g_Config . m_SvHit ?
2020-09-26 19:41:58 +00:00
" Players weapons affect others " :
" Players weapons has no affect on others " ) ;
2011-08-27 15:11:39 +00:00
}
2020-09-26 19:41:58 +00:00
else if ( str_comp ( pArg , " oldlaser " ) = = 0 )
2011-08-27 15:11:39 +00:00
{
2018-06-13 23:33:07 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " settings " ,
g_Config . m_SvOldLaser ?
2020-09-26 19:41:58 +00:00
" Lasers can hit you if you shot them and they pull you towards the bounce origin (Like DDRace Beta) " :
" Lasers can't hit you if you shot them, and they pull others towards the shooter " ) ;
2011-08-27 15:11:39 +00:00
}
2020-09-26 19:41:58 +00:00
else if ( str_comp ( pArg , " me " ) = = 0 )
2011-08-27 15:11:39 +00:00
{
2018-06-13 23:33:07 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " settings " ,
g_Config . m_SvSlashMe ?
2020-09-26 19:41:58 +00:00
" Players can use /me commands the famous IRC Command " :
" Players can't use the /me command " ) ;
2011-08-27 15:11:39 +00:00
}
2020-09-26 19:41:58 +00:00
else if ( str_comp ( pArg , " timeout " ) = = 0 )
2011-08-27 15:11:39 +00:00
{
2018-06-13 23:33:07 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " The Server Timeout is currently set to %d seconds " , g_Config . m_ConnTimeout ) ;
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " settings " , aBuf ) ;
2011-08-27 15:11:39 +00:00
}
2020-09-26 19:41:58 +00:00
else if ( str_comp ( pArg , " votes " ) = = 0 )
2011-08-27 15:11:39 +00:00
{
2018-06-13 23:33:07 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " settings " ,
g_Config . m_SvVoteKick ?
2020-09-26 19:41:58 +00:00
" Players can use Callvote menu tab to kick offenders " :
" Players can't use the Callvote menu tab to kick offenders " ) ;
if ( g_Config . m_SvVoteKick )
2018-06-13 23:33:07 +00:00
{
str_format ( aBuf , sizeof ( aBuf ) ,
2020-09-26 19:41:58 +00:00
" Players are banned for %d minute(s) if they get voted off " , g_Config . m_SvVoteKickBantime ) ;
2019-02-11 17:53:30 +00:00
2018-06-13 23:33:07 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " settings " ,
2020-09-26 19:41:58 +00:00
g_Config . m_SvVoteKickBantime ?
aBuf :
" Players are just kicked and not banned if they get voted off " ) ;
2018-06-13 23:33:07 +00:00
}
2011-08-27 15:11:39 +00:00
}
2020-09-26 19:41:58 +00:00
else if ( str_comp ( pArg , " pause " ) = = 0 )
2011-08-27 15:11:39 +00:00
{
2018-06-13 23:33:07 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " settings " ,
g_Config . m_SvPauseable ?
2020-09-26 19:41:58 +00:00
" /spec will pause you and your tee will vanish " :
" /spec will pause you but your tee will not vanish " ) ;
2011-08-27 15:11:39 +00:00
}
2020-09-26 19:41:58 +00:00
else if ( str_comp ( pArg , " scores " ) = = 0 )
2011-08-27 15:11:39 +00:00
{
2018-06-13 23:33:07 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " settings " ,
g_Config . m_SvHideScore ?
2020-09-26 19:41:58 +00:00
" Scores are private on this server " :
" Scores are public on this server " ) ;
2018-06-13 23:33:07 +00:00
}
else
{
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " settings " ,
2020-09-26 19:41:58 +00:00
" no matching settings found, type /settings to view them " ) ;
2011-08-27 15:11:39 +00:00
}
}
}
void CGameContext : : ConRules ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
2011-08-27 15:11:39 +00:00
bool Printed = false ;
2020-09-26 19:41:58 +00:00
if ( g_Config . m_SvDDRaceRules )
2011-08-27 15:11:39 +00:00
{
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " rules " ,
2020-09-26 19:41:58 +00:00
" Be nice. " ) ;
2011-08-27 15:11:39 +00:00
Printed = true ;
}
2020-09-26 19:41:58 +00:00
# define _RL(n) g_Config.m_SvRulesLine##n
2017-01-03 12:57:22 +00:00
char * pRuleLines [ ] = {
2020-09-26 19:41:58 +00:00
_RL ( 1 ) ,
_RL ( 2 ) ,
_RL ( 3 ) ,
_RL ( 4 ) ,
_RL ( 5 ) ,
_RL ( 6 ) ,
_RL ( 7 ) ,
_RL ( 8 ) ,
_RL ( 9 ) ,
_RL ( 10 ) ,
2017-01-03 12:57:22 +00:00
} ;
2020-10-26 13:11:11 +00:00
for ( auto & pRuleLine : pRuleLines )
2011-08-27 15:11:39 +00:00
{
2020-10-26 13:11:11 +00:00
if ( pRuleLine [ 0 ] )
2017-01-03 12:57:22 +00:00
{
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD ,
2020-10-26 13:11:11 +00:00
" rules " , pRuleLine ) ;
2017-01-03 12:57:22 +00:00
Printed = true ;
}
2011-08-27 15:11:39 +00:00
}
2020-09-26 19:41:58 +00:00
if ( ! Printed )
2017-01-03 12:57:22 +00:00
{
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " rules " ,
2020-09-26 19:41:58 +00:00
" No Rules Defined, Kill em all!! " ) ;
2017-01-03 12:57:22 +00:00
}
2011-08-27 15:11:39 +00:00
}
2018-03-01 18:46:04 +00:00
void ToggleSpecPause ( IConsole : : IResult * pResult , void * pUserData , int PauseType )
2011-08-27 15:11:39 +00:00
{
2017-04-08 22:20:41 +00:00
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2011-12-25 13:51:04 +00:00
return ;
2011-08-27 15:11:39 +00:00
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
IServer * pServ = pSelf - > Server ( ) ;
2011-08-27 15:11:39 +00:00
CPlayer * pPlayer = pSelf - > m_apPlayers [ pResult - > m_ClientID ] ;
2017-04-08 22:20:41 +00:00
if ( ! pPlayer )
2011-08-27 15:11:39 +00:00
return ;
2017-04-08 22:20:41 +00:00
int PauseState = pPlayer - > IsPaused ( ) ;
2018-03-01 18:46:04 +00:00
if ( PauseState > 0 )
2012-03-08 16:24:23 +00:00
{
2018-03-01 18:46:04 +00:00
char aBuf [ 128 ] ;
str_format ( aBuf , sizeof ( aBuf ) , " You are force-paused for %d seconds. " , ( PauseState - pServ - > Tick ( ) ) / pServ - > TickSpeed ( ) ) ;
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " spec " , aBuf ) ;
}
else if ( pResult - > NumArguments ( ) > 0 )
{
if ( - PauseState = = PauseType & & pPlayer - > m_SpectatorID ! = pResult - > m_ClientID & & pServ - > ClientIngame ( pPlayer - > m_SpectatorID ) & & ! str_comp ( pServ - > ClientName ( pPlayer - > m_SpectatorID ) , pResult - > GetString ( 0 ) ) )
2017-12-23 19:42:52 +00:00
{
2017-04-08 23:16:48 +00:00
pPlayer - > Pause ( CPlayer : : PAUSE_NONE , false ) ;
2017-12-23 19:42:52 +00:00
}
2018-03-01 18:46:04 +00:00
else
2017-12-23 19:42:52 +00:00
{
2018-03-01 18:46:04 +00:00
pPlayer - > Pause ( PauseType , false ) ;
pPlayer - > SpectatePlayerName ( pResult - > GetString ( 0 ) ) ;
2017-12-23 19:42:52 +00:00
}
2012-03-08 16:24:23 +00:00
}
2019-06-30 23:17:32 +00:00
else if ( - PauseState ! = CPlayer : : PAUSE_NONE & & PauseType ! = CPlayer : : PAUSE_NONE )
2011-08-27 15:11:39 +00:00
{
2018-03-01 18:46:04 +00:00
pPlayer - > Pause ( CPlayer : : PAUSE_NONE , false ) ;
}
else if ( - PauseState ! = PauseType )
{
pPlayer - > Pause ( PauseType , false ) ;
2011-08-27 15:11:39 +00:00
}
2011-12-29 13:58:39 +00:00
}
2018-03-01 18:46:04 +00:00
void ToggleSpecPauseVoted ( IConsole : : IResult * pResult , void * pUserData , int PauseType )
2011-12-29 13:58:39 +00:00
{
2017-04-08 22:20:41 +00:00
if ( ! CheckClientID ( pResult - > m_ClientID ) )
return ;
2011-12-29 13:58:39 +00:00
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
2011-12-29 13:58:39 +00:00
CPlayer * pPlayer = pSelf - > m_apPlayers [ pResult - > m_ClientID ] ;
if ( ! pPlayer )
return ;
2017-04-08 22:20:41 +00:00
int PauseState = pPlayer - > IsPaused ( ) ;
2018-03-01 18:46:04 +00:00
if ( PauseState > 0 )
2011-12-29 13:58:39 +00:00
{
2020-09-26 19:41:58 +00:00
IServer * pServ = pSelf - > Server ( ) ;
2017-04-08 22:20:41 +00:00
char aBuf [ 128 ] ;
str_format ( aBuf , sizeof ( aBuf ) , " You are force-paused for %d seconds. " , ( PauseState - pServ - > Tick ( ) ) / pServ - > TickSpeed ( ) ) ;
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " spec " , aBuf ) ;
2018-12-23 21:32:54 +00:00
return ;
2011-12-29 13:58:39 +00:00
}
2018-12-23 21:32:54 +00:00
bool IsPlayerBeingVoted = pSelf - > m_VoteCloseTime & &
2020-09-26 19:41:58 +00:00
( pSelf - > IsKickVote ( ) | | pSelf - > IsSpecVote ( ) ) & &
pResult - > m_ClientID ! = pSelf - > m_VoteVictim ;
2018-12-23 21:32:54 +00:00
if ( ( ! IsPlayerBeingVoted & & - PauseState = = PauseType ) | |
( IsPlayerBeingVoted & & PauseState & & pPlayer - > m_SpectatorID = = pSelf - > m_VoteVictim ) )
2018-03-01 18:46:04 +00:00
{
pPlayer - > Pause ( CPlayer : : PAUSE_NONE , false ) ;
}
else
{
pPlayer - > Pause ( PauseType , false ) ;
2018-12-23 21:32:54 +00:00
if ( IsPlayerBeingVoted )
pPlayer - > m_SpectatorID = pSelf - > m_VoteVictim ;
2018-03-01 18:46:04 +00:00
}
}
void CGameContext : : ConToggleSpec ( IConsole : : IResult * pResult , void * pUserData )
{
ToggleSpecPause ( pResult , pUserData , g_Config . m_SvPauseable ? CPlayer : : PAUSE_SPEC : CPlayer : : PAUSE_PAUSED ) ;
}
void CGameContext : : ConToggleSpecVoted ( IConsole : : IResult * pResult , void * pUserData )
{
ToggleSpecPauseVoted ( pResult , pUserData , g_Config . m_SvPauseable ? CPlayer : : PAUSE_SPEC : CPlayer : : PAUSE_PAUSED ) ;
}
void CGameContext : : ConTogglePause ( IConsole : : IResult * pResult , void * pUserData )
{
ToggleSpecPause ( pResult , pUserData , CPlayer : : PAUSE_PAUSED ) ;
}
void CGameContext : : ConTogglePauseVoted ( IConsole : : IResult * pResult , void * pUserData )
{
ToggleSpecPauseVoted ( pResult , pUserData , CPlayer : : PAUSE_PAUSED ) ;
2011-08-27 15:11:39 +00:00
}
2013-07-21 06:46:52 +00:00
void CGameContext : : ConTeamTop5 ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2013-07-21 06:46:52 +00:00
return ;
2020-09-26 19:41:58 +00:00
if ( g_Config . m_SvHideScore )
2013-07-21 06:46:52 +00:00
{
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " teamtop5 " ,
2020-09-26 19:41:58 +00:00
" Showing the team top 5 is not allowed on this server. " ) ;
2013-07-21 06:46:52 +00:00
return ;
}
2020-12-09 19:23:26 +00:00
if ( pResult - > NumArguments ( ) = = 0 )
{
pSelf - > Score ( ) - > ShowTeamTop5 ( pResult - > m_ClientID , 1 ) ;
}
else if ( pResult - > NumArguments ( ) = = 1 )
{
if ( pResult - > GetInteger ( 0 ) ! = 0 )
{
pSelf - > Score ( ) - > ShowTeamTop5 ( pResult - > m_ClientID , pResult - > GetInteger ( 0 ) ) ;
}
else
{
const char * pRequestedName = ( str_comp ( pResult - > GetString ( 0 ) , " me " ) = = 0 ) ?
pSelf - > Server ( ) - > ClientName ( pResult - > m_ClientID ) :
pResult - > GetString ( 0 ) ;
pSelf - > Score ( ) - > ShowTeamTop5 ( pResult - > m_ClientID , pRequestedName , 0 ) ;
}
}
else if ( pResult - > NumArguments ( ) = = 2 & & pResult - > GetInteger ( 1 ) ! = 0 )
{
const char * pRequestedName = ( str_comp ( pResult - > GetString ( 0 ) , " me " ) = = 0 ) ?
pSelf - > Server ( ) - > ClientName ( pResult - > m_ClientID ) :
pResult - > GetString ( 0 ) ;
pSelf - > Score ( ) - > ShowTeamTop5 ( pResult - > m_ClientID , pRequestedName , pResult - > GetInteger ( 1 ) ) ;
}
2013-07-21 06:46:52 +00:00
else
2020-12-09 19:23:26 +00:00
{
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " teamtop5 " , " /top5team needs 0, 1 or 2 parameter. 1. = name, 2. = start number " ) ;
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " teamtop5 " , " Example: /top5team, /top5team me, /top5team Hans, /top5team \" Papa Smurf \" 5 " ) ;
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " teamtop5 " , " Bad: /top5team Papa Smurf 5 # Good: /top5team \" Papa Smurf \" 5 " ) ;
}
2013-07-28 15:53:07 +00:00
}
2011-08-27 15:11:39 +00:00
void CGameContext : : ConTop5 ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2011-12-25 13:51:04 +00:00
return ;
2011-08-27 15:11:39 +00:00
2020-09-26 19:41:58 +00:00
if ( g_Config . m_SvHideScore )
2011-08-27 15:11:39 +00:00
{
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " top5 " ,
2020-09-26 19:41:58 +00:00
" Showing the top 5 is not allowed on this server. " ) ;
2011-08-27 15:11:39 +00:00
return ;
}
2020-09-26 19:41:58 +00:00
if ( pResult - > NumArguments ( ) > 0 )
2020-05-29 14:50:01 +00:00
pSelf - > Score ( ) - > ShowTop5 ( pResult - > m_ClientID , pResult - > GetInteger ( 0 ) ) ;
2011-12-25 13:51:04 +00:00
else
2020-05-29 14:50:01 +00:00
pSelf - > Score ( ) - > ShowTop5 ( pResult - > m_ClientID ) ;
2011-08-27 15:11:39 +00:00
}
2011-08-31 10:30:18 +00:00
2011-08-27 15:11:39 +00:00
void CGameContext : : ConTimes ( IConsole : : IResult * pResult , void * pUserData )
{
2011-08-31 22:30:37 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
2020-06-24 21:14:09 +00:00
if ( ! CheckClientID ( pResult - > m_ClientID ) )
return ;
2011-08-27 15:11:39 +00:00
2020-06-24 21:14:09 +00:00
if ( pResult - > NumArguments ( ) = = 0 )
2011-08-27 15:11:39 +00:00
{
2020-06-24 21:14:09 +00:00
pSelf - > Score ( ) - > ShowTimes ( pResult - > m_ClientID , 1 ) ;
}
else if ( pResult - > NumArguments ( ) = = 1 )
{
if ( pResult - > GetInteger ( 0 ) ! = 0 )
2011-08-27 15:11:39 +00:00
{
2020-06-24 21:14:09 +00:00
pSelf - > Score ( ) - > ShowTimes ( pResult - > m_ClientID , pResult - > GetInteger ( 0 ) ) ;
2011-08-27 15:11:39 +00:00
}
2017-04-13 07:38:53 +00:00
else
{
2020-06-24 21:14:09 +00:00
const char * pRequestedName = ( str_comp ( pResult - > GetString ( 0 ) , " me " ) = = 0 ) ?
2020-09-26 19:41:58 +00:00
pSelf - > Server ( ) - > ClientName ( pResult - > m_ClientID ) :
pResult - > GetString ( 0 ) ;
2020-06-24 21:14:09 +00:00
pSelf - > Score ( ) - > ShowTimes ( pResult - > m_ClientID , pRequestedName , pResult - > GetInteger ( 1 ) ) ;
2017-04-13 07:38:53 +00:00
}
2011-12-25 13:51:04 +00:00
}
2020-06-24 21:14:09 +00:00
else if ( pResult - > NumArguments ( ) = = 2 & & pResult - > GetInteger ( 1 ) ! = 0 )
{
const char * pRequestedName = ( str_comp ( pResult - > GetString ( 0 ) , " me " ) = = 0 ) ?
2020-09-26 19:41:58 +00:00
pSelf - > Server ( ) - > ClientName ( pResult - > m_ClientID ) :
pResult - > GetString ( 0 ) ;
2020-06-24 21:14:09 +00:00
pSelf - > Score ( ) - > ShowTimes ( pResult - > m_ClientID , pRequestedName , pResult - > GetInteger ( 1 ) ) ;
}
else
{
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " times " , " /times needs 0, 1 or 2 parameter. 1. = name, 2. = start number " ) ;
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " times " , " Example: /times, /times me, /times Hans, /times \" Papa Smurf \" 5 " ) ;
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " times " , " Bad: /times Papa Smurf 5 # Good: /times \" Papa Smurf \" 5 " ) ;
}
2019-03-29 13:39:45 +00:00
}
2011-08-27 15:11:39 +00:00
2013-12-22 17:30:13 +00:00
void CGameContext : : ConDND ( IConsole : : IResult * pResult , void * pUserData )
{
CGameContext * pSelf = ( CGameContext * ) pUserData ;
2020-09-26 19:41:58 +00:00
if ( ! CheckClientID ( pResult - > m_ClientID ) )
return ;
2013-12-22 17:30:13 +00:00
CPlayer * pPlayer = pSelf - > m_apPlayers [ pResult - > m_ClientID ] ;
if ( ! pPlayer )
return ;
if ( pPlayer - > m_DND )
{
pPlayer - > m_DND = false ;
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " dnd " , " You will receive global chat and server messages " ) ;
}
else
{
pPlayer - > m_DND = true ;
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " dnd " , " You will not receive any further global chat and server messages " ) ;
}
}
2014-02-19 20:22:36 +00:00
void CGameContext : : ConMap ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2014-02-19 20:22:36 +00:00
return ;
2020-09-26 19:41:58 +00:00
if ( g_Config . m_SvMapVote = = 0 )
2014-03-07 22:58:22 +00:00
{
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " map " ,
2020-09-26 19:41:58 +00:00
" /map is disabled " ) ;
2014-03-07 22:58:22 +00:00
return ;
}
2020-09-26 19:41:58 +00:00
if ( pResult - > NumArguments ( ) < = 0 )
2014-02-19 20:22:36 +00:00
{
2014-02-19 20:35:56 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " map " , " Example: /map adr3 to call vote for Adrenaline 3. This means that the map name must start with 'a' and contain the characters 'd', 'r' and '3' in that order " ) ;
2014-02-19 20:22:36 +00:00
return ;
}
2014-04-23 23:02:03 +00:00
CPlayer * pPlayer = pSelf - > m_apPlayers [ pResult - > m_ClientID ] ;
2020-09-26 19:41:58 +00:00
if ( ! pPlayer )
2014-04-23 23:02:03 +00:00
return ;
2020-06-14 08:44:14 +00:00
if ( pSelf - > RateLimitPlayerVote ( pResult - > m_ClientID ) | | pSelf - > RateLimitPlayerMapVote ( pResult - > m_ClientID ) )
return ;
2020-05-28 13:29:14 +00:00
pSelf - > Score ( ) - > MapVote ( pResult - > m_ClientID , pResult - > GetString ( 0 ) ) ;
2014-02-19 20:22:36 +00:00
}
2014-10-11 10:58:27 +00:00
void CGameContext : : ConMapInfo ( IConsole : : IResult * pResult , void * pUserData )
2013-11-28 14:11:59 +00:00
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2013-11-28 14:11:59 +00:00
return ;
CPlayer * pPlayer = pSelf - > m_apPlayers [ pResult - > m_ClientID ] ;
2020-09-26 19:41:58 +00:00
if ( ! pPlayer )
2013-11-28 14:11:59 +00:00
return ;
2020-09-26 19:41:58 +00:00
if ( pResult - > NumArguments ( ) > 0 )
2014-10-11 10:58:27 +00:00
pSelf - > Score ( ) - > MapInfo ( pResult - > m_ClientID , pResult - > GetString ( 0 ) ) ;
2013-11-28 14:11:59 +00:00
else
2014-10-11 10:58:27 +00:00
pSelf - > Score ( ) - > MapInfo ( pResult - > m_ClientID , g_Config . m_SvMap ) ;
2013-11-28 14:11:59 +00:00
}
2014-08-09 15:25:29 +00:00
void CGameContext : : ConTimeout ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2014-08-09 15:25:29 +00:00
return ;
CPlayer * pPlayer = pSelf - > m_apPlayers [ pResult - > m_ClientID ] ;
2020-09-26 19:41:58 +00:00
if ( ! pPlayer )
2014-08-09 15:25:29 +00:00
return ;
2020-09-26 19:41:58 +00:00
const char * pTimeout = pResult - > NumArguments ( ) > 0 ? pResult - > GetString ( 0 ) : pPlayer - > m_TimeoutCode ;
2018-04-29 14:01:01 +00:00
2020-06-20 16:50:14 +00:00
if ( ! pSelf - > Server ( ) - > IsSixup ( pResult - > m_ClientID ) )
2014-08-09 15:25:29 +00:00
{
2020-06-20 16:50:14 +00:00
for ( int i = 0 ; i < pSelf - > Server ( ) - > MaxClients ( ) ; i + + )
{
2020-09-26 19:41:58 +00:00
if ( i = = pResult - > m_ClientID )
continue ;
if ( ! pSelf - > m_apPlayers [ i ] )
continue ;
if ( str_comp ( pSelf - > m_apPlayers [ i ] - > m_TimeoutCode , pTimeout ) )
continue ;
if ( pSelf - > Server ( ) - > SetTimedOut ( i , pResult - > m_ClientID ) )
2020-06-20 16:50:14 +00:00
{
2020-09-26 19:41:58 +00:00
if ( pSelf - > m_apPlayers [ i ] - > GetCharacter ( ) )
2020-06-20 16:50:14 +00:00
pSelf - > SendTuningParams ( i , pSelf - > m_apPlayers [ i ] - > GetCharacter ( ) - > m_TuneZone ) ;
/*if(pSelf->Server()->IsSixup(i))
pSelf - > SendClientInfo ( i , i ) ; */
return ;
}
2014-08-09 15:25:29 +00:00
}
}
2020-06-20 16:50:14 +00:00
else
{
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " print " ,
" Your timeout code has been set. 0.7 clients can not reclaim their tees on timeout; however, a 0.6 client can claim your tee " ) ;
}
2014-08-09 15:25:29 +00:00
2017-06-06 03:51:12 +00:00
pSelf - > Server ( ) - > SetTimeoutProtected ( pResult - > m_ClientID ) ;
2014-08-09 15:25:29 +00:00
str_copy ( pPlayer - > m_TimeoutCode , pResult - > GetString ( 0 ) , sizeof ( pPlayer - > m_TimeoutCode ) ) ;
}
2020-05-22 21:59:47 +00:00
void CGameContext : : ConPractice ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
2020-05-22 21:59:47 +00:00
if ( ! CheckClientID ( pResult - > m_ClientID ) )
return ;
CPlayer * pPlayer = pSelf - > m_apPlayers [ pResult - > m_ClientID ] ;
if ( ! pPlayer )
return ;
if ( pSelf - > ProcessSpamProtection ( pResult - > m_ClientID ) )
return ;
2020-05-28 11:27:10 +00:00
if ( ! g_Config . m_SvPractice )
{
pSelf - > Console ( ) - > Print (
2020-09-26 19:41:58 +00:00
IConsole : : OUTPUT_LEVEL_STANDARD ,
" print " ,
" Practice mode is disabled " ) ;
2020-05-28 11:27:10 +00:00
return ;
}
2020-09-26 19:41:58 +00:00
CGameTeams & Teams = ( ( CGameControllerDDRace * ) pSelf - > m_pController ) - > m_Teams ;
2020-05-22 21:59:47 +00:00
int Team = Teams . m_Core . Team ( pResult - > m_ClientID ) ;
2020-06-30 18:22:17 +00:00
if ( Team < TEAM_FLOCK | | ( Team = = TEAM_FLOCK & & g_Config . m_SvTeam ! = 3 ) | | Team > = TEAM_SUPER )
2020-05-22 21:59:47 +00:00
{
pSelf - > Console ( ) - > Print (
2020-09-26 19:41:58 +00:00
IConsole : : OUTPUT_LEVEL_STANDARD ,
" print " ,
" Join a team to enable practice mode, which means you can use /r, but can't earn a rank. " ) ;
2020-05-22 21:59:47 +00:00
return ;
}
if ( Teams . IsPractice ( Team ) )
{
pSelf - > Console ( ) - > Print (
2020-09-26 19:41:58 +00:00
IConsole : : OUTPUT_LEVEL_STANDARD ,
" print " ,
" Team is already in practice mode " ) ;
2020-05-22 21:59:47 +00:00
return ;
}
bool VotedForPractice = pResult - > NumArguments ( ) = = 0 | | pResult - > GetInteger ( 0 ) ;
if ( VotedForPractice = = pPlayer - > m_VotedForPractice )
return ;
pPlayer - > m_VotedForPractice = VotedForPractice ;
int NumCurrentVotes = 0 ;
int TeamSize = 0 ;
for ( int i = 0 ; i < MAX_CLIENTS ; i + + )
{
if ( Teams . m_Core . Team ( i ) = = Team )
{
CPlayer * pPlayer2 = pSelf - > m_apPlayers [ i ] ;
if ( pPlayer2 & & pPlayer2 - > m_VotedForPractice )
NumCurrentVotes + + ;
TeamSize + + ;
}
}
int NumRequiredVotes = TeamSize / 2 + 1 ;
char aBuf [ 512 ] ;
2020-05-30 17:09:21 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " '%s' voted to %s /practice mode for your team, which means you can use /r, but you can't earn a rank. Type /practice to vote (%d/%d required votes) " , pSelf - > Server ( ) - > ClientName ( pResult - > m_ClientID ) , VotedForPractice ? " enable " : " disable " , NumCurrentVotes , NumRequiredVotes ) ;
2020-05-22 21:59:47 +00:00
for ( int i = 0 ; i < MAX_CLIENTS ; i + + )
if ( Teams . m_Core . Team ( i ) = = Team )
pSelf - > SendChatTarget ( i , aBuf ) ;
if ( NumCurrentVotes > = NumRequiredVotes )
{
Teams . EnablePractice ( Team ) ;
for ( int i = 0 ; i < MAX_CLIENTS ; i + + )
if ( Teams . m_Core . Team ( i ) = = Team )
pSelf - > SendChatTarget ( i , " Practice mode enabled for your team, happy practicing! " ) ;
}
}
2014-07-26 12:46:31 +00:00
void CGameContext : : ConSave ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2014-07-26 12:46:31 +00:00
return ;
if ( ! g_Config . m_SvSaveGames )
{
pSelf - > SendChatTarget ( pResult - > m_ClientID , " Save-function is disabled on this server " ) ;
return ;
}
2020-09-26 19:41:58 +00:00
const char * pCode = " " ;
2020-06-10 20:58:49 +00:00
if ( pResult - > NumArguments ( ) > 0 )
pCode = pResult - > GetString ( 0 ) ;
2020-09-13 19:49:01 +00:00
pSelf - > Score ( ) - > SaveTeam ( pResult - > m_ClientID , pCode , g_Config . m_SvSqlServerName ) ;
2014-07-26 12:46:31 +00:00
}
void CGameContext : : ConLoad ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2014-07-26 12:46:31 +00:00
return ;
if ( ! g_Config . m_SvSaveGames )
{
pSelf - > SendChatTarget ( pResult - > m_ClientID , " Save-function is disabled on this server " ) ;
return ;
}
2020-05-23 17:01:19 +00:00
if ( pResult - > NumArguments ( ) > 0 )
2014-07-26 12:46:31 +00:00
pSelf - > Score ( ) - > LoadTeam ( pResult - > GetString ( 0 ) , pResult - > m_ClientID ) ;
else
2020-05-23 17:01:19 +00:00
pSelf - > Score ( ) - > GetSaves ( pResult - > m_ClientID ) ;
2014-07-26 12:46:31 +00:00
}
2013-07-21 06:46:52 +00:00
void CGameContext : : ConTeamRank ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2013-07-21 06:46:52 +00:00
return ;
2020-09-26 19:41:58 +00:00
if ( pResult - > NumArguments ( ) > 0 )
2020-06-24 21:14:09 +00:00
{
2020-09-26 19:41:58 +00:00
if ( ! g_Config . m_SvHideScore )
2020-05-28 15:48:34 +00:00
pSelf - > Score ( ) - > ShowTeamRank ( pResult - > m_ClientID , pResult - > GetString ( 0 ) ) ;
2013-07-21 06:46:52 +00:00
else
pSelf - > Console ( ) - > Print (
2020-09-26 19:41:58 +00:00
IConsole : : OUTPUT_LEVEL_STANDARD ,
" teamrank " ,
" Showing the team rank of other players is not allowed on this server. " ) ;
2020-06-24 21:14:09 +00:00
}
2013-07-21 06:46:52 +00:00
else
pSelf - > Score ( ) - > ShowTeamRank ( pResult - > m_ClientID ,
2020-09-26 19:41:58 +00:00
pSelf - > Server ( ) - > ClientName ( pResult - > m_ClientID ) ) ;
2013-07-21 06:46:52 +00:00
}
2011-08-27 15:11:39 +00:00
void CGameContext : : ConRank ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2011-12-25 13:51:04 +00:00
return ;
2011-08-27 15:11:39 +00:00
2020-09-26 19:41:58 +00:00
if ( pResult - > NumArguments ( ) > 0 )
2020-06-24 21:14:09 +00:00
{
2020-09-26 19:41:58 +00:00
if ( ! g_Config . m_SvHideScore )
2020-05-28 15:48:34 +00:00
pSelf - > Score ( ) - > ShowRank ( pResult - > m_ClientID , pResult - > GetString ( 0 ) ) ;
2011-08-27 15:11:39 +00:00
else
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print (
2020-09-26 19:41:58 +00:00
IConsole : : OUTPUT_LEVEL_STANDARD ,
" rank " ,
" Showing the rank of other players is not allowed on this server. " ) ;
2020-06-24 21:14:09 +00:00
}
2011-08-27 15:11:39 +00:00
else
2011-12-25 13:51:04 +00:00
pSelf - > Score ( ) - > ShowRank ( pResult - > m_ClientID ,
2020-09-26 19:41:58 +00:00
pSelf - > Server ( ) - > ClientName ( pResult - > m_ClientID ) ) ;
2011-08-27 15:11:39 +00:00
}
2013-11-15 23:44:49 +00:00
void CGameContext : : ConLockTeam ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2013-11-15 23:44:49 +00:00
return ;
2020-05-30 10:58:59 +00:00
if ( g_Config . m_SvTeam = = 0 | | g_Config . m_SvTeam = = 3 )
{
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " lock " ,
2020-09-26 19:41:58 +00:00
" Teams are disabled " ) ;
2020-05-30 10:58:59 +00:00
return ;
}
2020-09-26 19:41:58 +00:00
int Team = ( ( CGameControllerDDRace * ) pSelf - > m_pController ) - > m_Teams . m_Core . Team ( pResult - > m_ClientID ) ;
2013-11-15 23:44:49 +00:00
2020-09-26 19:41:58 +00:00
bool Lock = ( ( CGameControllerDDRace * ) pSelf - > m_pController ) - > m_Teams . TeamLocked ( Team ) ;
2014-04-28 15:02:39 +00:00
2020-09-26 19:41:58 +00:00
if ( pResult - > NumArguments ( ) > 0 )
2014-04-28 15:02:39 +00:00
Lock = ! pResult - > GetInteger ( 0 ) ;
2018-05-11 20:05:32 +00:00
if ( Team < = TEAM_FLOCK | | Team > = TEAM_SUPER )
2013-11-15 23:44:49 +00:00
{
2018-05-11 20:05:32 +00:00
pSelf - > Console ( ) - > Print (
2020-09-26 19:41:58 +00:00
IConsole : : OUTPUT_LEVEL_STANDARD ,
" print " ,
" This team can't be locked " ) ;
2018-05-11 20:05:32 +00:00
return ;
}
2013-11-15 23:44:49 +00:00
2018-05-11 20:05:32 +00:00
if ( pSelf - > ProcessSpamProtection ( pResult - > m_ClientID ) )
return ;
2014-06-25 23:33:10 +00:00
2018-05-11 20:05:32 +00:00
char aBuf [ 512 ] ;
if ( Lock )
{
2020-05-23 15:55:56 +00:00
pSelf - > UnlockTeam ( pResult - > m_ClientID , Team ) ;
2013-11-15 23:44:49 +00:00
}
2018-05-11 20:05:32 +00:00
else
{
2020-09-26 19:41:58 +00:00
( ( CGameControllerDDRace * ) pSelf - > m_pController ) - > m_Teams . SetTeamLock ( Team , true ) ;
2018-05-11 20:05:32 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " '%s' locked your team. After the race started killing will kill everyone in your team. " , pSelf - > Server ( ) - > ClientName ( pResult - > m_ClientID ) ) ;
2020-09-26 19:41:58 +00:00
for ( int i = 0 ; i < MAX_CLIENTS ; i + + )
if ( ( ( CGameControllerDDRace * ) pSelf - > m_pController ) - > m_Teams . m_Core . Team ( i ) = = Team )
2018-05-11 20:05:32 +00:00
pSelf - > SendChatTarget ( i , aBuf ) ;
}
2013-11-15 23:44:49 +00:00
}
2020-05-23 15:55:56 +00:00
void CGameContext : : ConUnlockTeam ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2020-05-23 15:55:56 +00:00
return ;
2020-06-30 18:22:17 +00:00
if ( g_Config . m_SvTeam = = 0 | | g_Config . m_SvTeam = = 3 )
{
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " unlock " ,
2020-09-26 19:41:58 +00:00
" Teams are disabled " ) ;
2020-06-30 18:22:17 +00:00
return ;
}
2020-09-26 19:41:58 +00:00
int Team = ( ( CGameControllerDDRace * ) pSelf - > m_pController ) - > m_Teams . m_Core . Team ( pResult - > m_ClientID ) ;
2020-05-23 15:55:56 +00:00
if ( Team < = TEAM_FLOCK | | Team > = TEAM_SUPER )
return ;
if ( pSelf - > ProcessSpamProtection ( pResult - > m_ClientID ) )
return ;
pSelf - > UnlockTeam ( pResult - > m_ClientID , Team ) ;
}
void CGameContext : : UnlockTeam ( int ClientID , int Team )
{
2020-09-26 19:41:58 +00:00
( ( CGameControllerDDRace * ) m_pController ) - > m_Teams . SetTeamLock ( Team , false ) ;
2020-05-23 15:55:56 +00:00
char aBuf [ 512 ] ;
str_format ( aBuf , sizeof ( aBuf ) , " '%s' unlocked your team. " , Server ( ) - > ClientName ( ClientID ) ) ;
2020-09-26 19:41:58 +00:00
for ( int i = 0 ; i < MAX_CLIENTS ; i + + )
if ( ( ( CGameControllerDDRace * ) m_pController ) - > m_Teams . m_Core . Team ( i ) = = Team )
2020-05-23 15:55:56 +00:00
SendChatTarget ( i , aBuf ) ;
}
2017-04-23 20:50:07 +00:00
void CGameContext : : ConInviteTeam ( IConsole : : IResult * pResult , void * pUserData )
{
CGameContext * pSelf = ( CGameContext * ) pUserData ;
CGameControllerDDRace * pController = ( CGameControllerDDRace * ) pSelf - > m_pController ;
const char * pName = pResult - > GetString ( 0 ) ;
2017-05-14 20:16:58 +00:00
if ( g_Config . m_SvTeam = = 0 | | g_Config . m_SvTeam = = 3 )
{
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " join " ,
2020-09-26 19:41:58 +00:00
" Teams are disabled " ) ;
2017-05-14 20:16:58 +00:00
return ;
}
2017-04-24 12:04:50 +00:00
if ( ! g_Config . m_SvInvite )
{
2019-02-27 18:46:01 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " invite " , " Invites are disabled " ) ;
2017-05-14 20:16:58 +00:00
return ;
2017-04-24 12:04:50 +00:00
}
2017-04-23 20:50:07 +00:00
int Team = pController - > m_Teams . m_Core . Team ( pResult - > m_ClientID ) ;
if ( Team > TEAM_FLOCK & & Team < TEAM_SUPER )
{
int Target = - 1 ;
for ( int i = 0 ; i < MAX_CLIENTS ; i + + )
{
if ( ! str_comp ( pName , pSelf - > Server ( ) - > ClientName ( i ) ) )
{
Target = i ;
break ;
}
}
if ( Target < 0 )
{
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " invite " , " Player not found " ) ;
return ;
}
if ( pController - > m_Teams . IsInvited ( Team , Target ) )
{
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " invite " , " Player already invited " ) ;
return ;
}
2017-04-24 12:04:50 +00:00
if ( pSelf - > m_apPlayers [ pResult - > m_ClientID ] & & pSelf - > m_apPlayers [ pResult - > m_ClientID ] - > m_LastInvited + g_Config . m_SvInviteFrequency * pSelf - > Server ( ) - > TickSpeed ( ) > pSelf - > Server ( ) - > Tick ( ) )
{
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " invite " , " Can't invite this quickly " ) ;
return ;
}
2017-04-23 20:50:07 +00:00
pController - > m_Teams . SetClientInvited ( Team , Target , true ) ;
2017-04-24 12:04:50 +00:00
pSelf - > m_apPlayers [ pResult - > m_ClientID ] - > m_LastInvited = pSelf - > Server ( ) - > Tick ( ) ;
2017-04-23 20:50:07 +00:00
char aBuf [ 512 ] ;
str_format ( aBuf , sizeof aBuf , " '%s' invited you to team %d. " , pSelf - > Server ( ) - > ClientName ( pResult - > m_ClientID ) , Team ) ;
pSelf - > SendChatTarget ( Target , aBuf ) ;
2020-09-26 19:41:58 +00:00
str_format ( aBuf , sizeof aBuf , " '%s' invited '%s' to your team. " , pSelf - > Server ( ) - > ClientName ( pResult - > m_ClientID ) , pSelf - > Server ( ) - > ClientName ( Target ) ) ;
;
for ( int i = 0 ; i < MAX_CLIENTS ; i + + )
if ( ( ( CGameControllerDDRace * ) pSelf - > m_pController ) - > m_Teams . m_Core . Team ( i ) = = Team )
2017-05-20 23:20:04 +00:00
pSelf - > SendChatTarget ( i , aBuf ) ;
2017-04-23 20:50:07 +00:00
}
else
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " invite " , " Can't invite players to this team " ) ;
}
2011-08-27 15:11:39 +00:00
void CGameContext : : ConJoinTeam ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
2017-03-06 11:14:38 +00:00
CGameControllerDDRace * pController = ( CGameControllerDDRace * ) pSelf - > m_pController ;
2020-09-26 19:41:58 +00:00
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2011-12-25 13:51:04 +00:00
return ;
2011-08-27 15:11:39 +00:00
2012-04-11 13:36:11 +00:00
CPlayer * pPlayer = pSelf - > m_apPlayers [ pResult - > m_ClientID ] ;
2020-09-26 19:41:58 +00:00
if ( ! pPlayer )
2014-04-23 23:02:03 +00:00
return ;
2012-04-11 13:36:11 +00:00
2020-09-26 19:41:58 +00:00
if ( pSelf - > m_VoteCloseTime & & pSelf - > m_VoteCreator = = pResult - > m_ClientID & & ( pSelf - > IsKickVote ( ) | | pSelf - > IsSpecVote ( ) ) )
2011-08-27 15:11:39 +00:00
{
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print (
2020-09-26 19:41:58 +00:00
IConsole : : OUTPUT_LEVEL_STANDARD ,
" join " ,
" You are running a vote please try again after the vote is done! " ) ;
2011-08-27 15:11:39 +00:00
return ;
}
2020-09-26 19:41:58 +00:00
else if ( g_Config . m_SvTeam = = 0 | | g_Config . m_SvTeam = = 3 )
2011-08-27 15:11:39 +00:00
{
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " join " ,
2020-09-26 19:41:58 +00:00
" Teams are disabled " ) ;
2011-08-27 15:11:39 +00:00
return ;
}
2020-09-26 19:41:58 +00:00
else if ( g_Config . m_SvTeam = = 2 & & pResult - > GetInteger ( 0 ) = = 0 & & pPlayer - > GetCharacter ( ) & & pPlayer - > GetCharacter ( ) - > m_LastStartWarning < pSelf - > Server ( ) - > Tick ( ) - 3 * pSelf - > Server ( ) - > TickSpeed ( ) )
2011-08-27 15:11:39 +00:00
{
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print (
2020-09-26 19:41:58 +00:00
IConsole : : OUTPUT_LEVEL_STANDARD ,
" join " ,
" You must join a team and play with somebody or else you can \' t play " ) ;
2012-04-11 13:36:11 +00:00
pPlayer - > GetCharacter ( ) - > m_LastStartWarning = pSelf - > Server ( ) - > Tick ( ) ;
2011-08-27 15:11:39 +00:00
}
2020-09-26 19:41:58 +00:00
if ( pResult - > NumArguments ( ) > 0 )
2011-08-27 15:11:39 +00:00
{
2020-09-26 19:41:58 +00:00
if ( pPlayer - > GetCharacter ( ) = = 0 )
2011-08-27 15:11:39 +00:00
{
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " join " ,
2020-09-26 19:41:58 +00:00
" You can't change teams while you are dead/a spectator. " ) ;
2011-08-27 15:11:39 +00:00
}
else
{
2020-05-22 21:59:47 +00:00
int Team = pResult - > GetInteger ( 0 ) ;
2020-09-21 13:36:55 +00:00
if ( Team = = pController - > m_Teams . m_Core . Team ( pResult - > m_ClientID ) )
{
char aBuf [ 32 ] ;
str_format ( aBuf , sizeof ( aBuf ) , " You are in team %d already " , Team ) ;
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " join " , aBuf ) ;
}
2020-10-05 17:03:14 +00:00
else if ( pPlayer - > m_Last_Team + ( int64_t ) pSelf - > Server ( ) - > TickSpeed ( ) * g_Config . m_SvTeamChangeDelay > pSelf - > Server ( ) - > Tick ( ) )
2011-08-27 15:11:39 +00:00
{
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " join " ,
2020-09-26 19:41:58 +00:00
" You can \' t change teams that fast! " ) ;
2011-12-25 11:20:10 +00:00
}
2020-05-22 21:59:47 +00:00
else if ( Team > 0 & & Team < MAX_CLIENTS & & pController - > m_Teams . TeamLocked ( Team ) & & ! pController - > m_Teams . IsInvited ( Team , pResult - > m_ClientID ) )
2013-11-15 23:44:49 +00:00
{
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " join " ,
2020-09-26 19:41:58 +00:00
g_Config . m_SvInvite ?
2017-04-24 12:04:50 +00:00
" This team is locked using /lock. Only members of the team can unlock it using /lock. " :
2017-04-23 20:50:07 +00:00
" This team is locked using /lock. Only members of the team can invite you or unlock it using /lock. " ) ;
2013-11-15 23:44:49 +00:00
}
2020-05-22 21:59:47 +00:00
else if ( Team > 0 & & Team < MAX_CLIENTS & & pController - > m_Teams . Count ( Team ) > = g_Config . m_SvTeamMaxSize )
2013-08-05 01:43:58 +00:00
{
char aBuf [ 512 ] ;
str_format ( aBuf , sizeof ( aBuf ) , " This team already has the maximum allowed size of %d players " , g_Config . m_SvTeamMaxSize ) ;
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " join " , aBuf ) ;
}
2020-05-22 21:59:47 +00:00
else if ( pController - > m_Teams . SetCharacterTeam ( pPlayer - > GetCID ( ) , Team ) )
2011-12-25 11:20:10 +00:00
{
char aBuf [ 512 ] ;
2011-12-25 13:51:04 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " %s joined team %d " ,
2020-09-26 19:41:58 +00:00
pSelf - > Server ( ) - > ClientName ( pPlayer - > GetCID ( ) ) ,
Team ) ;
2011-12-25 11:20:10 +00:00
pSelf - > SendChat ( - 1 , CGameContext : : CHAT_ALL , aBuf ) ;
pPlayer - > m_Last_Team = pSelf - > Server ( ) - > Tick ( ) ;
2020-05-22 21:59:47 +00:00
if ( pController - > m_Teams . IsPractice ( Team ) )
pSelf - > SendChatTarget ( pPlayer - > GetCID ( ) , " Practice mode enabled for your team, happy practicing! " ) ;
2011-08-27 15:11:39 +00:00
}
else
{
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " join " ,
2020-09-26 19:41:58 +00:00
" You cannot join this team at this time " ) ;
2011-08-27 15:11:39 +00:00
}
}
}
else
{
char aBuf [ 512 ] ;
2020-09-26 19:41:58 +00:00
if ( ! pPlayer - > IsPlaying ( ) )
2011-08-27 15:11:39 +00:00
{
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print (
2020-09-26 19:41:58 +00:00
IConsole : : OUTPUT_LEVEL_STANDARD ,
" join " ,
" You can't check your team while you are dead/a spectator. " ) ;
2011-08-27 15:11:39 +00:00
}
else
{
2011-12-25 13:51:04 +00:00
str_format (
2020-09-26 19:41:58 +00:00
aBuf ,
sizeof ( aBuf ) ,
" You are in team %d " ,
( ( CGameControllerDDRace * ) pSelf - > m_pController ) - > m_Teams . m_Core . Team ( pResult - > m_ClientID ) ) ;
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " join " ,
2020-09-26 19:41:58 +00:00
aBuf ) ;
2011-08-27 15:11:39 +00:00
}
}
}
void CGameContext : : ConMe ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2011-12-25 13:51:04 +00:00
return ;
2011-08-27 15:11:39 +00:00
char aBuf [ 256 + 24 ] ;
2011-12-25 13:51:04 +00:00
str_format ( aBuf , 256 + 24 , " '%s' %s " ,
2020-09-26 19:41:58 +00:00
pSelf - > Server ( ) - > ClientName ( pResult - > m_ClientID ) ,
pResult - > GetString ( 0 ) ) ;
if ( g_Config . m_SvSlashMe )
2011-08-27 15:11:39 +00:00
pSelf - > SendChat ( - 2 , CGameContext : : CHAT_ALL , aBuf , pResult - > m_ClientID ) ;
else
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print (
2020-09-26 19:41:58 +00:00
IConsole : : OUTPUT_LEVEL_STANDARD ,
" me " ,
" /me is disabled on this server " ) ;
2011-08-27 15:11:39 +00:00
}
2013-10-18 09:42:35 +00:00
void CGameContext : : ConConverse ( IConsole : : IResult * pResult , void * pUserData )
{
// This will never be called
}
2013-08-09 13:04:20 +00:00
void CGameContext : : ConWhisper ( IConsole : : IResult * pResult , void * pUserData )
{
// This will never be called
}
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
void CGameContext : : ConSetEyeEmote ( IConsole : : IResult * pResult ,
2020-09-26 19:41:58 +00:00
void * pUserData )
2011-08-27 15:11:39 +00:00
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2011-12-25 13:51:04 +00:00
return ;
2011-08-27 15:11:39 +00:00
CPlayer * pPlayer = pSelf - > m_apPlayers [ pResult - > m_ClientID ] ;
2020-09-26 19:41:58 +00:00
if ( ! pPlayer )
2011-08-27 15:11:39 +00:00
return ;
2020-09-26 19:41:58 +00:00
if ( pResult - > NumArguments ( ) = = 0 )
{
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
pSelf - > Console ( ) - > Print (
2020-09-26 19:41:58 +00:00
IConsole : : OUTPUT_LEVEL_STANDARD ,
" emote " ,
( pPlayer - > m_EyeEmote ) ?
" You can now use the preset eye emotes. " :
" You don't have any eye emotes, remember to bind some. (until you die) " ) ;
2011-08-27 15:11:39 +00:00
return ;
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
}
2011-12-30 14:31:06 +00:00
else if ( str_comp_nocase ( pResult - > GetString ( 0 ) , " on " ) = = 0 )
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
pPlayer - > m_EyeEmote = true ;
2011-12-30 14:31:06 +00:00
else if ( str_comp_nocase ( pResult - > GetString ( 0 ) , " off " ) = = 0 )
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
pPlayer - > m_EyeEmote = false ;
2011-12-30 14:31:06 +00:00
else if ( str_comp_nocase ( pResult - > GetString ( 0 ) , " toggle " ) = = 0 )
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
pPlayer - > m_EyeEmote = ! pPlayer - > m_EyeEmote ;
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print (
2020-09-26 19:41:58 +00:00
IConsole : : OUTPUT_LEVEL_STANDARD ,
" emote " ,
( pPlayer - > m_EyeEmote ) ?
" You can now use the preset eye emotes. " :
" You don't have any eye emotes, remember to bind some. (until you die) " ) ;
2011-08-27 15:11:39 +00:00
}
void CGameContext : : ConEyeEmote ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( g_Config . m_SvEmotionalTees = = - 1 )
2011-12-25 13:51:04 +00:00
{
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " emote " ,
2020-09-26 19:41:58 +00:00
" Emotes are disabled. " ) ;
2011-11-08 12:04:57 +00:00
return ;
}
2020-09-26 19:41:58 +00:00
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2011-12-25 13:51:04 +00:00
return ;
2011-08-27 15:11:39 +00:00
CPlayer * pPlayer = pSelf - > m_apPlayers [ pResult - > m_ClientID ] ;
2020-09-26 19:41:58 +00:00
if ( ! pPlayer )
2011-08-27 15:11:39 +00:00
return ;
2020-09-26 19:41:58 +00:00
if ( pResult - > NumArguments ( ) = = 0 )
2011-08-27 15:11:39 +00:00
{
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print (
2020-09-26 19:41:58 +00:00
IConsole : : OUTPUT_LEVEL_STANDARD ,
" emote " ,
" Emote commands are: /emote surprise /emote blink /emote close /emote angry /emote happy /emote pain " ) ;
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print (
2020-09-26 19:41:58 +00:00
IConsole : : OUTPUT_LEVEL_STANDARD ,
" emote " ,
" Example: /emote surprise 10 for 10 seconds or /emote surprise (default 1 second) " ) ;
2011-08-27 15:11:39 +00:00
}
else
{
2020-10-05 17:03:14 +00:00
if ( pPlayer - > m_LastEyeEmote + ( int64_t ) g_Config . m_SvEyeEmoteChangeDelay * pSelf - > Server ( ) - > TickSpeed ( ) > = pSelf - > Server ( ) - > Tick ( ) )
2020-09-26 19:41:58 +00:00
return ;
2011-12-27 10:19:02 +00:00
2020-09-26 19:41:58 +00:00
if ( ! str_comp ( pResult - > GetString ( 0 ) , " angry " ) )
pPlayer - > m_DefEmote = EMOTE_ANGRY ;
else if ( ! str_comp ( pResult - > GetString ( 0 ) , " blink " ) )
pPlayer - > m_DefEmote = EMOTE_BLINK ;
else if ( ! str_comp ( pResult - > GetString ( 0 ) , " close " ) )
pPlayer - > m_DefEmote = EMOTE_BLINK ;
else if ( ! str_comp ( pResult - > GetString ( 0 ) , " happy " ) )
pPlayer - > m_DefEmote = EMOTE_HAPPY ;
else if ( ! str_comp ( pResult - > GetString ( 0 ) , " pain " ) )
pPlayer - > m_DefEmote = EMOTE_PAIN ;
else if ( ! str_comp ( pResult - > GetString ( 0 ) , " surprise " ) )
pPlayer - > m_DefEmote = EMOTE_SURPRISE ;
else if ( ! str_comp ( pResult - > GetString ( 0 ) , " normal " ) )
pPlayer - > m_DefEmote = EMOTE_NORMAL ;
else
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD ,
" emote " , " Unknown emote... Say /emote " ) ;
2011-08-27 15:11:39 +00:00
2020-09-26 19:41:58 +00:00
int Duration = 1 ;
if ( pResult - > NumArguments ( ) > 1 )
2020-10-20 14:46:23 +00:00
Duration = clamp ( pResult - > GetInteger ( 1 ) , 1 , 86400 ) ;
2011-08-27 15:11:39 +00:00
2020-09-26 19:41:58 +00:00
pPlayer - > m_DefEmoteReset = pSelf - > Server ( ) - > Tick ( ) + Duration * pSelf - > Server ( ) - > TickSpeed ( ) ;
pPlayer - > m_LastEyeEmote = pSelf - > Server ( ) - > Tick ( ) ;
2011-08-27 15:11:39 +00:00
}
}
2014-01-11 12:59:20 +00:00
void CGameContext : : ConNinjaJetpack ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2014-01-11 12:59:20 +00:00
return ;
CPlayer * pPlayer = pSelf - > m_apPlayers [ pResult - > m_ClientID ] ;
2020-09-26 19:41:58 +00:00
if ( ! pPlayer )
2014-01-11 12:59:20 +00:00
return ;
2020-09-26 19:41:58 +00:00
if ( pResult - > NumArguments ( ) )
2014-01-11 12:59:20 +00:00
pPlayer - > m_NinjaJetpack = pResult - > GetInteger ( 0 ) ;
else
pPlayer - > m_NinjaJetpack = ! pPlayer - > m_NinjaJetpack ;
}
2011-09-02 22:28:56 +00:00
void CGameContext : : ConShowOthers ( IConsole : : IResult * pResult , void * pUserData )
2011-08-27 15:11:39 +00:00
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2011-12-25 13:51:04 +00:00
return ;
2011-08-27 15:11:39 +00:00
CPlayer * pPlayer = pSelf - > m_apPlayers [ pResult - > m_ClientID ] ;
2020-09-26 19:41:58 +00:00
if ( ! pPlayer )
2011-08-27 15:11:39 +00:00
return ;
2020-09-26 19:41:58 +00:00
if ( g_Config . m_SvShowOthers )
2011-08-27 15:11:39 +00:00
{
2020-09-26 19:41:58 +00:00
if ( pResult - > NumArguments ( ) )
2013-11-27 17:00:22 +00:00
pPlayer - > m_ShowOthers = pResult - > GetInteger ( 0 ) ;
2011-08-27 15:11:39 +00:00
else
2013-11-27 17:00:22 +00:00
pPlayer - > m_ShowOthers = ! pPlayer - > m_ShowOthers ;
2011-08-27 15:11:39 +00:00
}
else
2011-12-25 13:51:04 +00:00
pSelf - > Console ( ) - > Print (
2020-09-26 19:41:58 +00:00
IConsole : : OUTPUT_LEVEL_STANDARD ,
" showotherschat " ,
" Showing players from other teams is disabled " ) ;
2011-08-27 15:11:39 +00:00
}
2014-02-02 18:56:10 +00:00
void CGameContext : : ConShowAll ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2014-02-02 18:56:10 +00:00
return ;
CPlayer * pPlayer = pSelf - > m_apPlayers [ pResult - > m_ClientID ] ;
2020-09-26 19:41:58 +00:00
if ( ! pPlayer )
2014-02-02 18:56:10 +00:00
return ;
2020-09-26 19:41:58 +00:00
if ( pResult - > NumArguments ( ) )
2018-04-29 13:57:57 +00:00
{
2020-09-26 19:41:58 +00:00
if ( pPlayer - > m_ShowAll = = ( bool ) pResult - > GetInteger ( 0 ) )
2018-04-29 13:57:57 +00:00
return ;
2014-02-02 18:56:10 +00:00
pPlayer - > m_ShowAll = pResult - > GetInteger ( 0 ) ;
2018-04-29 13:57:57 +00:00
}
2014-02-02 18:56:10 +00:00
else
2018-04-29 13:57:57 +00:00
{
2014-02-02 18:56:10 +00:00
pPlayer - > m_ShowAll = ! pPlayer - > m_ShowAll ;
2018-04-29 13:57:57 +00:00
}
2018-04-17 15:52:35 +00:00
2020-09-26 19:41:58 +00:00
if ( pPlayer - > m_ShowAll )
2018-04-17 17:35:25 +00:00
pSelf - > SendChatTarget ( pResult - > m_ClientID , " You will now see all tees on this server, no matter the distance " ) ;
2018-04-17 15:52:35 +00:00
else
2018-04-17 17:35:25 +00:00
pSelf - > SendChatTarget ( pResult - > m_ClientID , " You will no longer see all tees on this server " ) ;
2014-02-02 18:56:10 +00:00
}
2014-08-09 17:53:38 +00:00
void CGameContext : : ConSpecTeam ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2014-08-09 17:53:38 +00:00
return ;
CPlayer * pPlayer = pSelf - > m_apPlayers [ pResult - > m_ClientID ] ;
2020-09-26 19:41:58 +00:00
if ( ! pPlayer )
2014-08-09 17:53:38 +00:00
return ;
2020-09-26 19:41:58 +00:00
if ( pResult - > NumArguments ( ) )
2014-08-09 17:53:38 +00:00
pPlayer - > m_SpecTeam = pResult - > GetInteger ( 0 ) ;
else
pPlayer - > m_SpecTeam = ! pPlayer - > m_SpecTeam ;
}
2011-08-27 15:11:39 +00:00
bool CheckClientID ( int ClientID )
{
2020-09-26 19:41:58 +00:00
if ( ClientID < 0 | | ClientID > = MAX_CLIENTS )
2011-12-25 13:51:04 +00:00
return false ;
2011-08-27 15:11:39 +00:00
return true ;
}
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
void CGameContext : : ConSayTime ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
return ;
2014-03-22 22:29:52 +00:00
int ClientID ;
2020-11-13 23:22:21 +00:00
char aBufName [ MAX_NAME_LENGTH ] ;
2014-03-22 22:29:52 +00:00
2020-09-26 19:41:58 +00:00
if ( pResult - > NumArguments ( ) > 0 )
2014-03-22 22:29:52 +00:00
{
for ( ClientID = 0 ; ClientID < MAX_CLIENTS ; ClientID + + )
2020-09-26 19:41:58 +00:00
if ( str_comp ( pResult - > GetString ( 0 ) , pSelf - > Server ( ) - > ClientName ( ClientID ) ) = = 0 )
2014-03-22 22:29:52 +00:00
break ;
if ( ClientID = = MAX_CLIENTS )
return ;
2020-11-13 23:22:21 +00:00
str_format ( aBufName , sizeof ( aBufName ) , " %s's " , pSelf - > Server ( ) - > ClientName ( ClientID ) ) ;
2014-03-22 22:29:52 +00:00
}
else
{
2020-11-13 23:22:21 +00:00
str_copy ( aBufName , " Your " , sizeof ( aBufName ) ) ;
2014-03-22 22:29:52 +00:00
ClientID = pResult - > m_ClientID ;
}
CPlayer * pPlayer = pSelf - > m_apPlayers [ ClientID ] ;
2020-09-26 19:41:58 +00:00
if ( ! pPlayer )
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
return ;
2020-09-26 19:41:58 +00:00
CCharacter * pChr = pPlayer - > GetCharacter ( ) ;
if ( ! pChr )
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
return ;
2011-12-29 12:35:14 +00:00
if ( pChr - > m_DDRaceState ! = DDRACE_STARTED )
return ;
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
2020-11-13 23:22:21 +00:00
char aBufTime [ 32 ] ;
char aBuf [ 64 ] ;
int64 Time = ( int64 ) 100 * ( float ) ( pSelf - > Server ( ) - > Tick ( ) - pChr - > m_StartTime ) / ( ( float ) pSelf - > Server ( ) - > TickSpeed ( ) ) ;
str_time ( Time , TIME_HOURS , aBufTime , sizeof ( aBufTime ) ) ;
str_format ( aBuf , sizeof ( aBuf ) , " %s current race time is %s " , aBufName , aBufTime ) ;
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " time " , aBuf ) ;
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
}
void CGameContext : : ConSayTimeAll ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
return ;
CPlayer * pPlayer = pSelf - > m_apPlayers [ pResult - > m_ClientID ] ;
2020-09-26 19:41:58 +00:00
if ( ! pPlayer )
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
return ;
2020-09-26 19:41:58 +00:00
CCharacter * pChr = pPlayer - > GetCharacter ( ) ;
if ( ! pChr )
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
return ;
2011-12-29 12:35:14 +00:00
if ( pChr - > m_DDRaceState ! = DDRACE_STARTED )
return ;
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
2020-11-13 23:22:21 +00:00
char aBufTime [ 32 ] ;
char aBuf [ 64 ] ;
int64 Time = ( int64 ) 100 * ( float ) ( pSelf - > Server ( ) - > Tick ( ) - pChr - > m_StartTime ) / ( ( float ) pSelf - > Server ( ) - > TickSpeed ( ) ) ;
const char * pName = pSelf - > Server ( ) - > ClientName ( pResult - > m_ClientID ) ;
str_time ( Time , TIME_HOURS , aBufTime , sizeof ( aBufTime ) ) ;
str_format ( aBuf , sizeof ( aBuf ) , " %s \' s current race time is %s " , pName , aBufTime ) ;
pSelf - > SendChat ( - 1 , CGameContext : : CHAT_ALL , aBuf , pResult - > m_ClientID ) ;
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
}
void CGameContext : : ConTime ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
return ;
CPlayer * pPlayer = pSelf - > m_apPlayers [ pResult - > m_ClientID ] ;
2020-09-26 19:41:58 +00:00
if ( ! pPlayer )
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
return ;
2020-09-26 19:41:58 +00:00
CCharacter * pChr = pPlayer - > GetCharacter ( ) ;
if ( ! pChr )
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
return ;
2020-11-13 23:22:21 +00:00
char aBufTime [ 32 ] ;
char aBuf [ 64 ] ;
int64 Time = ( int64 ) 100 * ( float ) ( pSelf - > Server ( ) - > Tick ( ) - pChr - > m_StartTime ) / ( ( float ) pSelf - > Server ( ) - > TickSpeed ( ) ) ;
str_time ( Time , TIME_HOURS , aBufTime , sizeof ( aBufTime ) ) ;
str_format ( aBuf , sizeof ( aBuf ) , " Your time is %s " , aBufTime ) ;
pSelf - > SendBroadcast ( aBuf , pResult - > m_ClientID ) ;
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
}
2020-06-21 14:13:58 +00:00
static const char s_aaMsg [ 4 ] [ 128 ] = { " game/round timer. " , " broadcast. " , " both game/round timer and broadcast. " , " racetime. " } ;
2017-03-15 11:20:40 +00:00
2012-02-14 18:25:34 +00:00
void CGameContext : : ConSetTimerType ( IConsole : : IResult * pResult , void * pUserData )
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
2012-02-14 18:25:34 +00:00
2020-09-26 19:41:58 +00:00
if ( ! CheckClientID ( pResult - > m_ClientID ) )
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
return ;
CPlayer * pPlayer = pSelf - > m_apPlayers [ pResult - > m_ClientID ] ;
2020-09-26 19:41:58 +00:00
if ( ! pPlayer )
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
return ;
2012-02-14 18:25:34 +00:00
2017-03-15 11:20:40 +00:00
char aBuf [ 128 ] ;
2017-04-24 12:05:09 +00:00
2017-03-15 10:11:01 +00:00
if ( pResult - > NumArguments ( ) > 0 )
2017-01-04 13:14:10 +00:00
{
2017-03-15 10:11:01 +00:00
int OldType = pPlayer - > m_TimerType ;
2020-06-21 14:13:58 +00:00
bool Result = false ;
2017-04-24 12:05:09 +00:00
2020-06-21 14:13:58 +00:00
if ( str_comp_nocase ( pResult - > GetString ( 0 ) , " default " ) = = 0 )
Result = pPlayer - > SetTimerType ( CPlayer : : TIMERTYPE_DEFAULT ) ;
else if ( str_comp_nocase ( pResult - > GetString ( 0 ) , " gametimer " ) = = 0 )
Result = pPlayer - > SetTimerType ( CPlayer : : TIMERTYPE_GAMETIMER ) ;
2017-03-15 10:11:01 +00:00
else if ( str_comp_nocase ( pResult - > GetString ( 0 ) , " broadcast " ) = = 0 )
2020-06-21 14:13:58 +00:00
Result = pPlayer - > SetTimerType ( CPlayer : : TIMERTYPE_BROADCAST ) ;
2017-03-15 10:11:01 +00:00
else if ( str_comp_nocase ( pResult - > GetString ( 0 ) , " both " ) = = 0 )
2020-06-21 14:13:58 +00:00
Result = pPlayer - > SetTimerType ( CPlayer : : TIMERTYPE_GAMETIMER_AND_BROADCAST ) ;
2017-03-15 10:11:01 +00:00
else if ( str_comp_nocase ( pResult - > GetString ( 0 ) , " none " ) = = 0 )
2020-06-21 14:13:58 +00:00
Result = pPlayer - > SetTimerType ( CPlayer : : TIMERTYPE_NONE ) ;
else
2017-03-15 10:11:01 +00:00
{
2020-06-21 14:13:58 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " timer " , " Unknown parameter. Accepted values: default, gametimer, broadcast, both, none " ) ;
return ;
2017-01-04 13:14:10 +00:00
}
2020-06-21 14:13:58 +00:00
if ( ! Result )
2017-03-15 11:20:40 +00:00
{
2020-06-21 14:13:58 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " timer " , " Selected timertype is not supported by your client " ) ;
2017-03-15 11:20:40 +00:00
return ;
}
2017-04-24 12:05:09 +00:00
2017-03-15 10:11:01 +00:00
if ( ( OldType = = CPlayer : : TIMERTYPE_BROADCAST | | OldType = = CPlayer : : TIMERTYPE_GAMETIMER_AND_BROADCAST ) & & ( pPlayer - > m_TimerType = = CPlayer : : TIMERTYPE_GAMETIMER | | pPlayer - > m_TimerType = = CPlayer : : TIMERTYPE_NONE ) )
pSelf - > SendBroadcast ( " " , pResult - > m_ClientID ) ;
2012-02-14 20:38:06 +00:00
}
2017-04-24 12:05:09 +00:00
2020-06-21 14:13:58 +00:00
if ( pPlayer - > m_TimerType < = CPlayer : : TIMERTYPE_SIXUP & & pPlayer - > m_TimerType > = CPlayer : : TIMERTYPE_GAMETIMER )
2017-03-15 11:20:40 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " Timer is displayed in %s " , s_aaMsg [ pPlayer - > m_TimerType ] ) ;
2017-03-15 10:11:01 +00:00
else if ( pPlayer - > m_TimerType = = CPlayer : : TIMERTYPE_NONE )
str_format ( aBuf , sizeof ( aBuf ) , " Timer isn't displayed. " ) ;
2017-04-24 12:05:09 +00:00
2017-02-27 22:10:19 +00:00
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " timer " , aBuf ) ;
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
}
2015-04-16 15:28:03 +00:00
void CGameContext : : ConRescue ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2015-04-16 15:28:03 +00:00
return ;
CPlayer * pPlayer = pSelf - > m_apPlayers [ pResult - > m_ClientID ] ;
2020-09-26 19:41:58 +00:00
if ( ! pPlayer )
2015-04-16 15:28:03 +00:00
return ;
2020-09-26 19:41:58 +00:00
CCharacter * pChr = pPlayer - > GetCharacter ( ) ;
if ( ! pChr )
2015-04-16 15:28:03 +00:00
return ;
2020-09-26 19:41:58 +00:00
CGameTeams & Teams = ( ( CGameControllerDDRace * ) pSelf - > m_pController ) - > m_Teams ;
2020-05-22 21:59:47 +00:00
int Team = Teams . m_Core . Team ( pResult - > m_ClientID ) ;
2020-09-26 19:41:58 +00:00
if ( ! g_Config . m_SvRescue & & ! Teams . IsPractice ( Team ) )
{
2020-05-22 21:59:47 +00:00
pSelf - > SendChatTarget ( pPlayer - > GetCID ( ) , " Rescue is not enabled on this server and you're not in a team with /practice turned on. Note that you can't earn a rank with practice enabled. " ) ;
2015-04-16 15:28:03 +00:00
return ;
}
pChr - > Rescue ( ) ;
}
void CGameContext : : ConProtectedKill ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2014-08-24 21:24:33 +00:00
return ;
CPlayer * pPlayer = pSelf - > m_apPlayers [ pResult - > m_ClientID ] ;
2020-09-26 19:41:58 +00:00
if ( ! pPlayer )
2014-08-24 21:24:33 +00:00
return ;
2020-09-26 19:41:58 +00:00
CCharacter * pChr = pPlayer - > GetCharacter ( ) ;
if ( ! pChr )
2014-08-24 21:24:33 +00:00
return ;
2012-02-14 20:38:06 +00:00
2014-08-24 22:18:51 +00:00
int CurrTime = ( pSelf - > Server ( ) - > Tick ( ) - pChr - > m_StartTime ) / pSelf - > Server ( ) - > TickSpeed ( ) ;
if ( g_Config . m_SvKillProtection ! = 0 & & CurrTime > = ( 60 * g_Config . m_SvKillProtection ) & & pChr - > m_DDRaceState = = DDRACE_STARTED )
2014-08-24 21:24:33 +00:00
{
2020-09-26 19:41:58 +00:00
pPlayer - > KillCharacter ( WEAPON_SELF ) ;
2014-08-24 21:24:33 +00:00
}
}
2018-01-21 00:32:55 +00:00
2013-07-21 02:52:23 +00:00
void CGameContext : : ConPoints ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2013-07-21 02:52:23 +00:00
return ;
2020-09-26 19:41:58 +00:00
if ( pResult - > NumArguments ( ) > 0 )
2020-06-24 21:14:09 +00:00
{
2020-09-26 19:41:58 +00:00
if ( ! g_Config . m_SvHideScore )
2020-05-28 15:48:34 +00:00
pSelf - > Score ( ) - > ShowPoints ( pResult - > m_ClientID , pResult - > GetString ( 0 ) ) ;
2013-07-21 02:52:23 +00:00
else
pSelf - > Console ( ) - > Print (
2020-09-26 19:41:58 +00:00
IConsole : : OUTPUT_LEVEL_STANDARD ,
" points " ,
" Showing the global points of other players is not allowed on this server. " ) ;
2020-06-24 21:14:09 +00:00
}
2013-07-21 02:52:23 +00:00
else
pSelf - > Score ( ) - > ShowPoints ( pResult - > m_ClientID ,
2020-09-26 19:41:58 +00:00
pSelf - > Server ( ) - > ClientName ( pResult - > m_ClientID ) ) ;
2019-03-29 13:39:45 +00:00
}
2013-07-21 02:52:23 +00:00
void CGameContext : : ConTopPoints ( IConsole : : IResult * pResult , void * pUserData )
{
2020-09-26 19:41:58 +00:00
CGameContext * pSelf = ( CGameContext * ) pUserData ;
if ( ! CheckClientID ( pResult - > m_ClientID ) )
2013-07-21 02:52:23 +00:00
return ;
2020-09-26 19:41:58 +00:00
if ( g_Config . m_SvHideScore )
2013-07-21 02:52:23 +00:00
{
pSelf - > Console ( ) - > Print ( IConsole : : OUTPUT_LEVEL_STANDARD , " toppoints " ,
2020-09-26 19:41:58 +00:00
" Showing the global top points is not allowed on this server. " ) ;
2013-07-21 02:52:23 +00:00
return ;
}
2020-09-26 19:41:58 +00:00
if ( pResult - > NumArguments ( ) > 0 )
2020-05-29 14:50:01 +00:00
pSelf - > Score ( ) - > ShowTopPoints ( pResult - > m_ClientID , pResult - > GetInteger ( 0 ) ) ;
2013-07-21 02:52:23 +00:00
else
2020-05-29 14:50:01 +00:00
pSelf - > Score ( ) - > ShowTopPoints ( pResult - > m_ClientID ) ;
2019-03-29 13:39:45 +00:00
}