本文整理汇总了C++中ClientPrint函数的典型用法代码示例。如果您正苦于以下问题:C++ ClientPrint函数的具体用法?C++ ClientPrint怎么用?C++ ClientPrint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ClientPrint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
bool CBaseMultiplayerPlayer::ClientCommand( const CCommand &args )
{
const char *pcmd = args[0];
if ( FStrEq( pcmd, "ignoremsg" ) )
{
m_iIgnoreGlobalChat = (m_iIgnoreGlobalChat + 1) % 3;
switch( m_iIgnoreGlobalChat )
{
case CHAT_IGNORE_NONE:
ClientPrint( this, HUD_PRINTTALK, "#Accept_All_Messages" );
break;
case CHAT_IGNORE_ALL:
ClientPrint( this, HUD_PRINTTALK, "#Ignore_Broadcast_Messages" );
break;
case CHAT_IGNORE_TEAM:
ClientPrint( this, HUD_PRINTTALK, "#Ignore_Broadcast_Team_Messages" );
break;
default:
break;
}
return true;
}
return BaseClass::ClientCommand( args );
}
示例2: Command_SmoothWalk
void Command_SmoothWalk(char **Arg, int ArgCount)
{
GetIRWProfileInt(NULL, "Smooth", "SmoothWalk", &SmoothWalk);
if(ArgCount == 1)
SmoothWalk = SmoothWalk ? FALSE : TRUE;
if(ArgCount >= 2)
{
if(!strcmp(Arg[1], "on"))
SmoothWalk = TRUE;
else if(!strcmp(Arg[1], "off"))
SmoothWalk = FALSE;
else
{
ClientPrint("Usage: smoothwalk on/off");
return;
}
}
SetIRWProfileInt(NULL, "Smooth", "SmoothWalk", SmoothWalk);
ClientPrint("SmoothWalk is now: %s", SmoothWalk == TRUE ? "on" : "off");
return;
}
示例3: ClientPrint
//-----------------------------------------------------------------------------
// Purpose: Round timelimit has been hit
//-----------------------------------------------------------------------------
void CDiscArena::TimeOver( void )
{
// Display the 10 second warning first
if ( !m_bShownTimeWarning )
{
m_bShownTimeWarning = TRUE;
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
CBasePlayer *pPlayer = (CBasePlayer *)UTIL_PlayerByIndex( i );
if (pPlayer && (pPlayer->pev->groupinfo & pev->groupinfo) && pPlayer->m_bHasDisconnected != TRUE)
ClientPrint( pPlayer->pev, HUD_PRINTCENTER, "#Time_Warning" );
}
pev->nextthink = gpGlobals->time + 10;
}
else
{
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
CBasePlayer *pPlayer = (CBasePlayer *)UTIL_PlayerByIndex( i );
if (pPlayer && (pPlayer->pev->groupinfo & pev->groupinfo) && (pPlayer->m_bHasDisconnected != TRUE) )
ClientPrint( pPlayer->pev, HUD_PRINTCENTER, "#Time_Over" );
}
// Increment both scores to force the game to end
m_iTeamOneScore++;
m_iTeamTwoScore++;
BattleOver();
}
}
示例4: ClientPrint
// For CTs to defuse the c4
void CPlantedC4::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
CCSPlayer *player = dynamic_cast< CCSPlayer* >( pActivator );
if ( !player || player->GetTeamNumber() != TEAM_CT)
return;
if ( m_bStartDefuse )
{
m_fNextDefuse = gpGlobals->curtime + 0.5;
}
else
{
// freeze the player in place while diffusing
player->SetMaxSpeed( 1 );
// tell the bots someone has started defusing
//g_pBotControl->OnEvent( EVENT_BOMB_DEFUSING, pActivator );
int defuseTime;
if ( player->HasDefuser() )
{
// Log this information
//UTIL_LogPrintf("\"%s<%i><%s><CT>\" triggered \"Begin_Bomb_Defuse_With_Kit\"\n",
// STRING( player->pev->netname ),
// GETPLAYERUSERID( player->edict() ),
// GETPLAYERAUTHID( player->edict() ) );
ClientPrint( player, HUD_PRINTCENTER, "#Defusing_Bomb_With_Defuse_Kit" );
defuseTime = 5;
}
else
{
// Log this information
//UTIL_LogPrintf("\"%s<%i><%s><CT>\" triggered \"Begin_Bomb_Defuse_Without_Kit\"\n",
// STRING( player->pev->netname ),
// GETPLAYERUSERID( player->edict() ),
// GETPLAYERAUTHID( player->edict() ) );
ClientPrint( player, HUD_PRINTCENTER, "#Defusing_Bomb_Without_Defuse_Kit" );
defuseTime = 10;
}
CPASAttenuationFilter filter( player );
EmitSound( filter, entindex(), "c4.disarm" );
m_fNextDefuse = gpGlobals->curtime + 0.5;
m_pBombDefuser = player;
m_bStartDefuse = TRUE;
player->m_bIsDefusing = true;
m_flDefuseCountDown = gpGlobals->curtime + defuseTime;
//start the progress bar
player->SetProgressBarTime( defuseTime );
}
}
示例5: if
// Attempt to change the observer mode
void CBasePlayer::Observer_SetMode( int iMode )
{
// Just abort if we're changing to the mode we're already in
if ( iMode == pev->iuser1 )
return;
// is valid mode ?
if ( iMode < OBS_CHASE_LOCKED || iMode > OBS_MAP_CHASE )
iMode = OBS_IN_EYE; // now it is
// verify observer target again
if ( m_hObserverTarget != NULL)
{
CBaseEntity *pEnt = m_hObserverTarget;
if ( (pEnt == this) || (pEnt == NULL) )
m_hObserverTarget = NULL;
else if ( ((CBasePlayer*)pEnt)->IsObserver() || (pEnt->pev->effects & EF_NODRAW) )
m_hObserverTarget = NULL;
}
// set spectator mode
pev->iuser1 = iMode;
// if we are not roaming, we need a valid target to track
if ( (iMode != OBS_ROAMING) && (m_hObserverTarget == NULL) )
{
Observer_FindNextPlayer( false );
// if we didn't find a valid target switch to roaming
if (m_hObserverTarget == NULL)
{
ClientPrint( pev, HUD_PRINTCENTER, "#Spec_NoTarget" );
pev->iuser1 = OBS_ROAMING;
}
}
// set target if not roaming
if (pev->iuser1 == OBS_ROAMING)
{
pev->iuser2 = 0;
}
else
pev->iuser2 = ENTINDEX( m_hObserverTarget->edict() );
pev->iuser3 = 0; // clear second target from death cam
// print spepctaor mode on client screen
char modemsg[16];
sprintf(modemsg,"#Spec_Mode%i", pev->iuser1 );
ClientPrint( pev, HUD_PRINTCENTER, modemsg );
m_iObserverLastMode = iMode;
}
示例6: IRWCmd_JournalDump
void IRWCmd_JournalDump(char **Arg, int ArgCount)
{
if(ArgCount < 2)
{
ClientPrint("Usage: journaldump [filename]");
return;
}
JournalDump(Arg[1]);
ClientPrint("Dumped to your IRW directory");
return;
}
示例7: ToHL2MPPlayer
int DotaObjective::OnTakeDamage( const CTakeDamageInfo &inputInfo )
{
if ( m_bMet )
return 0;
if ( !(inputInfo.GetDamageType() & DMG_BULLET) )
{
CHL2MP_Player * playerAttacker = ToHL2MPPlayer( inputInfo.GetAttacker() );
CreepMaker * maker = (CreepMaker*)gEntList.FindEntityByName( NULL, m_creepMakerName );
if ( !maker )
AssertMsg( false, "Objective can't find its creepmaker!\n" );
CAI_BaseNPC * guardian = (CAI_BaseNPC*)gEntList.FindEntityByName( NULL, m_guardianName );
if( guardian && guardian->IsAlive() )
{
if( playerAttacker )
ClientPrint( playerAttacker, HUD_PRINTTALK, UTIL_VarArgs("The guradian is alive in this lane, you can't hurt the gate.\n") );
}
else
{
m_timesHit++;
m_timesHit = min(m_timesHit, OBJECTIVE_HEALTHI); // make sure times hit never goes above the maximum times an objective can be hit!
CRecipientFilter user;
user.AddRecipientsByTeam( this->GetTeam() );
user.MakeReliable();
char szText[200];
Q_snprintf( szText, sizeof(szText), "Your ally gate is under attack from an enemy!" );
UTIL_ClientPrintFilter( user, HUD_PRINTCENTER, szText );
if( playerAttacker )
ClientPrint( playerAttacker, HUD_PRINTTALK, UTIL_VarArgs("Gate has %i health left.\n", OBJECTIVE_HEALTHI - m_timesHit) );
if (m_timesHit >= OBJECTIVE_HEALTHI)
{
TakeAction(DOBJ_ACTION_CLOSE);
} else {
IGameEvent *pEvent = gameeventmanager->CreateEvent( "objectivegate_attacked" );
if ( pEvent )
{
pEvent->SetString( "lane", GetLane() );
pEvent->SetInt( "team", this->GetTeamNumber() );
pEvent->SetFloat( "health", (OBJECTIVE_HEALTHF - m_timesHit)/OBJECTIVE_HEALTHF );
gameeventmanager->FireEvent( pEvent );
}
}
}
}
return 0;
}
示例8: Target_Info
void Target_Info(unsigned int Serial, unsigned short X, unsigned short Y, int Z)
{
GameObject Obj;
if(Serial == INVALID_SERIAL)
{
ClientPrint("Invalid target");
return;
}
if(GetObjectInfo(Serial, INVALID_IDX, &Obj) == OBJECT_NOTFOUND)
{
ClientPrint("Object not in the world list");
return;
}
ClientPrint("Serial 0x%08X", Obj.Serial);
ClientPrint("Graphic: 0x%04X Color: 0x%04X", Obj.Graphic, Obj.Color);
ClientPrint("Container: 0x%08X Quantity: %d", Obj.Container, Obj.Quantity);
/* if the object wasn't a character, GetObjectInfo frees the pointer */
if(Obj.Character == NULL) return;
/* if it's a character display the info */
ClientPrint("Name %s", Obj.Character->Name);
ClientPrint("HP: %d MaxHP: %d", Obj.Character->HitPoints, Obj.Character->MaxHitPoints);
ClientPrint("Current HP: %d%%", (Obj.Character->HitPoints*100)/Obj.Character->MaxHitPoints);
FREECHAR(Obj);
return;
}
示例9: GetClassPtr
void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
if (!m_bIsC4)
return;
CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)pActivator->pev);
if (pPlayer->m_iTeam != TEAM_CT)
return;
if (m_bStartDefuse)
{
m_fNextDefuse = gpGlobals->time + 0.5;
return;
}
g_engfuncs.pfnSetClientMaxspeed(pPlayer->edict(), 1);
if (g_pGameRules->IsCareer())
{
}
if (pPlayer->m_bHasDefuser == true)
{
UTIL_LogPrintf("\"%s<%i><%s><CT>\" triggered \"Begin_Bomb_Defuse_With_Kit\"\n", STRING(pPlayer->pev->netname), GETPLAYERUSERID(pPlayer->edict()), GETPLAYERAUTHID(pPlayer->edict()));
ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Defusing_Bomb_With_Defuse_Kit");
EMIT_SOUND(ENT(pPlayer->pev), CHAN_ITEM, "weapons/c4_disarm.wav", VOL_NORM, ATTN_NORM);
pPlayer->m_bIsDefusing = true;
m_pBombDefuser = pCaller;
m_bStartDefuse = true;
m_flDefuseCountDown = gpGlobals->time + 5;
m_fNextDefuse = gpGlobals->time + 0.5;
pPlayer->SetProgressBarTime(5);
}
else
{
UTIL_LogPrintf("\"%s<%i><%s><CT>\" triggered \"Begin_Bomb_Defuse_Without_Kit\"\n", STRING(pPlayer->pev->netname), GETPLAYERUSERID(pPlayer->edict()), GETPLAYERAUTHID(pPlayer->edict()));
ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Defusing_Bomb_Without_Defuse_Kit");
EMIT_SOUND(ENT(pPlayer->pev), CHAN_ITEM, "weapons/c4_disarm.wav", VOL_NORM, ATTN_NORM);
pPlayer->m_bIsDefusing = true;
m_pBombDefuser = pCaller;
m_bStartDefuse = true;
m_flDefuseCountDown = gpGlobals->time + 10;
m_fNextDefuse = gpGlobals->time + 0.5;
pPlayer->SetProgressBarTime(10);
}
}
示例10: ClientPrint
void CFamas::SecondaryAttack()
{
if( FBitSet( m_fWeaponState, WEAPONSTATE_FAMAS_BURST_MODE ) )
{
ClientPrint( m_pPlayer->pev, HUD_PRINTCENTER, "#Switch_To_FullAuto" );
ClearBits( m_fWeaponState, WEAPONSTATE_FAMAS_BURST_MODE );
}
else
{
ClientPrint( m_pPlayer->pev, HUD_PRINTCENTER, "#Switch_To_BurstFire" );
SetBits( m_fWeaponState, WEAPONSTATE_FAMAS_BURST_MODE );
}
m_flNextSecondaryAttack = gpGlobals->time + 0.3;
}
示例11: ClientPrint
void CFamas::__MAKE_VHOOK(SecondaryAttack)()
{
if (m_iWeaponState & WPNSTATE_FAMAS_BURST_MODE)
{
ClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, "#Switch_To_FullAuto");
m_iWeaponState &= ~WPNSTATE_FAMAS_BURST_MODE;
}
else
{
ClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, "#Switch_To_BurstFire");
m_iWeaponState |= WPNSTATE_FAMAS_BURST_MODE;
}
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3f;
}
示例12: IRWCmd_IsInJournal
void IRWCmd_IsInJournal(char **Arg, int ArgCount)
{
if(ArgCount < 2)
{
ClientPrint("Usage: isinjournal text");
return;
}
if(IsInJournal(Arg[1], JOURNAL_ANY) != -1)
ClientPrint("Oh.. yes. It is in journal.. so what?");
else
ClientPrint("Sorry its not in journal ;(");
return;
}
示例13: ParaEnable
void ParaEnable( edict_t *pEntity )
{
if (ChuteState[ ENTINDEX( pEntity ) ] != 1) {
ClientPrint( VARS(pEntity), HUD_PRINTTALK, "* You don't have a parachute! Go pick one up!\n");
return;
}
// cant use the parachute when you are on the ground
if (pEntity->v.flags & FL_ONGROUND) {
ClientPrint( VARS(pEntity), HUD_PRINTTALK, "* Parachutes only work in the air!\n");
return;
}
// turns on the parachute
ChuteState[ ENTINDEX( pEntity ) ] = 2;
entvars_t *pev = VARS( pEntity );
// set initial vars
pev->gravity = 0.1;
pev->speed = 0;
pev->velocity = g_vecZero;
// give them the parachute model
int i = 1;
edict_t *frontEnt;
entvars_t *pModelPev;
int mdlfound = 0;
for (i; i < 1025; i++) {
frontEnt = INDEXENT ( i );
if (frontEnt) {
pModelPev = VARS(frontEnt);
if (FStrEq((char *)STRING(pModelPev->netname), "para")) {
// Touch this ent.
(*other_gFunctionTable.pfnTouch)(frontEnt, pEntity);
}
}
}
// The parachute has been given to em
// Now, we just wait for em to hit the ground then we take the chute again
}
示例14: ClientPrint
BOOL CItemThighPack::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
{
if (pPlayer->m_iTeam != CT || pPlayer->m_bHasDefuser)
return FALSE;
pPlayer->m_bHasDefuser = true;
pPlayer->pev->body = 1;
ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Got_defuser");
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, NULL, pPlayer->pev);
WRITE_BYTE(STATUSICON_SHOW);
WRITE_STRING("defuser");
WRITE_BYTE(0);
WRITE_BYTE(160);
WRITE_BYTE(0);
MESSAGE_END();
pPlayer->SendItemStatus();
EMIT_SOUND(pPlayer->edict(), CHAN_VOICE, "items/kevlar.wav", VOL_NORM, ATTN_NORM);
if (TheTutor != NULL)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer);
}
return TRUE;
}
示例15: Command_TileInfo
void Command_TileInfo(char **Arg, int ArgCount)
{
ClientPrint("Choose a spot on the ground");
RequestTarget(TARGET_TILE, &Target_TileInfo);
return;
}