本文整理汇总了C++中Q_CleanStr函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_CleanStr函数的具体用法?C++ Q_CleanStr怎么用?C++ Q_CleanStr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Q_CleanStr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ArenaServers_Insert
/*
=================
ArenaServers_Insert
=================
*/
static void ArenaServers_Insert( char* adrstr, char* info, int pingtime )
{
servernode_t* servernodeptr;
if ((pingtime >= ArenaServers_MaxPing()) && (g_servertype != UIAS_FAVORITES))
{
// slow global or local servers do not get entered
return;
}
if (*g_arenaservers.numservers >= g_arenaservers.maxservers) {
// list full;
servernodeptr = g_arenaservers.serverlist+(*g_arenaservers.numservers)-1;
} else {
// next slot
servernodeptr = g_arenaservers.serverlist+(*g_arenaservers.numservers);
(*g_arenaservers.numservers)++;
}
Q_strncpyz( servernodeptr->adrstr, adrstr, MAX_ADDRESSLENGTH );
Q_strncpyz( servernodeptr->hostname, Info_ValueForKey( info, "hostname"), MAX_HOSTNAMELENGTH );
Q_CleanStr( servernodeptr->hostname );
Q_strupr( servernodeptr->hostname );
Q_strncpyz( servernodeptr->mapname, Info_ValueForKey( info, "mapname"), MAX_MAPNAMELENGTH );
Q_CleanStr( servernodeptr->mapname );
servernodeptr->numclients = atoi( Info_ValueForKey( info, "clients") );
servernodeptr->humanplayers = atoi( Info_ValueForKey( info, "g_humanplayers") );
servernodeptr->maxclients = atoi( Info_ValueForKey( info, "sv_maxclients") );
servernodeptr->pingtime = pingtime;
servernodeptr->minPing = atoi( Info_ValueForKey( info, "minPing") );
servernodeptr->maxPing = atoi( Info_ValueForKey( info, "maxPing") );
/*
s = Info_ValueForKey( info, "nettype" );
for (i=0; ;i++)
{
if (!netnames[i])
{
servernodeptr->nettype = 0;
break;
}
else if (!Q_stricmp( netnames[i], s ))
{
servernodeptr->nettype = i;
break;
}
}
*/
servernodeptr->nettype = atoi(Info_ValueForKey(info, "nettype"));
if (servernodeptr->nettype < 0 || servernodeptr->nettype >= ARRAY_LEN(netnames) - 1) {
servernodeptr->nettype = 0;
}
Q_strncpyz( servernodeptr->gametypeName, Info_ValueForKey( info, "gametype"), sizeof(servernodeptr->gametypeName) );
Q_CleanStr( servernodeptr->gametypeName );
}
开发者ID:KuehnhammerTobias,项目名称:ioid3-game,代码行数:64,代码来源:ui_servers2.c
示例2: Cmd_TokenizeString
//For using chat with @@ prefix
void AdminCmds::SM_PSay(const char* msg, int source)
{
int i;
char message[1024];
char cleannames[128];
char cleannamed[128];
Cmd_TokenizeString(msg);
if(Cmd_Argc() < 2)
{
Plugin_ChatPrintf(source, "Usage: @@player message");
return;
}
client_t* cl = Plugin_SV_Cmd_GetPlayerClByHandle(Cmd_Argv(0));
if(cl == NULL)
{
Plugin_ChatPrintf(source, "No player for %s found", Cmd_Argv(0));
return;
}
if(cl->state < CS_ACTIVE)
{
Plugin_ChatPrintf(source, "Player %s is not in active", cl->name);
return;
}
message[0] = '\0';
for(i = 1; i < Cmd_Argc(); ++i)
{
Q_strcat(message, sizeof(message), Cmd_Argv(i));
Q_strcat(message, sizeof(message), " ");
}
int destination = NUMFORCLIENT(cl);
if(source == destination)
{
Plugin_ChatPrintf(source, "Why would you send a message to yourself?");
return;
}
Q_strncpyz(cleannames, Plugin_GetPlayerName(source), sizeof(cleannames));
Q_strncpyz(cleannamed, cl->name, sizeof(cleannamed));
Q_CleanStr(cleannames);
Q_CleanStr(cleannamed);
Plugin_ChatPrintf(source, "^7%s ^1>> ^7%s: %s", cleannames, cleannamed, message);
Plugin_ChatPrintf(destination, "^7%s ^1>> ^7%s: %s", cleannames, cleannamed, message);
}
开发者ID:D4edalus,项目名称:CoD4x_Server,代码行数:53,代码来源:main.cpp
示例3: trap_Print
/*} else if( !Q_stricmp( token.string, "objectives" ) ) {
if( !PC_String_Parse( handle, &uiInfo.mapList[uiInfo.mapCount].objectives ) ) {
trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
trap_PC_FreeSource( handle );
return;
}*/
} else if( !Q_stricmp( token.string, "timelimit" ) ) {
if( !PC_Int_Parse( handle, &uiInfo.mapList[uiInfo.mapCount].Timelimit ) ) {
trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
trap_PC_FreeSource( handle );
return;
}
} else if( !Q_stricmp( token.string, "axisrespawntime" ) ) {
if( !PC_Int_Parse( handle, &uiInfo.mapList[uiInfo.mapCount].AxisRespawnTime ) ) {
trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
trap_PC_FreeSource( handle );
return;
}
} else if( !Q_stricmp( token.string, "alliedrespawntime" ) ) {
if( !PC_Int_Parse( handle, &uiInfo.mapList[uiInfo.mapCount].AlliedRespawnTime ) ) {
trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
trap_PC_FreeSource( handle );
return;
}
} else if( !Q_stricmp( token.string, "type" ) ) {
if( !trap_PC_ReadToken( handle, &token ) ) {
trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
trap_PC_FreeSource( handle );
return;
} else {
if( strstr( token.string, "wolfsp" ) ) {
uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_SINGLE_PLAYER);
}
if( strstr( token.string, "wolflms" ) ) {
uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_WOLF_LMS);
}
if( strstr( token.string, "wolfmp" ) ) {
uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_WOLF);
}
if( strstr( token.string, "wolfsw" ) ) {
uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_WOLF_STOPWATCH);
}
}
} else if( !Q_stricmp( token.string, "mapposition_x" ) ) {
if( !PC_Float_Parse( handle, &uiInfo.mapList[uiInfo.mapCount].mappos[0] ) ) {
trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
trap_PC_FreeSource( handle );
return;
}
} else if( !Q_stricmp( token.string, "mapposition_y" ) ) {
if( !PC_Float_Parse( handle, &uiInfo.mapList[uiInfo.mapCount].mappos[1] ) ) {
trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
trap_PC_FreeSource( handle );
return;
}
}
}
trap_PC_FreeSource( handle );
return;
}/* ============= UI_SortArenas CHRUKER: b090 - Sorting the map list ============= */
int QDECL UI_SortArenas( const void *a, const void *b ) {
mapInfo ca = *(mapInfo*)a;
mapInfo cb = *(mapInfo*)b;
char cleanNameA[MAX_STRING_CHARS];
char cleanNameB[MAX_STRING_CHARS];
Q_strncpyz(cleanNameA, ca.mapName, sizeof(cleanNameA));
Q_strncpyz(cleanNameB, cb.mapName, sizeof(cleanNameB));
Q_CleanStr(cleanNameA);
Q_CleanStr(cleanNameB);
return strcmp(cleanNameA, cleanNameB);
} // b090
开发者ID:leakcim1324,项目名称:ETrun,代码行数:74,代码来源:ui_gameinfo.c
示例4: UI_SortCampaigns
/* ================ UI_SortCampaigns CHRUKER: b090 - Sorting the campaign list ================ */
int QDECL UI_SortCampaigns( const void *a, const void *b ) {
char cleanNameA[MAX_STRING_CHARS];
char cleanNameB[MAX_STRING_CHARS];
campaignInfo_t ca = *(campaignInfo_t*)a;
campaignInfo_t cb = *(campaignInfo_t*)b;
Q_strncpyz(cleanNameA, ca.campaignName, sizeof(cleanNameA));
Q_strncpyz(cleanNameB, cb.campaignName, sizeof(cleanNameB));
Q_CleanStr(cleanNameA);
Q_CleanStr(cleanNameB);
return strcmp(cleanNameA, cleanNameB);
} // b090
开发者ID:leakcim1324,项目名称:ETrun,代码行数:15,代码来源:ui_gameinfo.c
示例5: atoi
/*
===================
ClientForString
===================
*/
gclient_t *ClientForString( const char *s ) {
gclient_t *cl;
int idnum;
char cleanName[MAX_STRING_CHARS];
// numeric values could be slot numbers
if ( StringIsInteger( s ) ) {
idnum = atoi( s );
if ( idnum >= 0 && idnum < level.maxclients ) {
cl = &level.clients[idnum];
if ( cl->pers.connected == CON_CONNECTED ) {
return cl;
}
}
}
// check for a name match
for ( idnum=0,cl=level.clients ; idnum < level.maxclients ; idnum++,cl++ ) {
if ( cl->pers.connected != CON_CONNECTED ) {
continue;
}
Q_strncpyz(cleanName, cl->pers.netname, sizeof(cleanName));
Q_CleanStr(cleanName);
if ( !Q_stricmp( cleanName, s ) ) {
return cl;
}
}
G_Printf( "User %s is not on the server\n", s );
return NULL;
}
开发者ID:iMp-Rex,项目名称:OpenJK,代码行数:36,代码来源:g_svcmds.c
示例6: UI_SPPostgameMenu_MenuDrawScoreLine
/*
=================
UI_SPPostgameMenu_MenuDrawScoreLine
=================
*/
static void UI_SPPostgameMenu_MenuDrawScoreLine( int n, int y )
{
int rank;
char name[64];
char info[MAX_INFO_STRING];
if( n > (postgameMenuInfo.numClients + 1) )
{
n -= (postgameMenuInfo.numClients + 2);
}
if( n >= postgameMenuInfo.numClients )
{
return;
}
rank = postgameMenuInfo.ranks[n];
if( rank & RANK_TIED_FLAG )
{
UI_DrawString( 640 - 31 * SMALLCHAR_WIDTH, y, "(tie)", UI_LEFT|UI_SMALLFONT, color_white );
rank &= ~RANK_TIED_FLAG;
}
GetConfigString( CS_PLAYERS + postgameMenuInfo.clientNums[n], info, MAX_INFO_STRING );
Q_strncpyz( name, Info_ValueForKey( info, "n" ), sizeof(name) );
Q_CleanStr( name );
UI_DrawString( 640 - 25 * SMALLCHAR_WIDTH, y, va( "#%i: %-16s %2i", rank + 1, name, postgameMenuInfo.scores[n] ), UI_LEFT|UI_SMALLFONT, color_white );
}
开发者ID:zturtleman,项目名称:recoil,代码行数:33,代码来源:ui_sppostgame.c
示例7: G_RemoveRandomBot
/*
===============
G_RemoveRandomBot
===============
*/
int G_RemoveRandomBot(int team)
{
int i;
char netname[36];
gclient_t *cl;
for (i = 0 ; i < g_maxclients.integer ; i++)
{
cl = level.clients + i;
if (cl->pers.connected != CON_CONNECTED)
{
continue;
}
if (!(g_entities[cl->ps.clientNum].r.svFlags & SVF_BOT))
{
continue;
}
if (team >= 0 && cl->sess.sessionTeam != team)
{
continue;
}
strcpy(netname, cl->pers.netname);
Q_CleanStr(netname);
trap_SendConsoleCommand(EXEC_INSERT, va("kick \"%s\" 0\n", netname));
return qtrue;
}
return qfalse;
}
开发者ID:morsik,项目名称:war-territory,代码行数:33,代码来源:g_bot.c
示例8: Con_DrawInput
/*
================
Con_DrawInput
Draw the editline after a ] prompt
================
*/
void Con_DrawInput( void )
{
int y;
char prompt[ MAX_STRING_CHARS ];
vec4_t color;
qtime_t realtime;
if ( cls.state != CA_DISCONNECTED && !( cls.keyCatchers & KEYCATCH_CONSOLE ) )
{
return;
}
Com_RealTime( &realtime );
y = con.vislines - ( SCR_ConsoleFontCharHeight() * 2 ) + 2;
Com_sprintf( prompt, sizeof( prompt ), "^0[^3%02d%c%02d^0]^7 %s", realtime.tm_hour, ( realtime.tm_sec & 1 ) ? ':' : ' ', realtime.tm_min, cl_consolePrompt->string );
color[ 0 ] = 1.0f;
color[ 1 ] = 1.0f;
color[ 2 ] = 1.0f;
color[ 3 ] = ( scr_conUseOld->integer ? 1.0f : con.displayFrac * 2.0f );
SCR_DrawSmallStringExt( con.xadjust + cl_conXOffset->integer, y + 10, prompt, color, qfalse, qfalse );
Q_CleanStr( prompt );
Field_Draw( &g_consoleField, con.xadjust + cl_conXOffset->integer + SCR_ConsoleFontStringWidth( prompt, strlen( prompt ) ), y + 10, qtrue, qtrue, color[ 3 ] );
}
开发者ID:Sixthly,项目名称:Unvanquished,代码行数:35,代码来源:cl_console.c
示例9: G_Printf
/*
==================
G_GetPlayerByName
==================
*/
gclient_t *G_GetPlayerByName( char *name ) {
int i;
gclient_t *cl;
char cleanName[64];
// make sure server is running
if ( !G_Is_SV_Running() ) {
return NULL;
}
if ( trap_Argc() < 2 ) {
G_Printf( "No player specified.\n" );
return NULL;
}
for (i = 0; i < level.numConnectedClients; i++) {
cl = &level.clients[i];
if (!Q_stricmp(cl->pers.netname, name)) {
return cl;
}
Q_strncpyz( cleanName, cl->pers.netname, sizeof(cleanName) );
Q_CleanStr( cleanName );
if ( !Q_stricmp( cleanName, name ) ) {
return cl;
}
}
G_Printf( "Player %s is not on the server\n", name );
return NULL;
}
开发者ID:chegestar,项目名称:omni-bot,代码行数:40,代码来源:g_svcmds.c
示例10: G_Field_CompletePlayerName
/*
===================
G_Field_CompletePlayerName
===================
*/
void G_Field_CompletePlayerName( void ) {
gplayer_t *cl;
int idnum;
char cleanName[MAX_NETNAME];
char list[MAX_CLIENTS * MAX_NETNAME];
int listTotalLength;
// ZTM: FIXME: have to clear whole list because BG_AddStringToList doesn't properly terminate list
memset( list, 0, sizeof( list ) );
listTotalLength = 0;
for ( idnum=0,cl=level.players ; idnum < level.maxplayers ; idnum++,cl++ ) {
if ( cl->pers.connected != CON_CONNECTED ) {
continue;
}
Q_strncpyz(cleanName, cl->pers.netname, sizeof(cleanName));
Q_CleanStr(cleanName);
// Use quotes if there is a space in the name
if ( strchr( cleanName, ' ' ) != NULL ) {
BG_AddStringToList( list, sizeof( list ), &listTotalLength, va( "\"%s\"", cleanName ) );
} else {
BG_AddStringToList( list, sizeof( list ), &listTotalLength, cleanName );
}
}
if ( listTotalLength > 0 ) {
list[listTotalLength++] = 0;
trap_Field_CompleteList( list );
}
}
开发者ID:zturtleman,项目名称:mint-arena,代码行数:36,代码来源:g_svcmds.c
示例11: PlayerForString
int PlayerForString( const char *s ) {
gplayer_t *cl;
int idnum;
char cleanName[MAX_NETNAME];
// numeric values could be slot numbers
if ( StringIsInteger( s ) ) {
idnum = atoi( s );
if ( idnum >= 0 && idnum < level.maxplayers ) {
cl = &level.players[idnum];
if ( cl->pers.connected == CON_CONNECTED ) {
return idnum;
}
}
}
// check for a name match
for ( idnum=0,cl=level.players ; idnum < level.maxplayers ; idnum++,cl++ ) {
if ( cl->pers.connected != CON_CONNECTED ) {
continue;
}
Q_strncpyz(cleanName, cl->pers.netname, sizeof(cleanName));
Q_CleanStr(cleanName);
if ( !Q_stricmp( cleanName, s ) ) {
return idnum;
}
}
G_Printf( "User %s is not on the server\n", s );
return -1;
}
开发者ID:zturtleman,项目名称:mint-arena,代码行数:32,代码来源:g_svcmds.c
示例12: BotMatch_WrongWall
void BotMatch_WrongWall(bot_state_t* bs, bot_match_t *match){
char netname[MAX_MESSAGE_SIZE];
char buf[MAX_INFO_STRING];
int client;
if(gametype != GT_SPRAY)
return;
// talking about me ? (avoid clientfromname, its ambiguous)
trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));
trap_GetConfigstring(CS_PLAYERS + bs->client, buf, sizeof(buf));
Q_CleanStr( buf );
if (!Q_stricmp(Info_ValueForKey(buf, "n"), netname)){
// could be someone with same name, so make (more) sure
if( ClientInSprayroom(bs->client) ){
bs->which_wall = BotChooseCorrectWall(bs);
bs->enemy = -1;
// chat
BotAI_BotInitialChat(bs, "wall_missed", NULL);
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
return;
}
}
// check if opposite team
client = ClientFromName(netname);
if(!BotSameTeam(bs, client)){
float rnd;
// flame
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_INSULT, 0, 1);
if(random() > rnd) return;
BotAI_BotInitialChat(bs, "wall_insult", netname, NULL);
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
}
开发者ID:PadWorld-Entertainment,项目名称:wop-gamesource,代码行数:34,代码来源:ai_cmd.c
示例13: atoi
gclient_t *ClientFromString(const char *str)
{
gclient_t *cl;
int idnum;
char cleanName[MAX_STRING_CHARS];
// numeric values could be slot numbers
if (Q_isanumber(str) && Q_isintegral(atof(str))) {
idnum = atoi(str);
if (idnum >= 0 && idnum < level.maxclients) {
cl = &level.clients[idnum];
if (cl->pers.connected == CON_CONNECTED) {
return cl;
}
}
}
// check for a name match
for (idnum = 0, cl = level.clients; idnum < level.maxclients; idnum++, cl++) {
if (cl->pers.connected != CON_CONNECTED) {
continue;
}
Q_strncpyz(cleanName, cl->pers.netname, sizeof cleanName);
Q_CleanStr(cleanName);
if (!Q_stricmp(cleanName, str)) {
return cl;
}
}
return NULL;
}
开发者ID:baseas,项目名称:aftershock,代码行数:31,代码来源:g_client.c
示例14: CG_LoadingClient
/*
===================
CG_LoadingClient
===================
*/
void CG_LoadingClient( int clientNum ) {
const char *info;
char *skin;
char personality[MAX_QPATH];
char model[MAX_QPATH];
char iconName[MAX_QPATH];
info = CG_ConfigString( CS_PLAYERS + clientNum );
if ( loadingPlayerIconCount < MAX_LOADING_PLAYER_ICONS ) {
Q_strncpyz( model, Info_ValueForKey( info, "model" ), sizeof( model ) );
skin = Q_strrchr( model, '/' );
if ( skin ) {
*skin++ = '\0';
} else {
skin = "default";
}
Com_sprintf( iconName, MAX_QPATH, "models/aw_players/%s/icon_%s.tga", model, skin );
loadingPlayerIcons[loadingPlayerIconCount] = trap_R_RegisterShaderNoMip( iconName );
if ( !loadingPlayerIcons[loadingPlayerIconCount] ) {
Com_sprintf( iconName, MAX_QPATH, "models/aw_players/%s/icon_%s.tga", DEFAULT_MODEL, "default" );
loadingPlayerIcons[loadingPlayerIconCount] = trap_R_RegisterShaderNoMip( iconName );
}
if ( loadingPlayerIcons[loadingPlayerIconCount] ) {
loadingPlayerIconCount++;
}
}
Q_strncpyz( personality, Info_ValueForKey( info, "n" ), sizeof(personality) );
Q_CleanStr( personality );
CG_LoadingString( personality );
}
开发者ID:ElderPlayerX,项目名称:Afterwards,代码行数:40,代码来源:cg_info.c
示例15: G_refClientnumForName
/////////////////
// Utility
//
int G_refClientnumForName( gentity_t *ent, const char *name )
{
char cleanName[ MAX_TOKEN_CHARS ];
int i;
if ( !*name )
{
return ( MAX_CLIENTS );
}
for ( i = 0; i < level.numConnectedClients; i++ )
{
Q_strncpyz( cleanName, level.clients[ level.sortedClients[ i ] ].pers.netname, sizeof( cleanName ) );
Q_CleanStr( cleanName );
if ( !Q_stricmp( cleanName, name ) )
{
return ( level.sortedClients[ i ] );
}
}
G_refPrintf( ent, "Client not on server." );
return ( MAX_CLIENTS );
}
开发者ID:SHOVELL,项目名称:Unvanquished,代码行数:28,代码来源:g_referee.c
示例16: SV_AutoRecordDemo
void SV_AutoRecordDemo( client_t *cl ) {
char demoName[MAX_OSPATH];
char demoFolderName[MAX_OSPATH];
char demoFileName[MAX_OSPATH];
char *demoNames[] = { demoFolderName, demoFileName };
char date[MAX_OSPATH];
char folderDate[MAX_OSPATH];
char folderTreeDate[MAX_OSPATH];
char demoPlayerName[MAX_NAME_LENGTH];
time_t rawtime;
struct tm * timeinfo;
time( &rawtime );
timeinfo = localtime( &rawtime );
strftime( date, sizeof( date ), "%Y-%m-%d_%H-%M-%S", timeinfo );
timeinfo = localtime( &sv.realMapTimeStarted );
strftime( folderDate, sizeof( folderDate ), "%Y-%m-%d_%H-%M-%S", timeinfo );
strftime( folderTreeDate, sizeof( folderTreeDate ), "%Y/%m/%d", timeinfo );
Q_strncpyz( demoPlayerName, cl->name, sizeof( demoPlayerName ) );
Q_CleanStr( demoPlayerName );
Com_sprintf( demoFileName, sizeof( demoFileName ), "%d %s %s %s",
cl - svs.clients, demoPlayerName, Cvar_VariableString( "mapname" ), date );
Com_sprintf( demoFolderName, sizeof( demoFolderName ), "%s %s", Cvar_VariableString( "mapname" ), folderDate );
// sanitize filename
for ( char **start = demoNames; start - demoNames < (ptrdiff_t)ARRAY_LEN( demoNames ); start++ ) {
Q_strstrip( *start, "\n\r;:.?*<>|\\/\"", NULL );
}
Com_sprintf( demoName, sizeof( demoName ), "autorecord/%s/%s/%s", folderTreeDate, demoFolderName, demoFileName );
SV_RecordDemo( cl, demoName );
}
开发者ID:adnanfzafar,项目名称:OpenJK,代码行数:29,代码来源:sv_ccmds.cpp
示例17: G_RemoveNamedBot
/*
==============
G_RemoveNamedBot - removes the bot named "name"
==============
*/
int G_RemoveNamedBot( char *name ) {
int i;
char netname[36];
gclient_t *cl;
for ( i=0 ; i< g_maxclients.integer ; i++ ) {
cl = level.clients + i;
if ( cl->pers.connected != CON_CONNECTED ) {
continue;
}
if ( !(g_entities[cl->ps.clientNum].r.svFlags & SVF_BOT) ) {
continue;
}
// use scriptname, not netname
if (!Q_stricmp(name, cl->pers.botScriptName))
{
// found the bot. boot him
strcpy(netname, cl->pers.netname);
Q_CleanStr(netname);
trap_SendConsoleCommand( EXEC_INSERT, va("kick \"%s\" 0\n", netname) );
return qtrue;
}
}
return qfalse;
}
开发者ID:GenaSG,项目名称:ET,代码行数:31,代码来源:g_bot.c
示例18: CG_LoadingClient
/*
===================
CG_LoadingClient
===================
*/
void CG_LoadingClient( int clientNum ) {
const char *info;
char *skin;
char personality[MAX_QPATH];
char model[MAX_QPATH];
char iconName[MAX_QPATH];
info = CG_ConfigString( CS_PLAYERS + clientNum );
Q_strncpyz( model, Info_ValueForKey( info, "model" ), sizeof( model ) );
skin = strchr( model, '/' );
if ( skin ) {
//*skin++ = '\0';
//} else {
// skin = "default";
model[strlen(model) - strlen(skin)] = '\0';
}
//RPG-X: MODEL SYSTEM CHANGE
Com_sprintf( iconName, MAX_QPATH, "models/players_rpgx/%s/model_icon.jpg", model );
//Com_sprintf( iconName, MAX_QPATH, "models/players/%s/icon_%s.jpg", model, skin );
//CG_Printf( S_COLOR_RED "Loading %s\n", iconName );
loadingPlayerIcon = trap_R_RegisterShaderNoMip( iconName ); //iconName;
Q_strncpyz( personality, Info_ValueForKey( info, "n" ), sizeof(personality) );
Q_CleanStr( personality );
CG_LoadingString( personality );
}
开发者ID:UberGames,项目名称:RPG-X2-rpgxEF,代码行数:36,代码来源:cg_info.c
示例19: G_SayCensor
char* G_SayCensor(char *msg)
{
char token2[1024];
char token[1024];
badwordsList_t *this;
char* ret = msg;
while(1){
msg = Com_ParseGetToken(msg);
if(msg==NULL)
break;
int size = Com_ParseTokenLength(msg);
Q_strncpyz(token,msg,size+1);
Q_CleanStr(token);
CharConv(token2,token,sizeof(token2));// 'clear' token
censor_ignoreMultiple(token,token2,sizeof(token));
for(this = svse.badwords ; this ; this = this->next){
if(this->exactmatch){
if(!Q_stricmp(token2,this->word)){
memset(msg,'*',size);
break;
}
}else{
if(strstr(token,this->word)!=NULL){
memset(msg,'*',size);
break;
}
}
}
}
return ret;
}
开发者ID:dioda,项目名称:apb,代码行数:34,代码来源:censor.c
示例20: Cmd_Argv
/*
==================
SV_GetPlayerByName
Returns the player with name from Cmd_Argv(1)
==================
*/
static client_t *SV_GetPlayerByFedName( const char *name )
{
client_t *cl;
int i;
char cleanName[64];
// make sure server is running
if ( !com_sv_running->integer )
{
return NULL;
}
// check for a name match
for ( i=0, cl=svs.clients ; i < sv_maxclients->integer ; i++,cl++ )
{
if ( !cl->state )
{
continue;
}
if ( !Q_stricmp( cl->name, name ) )
{
return cl;
}
Q_strncpyz( cleanName, cl->name, sizeof(cleanName) );
Q_CleanStr( cleanName, (qboolean)MV_USE102COLOR );
if ( !Q_stricmp( cleanName, name ) )
{
return cl;
}
}
return NULL;
}
开发者ID:vvvjk2,项目名称:jk2mv,代码行数:41,代码来源:sv_ccmds.cpp
注:本文中的Q_CleanStr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论