本文整理汇总了C++中IPlayer::kick方法的典型用法代码示例。如果您正苦于以下问题:C++ IPlayer::kick方法的具体用法?C++ IPlayer::kick怎么用?C++ IPlayer::kick使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPlayer
的用法示例。
在下文中一共展示了IPlayer::kick方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onCommand
bool CWarmodus::onCommand() {
const char *strArg0 = m_pEngine->argv(1);
if( strcmp(strArg0, "warmodus") )
return false;
if( m_pEngine->argc() == 2 ) {
const char *strText = CStr::format("Warmodus is %s\n", (isEnabled())?"enabled":"disabled");
printf("%s", strText);
return true;
}
const char *strArg2 = m_pEngine->argv(2); // subcmd
if( !strcmp(strArg2, "3rr") ) {
m_c3rr = 3;
return true;
}
const char *strArg3 = m_pEngine->argv(3); // reason
// kick all cts
if( !strcmp(strArg2, "kickcts") ) {
int iMax = m_pPlayerManager->getMaxClients();
for( int i = 1; i <= iMax; i++ ) {
IPlayer *pPlayer = m_pPlayerManager->getPlayer(i);
if( pPlayer != NULL && pPlayer->getTeam() == team_ct ) {
if( strArg3 != NULL && strArg3 != 0 )
pPlayer->kick(strArg3);
else
pPlayer->kick("");
}
}
}
// kick all ts
else if( !strcmp(strArg2, "kickts") ) {
int iMax = m_pPlayerManager->getMaxClients();
for( int i = 1; i <= iMax; i++ ) {
IPlayer *pPlayer = m_pPlayerManager->getPlayer(i);
if( pPlayer != NULL && pPlayer->getTeam() == team_t ) {
if( strArg3 != NULL && strArg3 != 0 )
pPlayer->kick(strArg3);
else
pPlayer->kick("");
}
}
}
// kick alls specs
else if( !strcmp(strArg2, "kickspecs") ) {
int iMax = m_pPlayerManager->getMaxClients();
for( int i = 1; i <= iMax; i++ ) {
IPlayer *pPlayer = m_pPlayerManager->getPlayer(i);
if( pPlayer != NULL && pPlayer->getTeam() == team_spectator ) {
if( strArg3 != NULL && strArg3 != 0 )
pPlayer->kick(strArg3);
else
pPlayer->kick("");
}
}
}
else if( !strcmp(strArg2, "status") ) {
printf("====================================\n");
// normal rcon status
m_pEngine->status();
printf("\n\n");
// sbguardian status
IModule **pModule = m_pModule;
while( pModule != NULL && *pModule != NULL ) {
printf("%s: %s\n", pModule[0]->getName(), (pModule[0]->isEnabled())?"enabled":"disabled");
pModule++;
}
printf("====================================\n");
}
else if( m_pEngine->argc() == 3 ) {
setEnabled(atoi(m_pEngine->argv(2)));
return true;
}
return true;
}