这篇教程C++ trap_Cmd_Argc函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中trap_Cmd_Argc函数的典型用法代码示例。如果您正苦于以下问题:C++ trap_Cmd_Argc函数的具体用法?C++ trap_Cmd_Argc怎么用?C++ trap_Cmd_Argc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了trap_Cmd_Argc函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: M_Custom_Initstatic void M_Custom_Init( void ){ menucommon_t *menuitem = NULL; int yoffset = 40; int i, count; s_custom_menu.nitems = 0; // parse the command line to create the buttons if( trap_Cmd_Argc() < 1 ) return; // first one is always the tittle menuitem = UI_InitMenuItem( "m_custom_title1", trap_Cmd_Argv( 1 ), 0, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemBig, NULL ); Menu_AddItem( &s_custom_menu, menuitem ); yoffset += trap_SCR_strHeight( menuitem->font ); yoffset += trap_SCR_strHeight( menuitem->font ); // from now on each 2 new arguments define a new button for( i = 2, count = 0; i < trap_Cmd_Argc(); i += 2, count++ ) { menuitem = UI_InitMenuItem( va( "m_custom_button%i", count ), trap_Cmd_Argv( i ), 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, M_Custom_ExecuteButton ); menuitem->itemlocal = UI_CopyString( trap_Cmd_Argv( i + 1 ) ); Menu_AddItem( &s_custom_menu, menuitem ); yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE; } Menu_Center( &s_custom_menu ); Menu_Init( &s_custom_menu, qtrue ); Menu_SetStatusBar( &s_custom_menu, NULL );}
开发者ID:Racenet,项目名称:racesow,代码行数:34,
示例2: Cmd_ShowStats_f/** Cmd_ShowStats_f*/static void Cmd_ShowStats_f( edict_t *ent ){ edict_t *target; if( trap_Cmd_Argc() > 2 ) { G_PrintMsg( ent, "Usage: stats [player]/n" ); return; } if( trap_Cmd_Argc() == 2 ) { target = G_PlayerForText( trap_Cmd_Argv( 1 ) ); if( target == NULL ) { G_PrintMsg( ent, "No such player/n" ); return; } } else { if( ent->r.client->resp.chase.active && game.edicts[ent->r.client->resp.chase.target].r.client ) target = &game.edicts[ent->r.client->resp.chase.target]; else target = ent; } if( target->s.team == TEAM_SPECTATOR ) { G_PrintMsg( ent, "No stats for spectators/n" ); return; } trap_GameCmd( ent, va( "plstats 1 /"%s/"", G_StatsMessage( target ) ) );}
开发者ID:MGXRace,项目名称:racesow,代码行数:38,
示例3: Cmd_AddIP_f/** Cmd_AddIP_f*/static void Cmd_AddIP_f( void ){ int i; if( trap_Cmd_Argc() < 2 ) { G_Printf( "Usage: addip <ip-mask> [time-mins]/n" ); return; } for( i = 0; i < numipfilters; i++ ) if( ipfilters[i].compare == 0xffffffff || (ipfilters[i].timeout && ipfilters[i].timeout <= game.serverTime) ) break; // free spot if( i == numipfilters ) { if( numipfilters == MAX_IPFILTERS ) { G_Printf( "IP filter list is full/n" ); return; } numipfilters++; } ipfilters[i].timeout = 0; if( !StringToFilter( trap_Cmd_Argv( 1 ), &ipfilters[i] ) ) ipfilters[i].compare = 0xffffffff; else if( trap_Cmd_Argc() == 3 ) ipfilters[i].timeout = game.serverTime + atof( trap_Cmd_Argv(2) )*60*1000;}
开发者ID:hettoo,项目名称:racesow,代码行数:32,
示例4: Cmd_CvarInfo_f/** Cmd_CvarInfo_f - Contains a cvar name and string provided by the client*/static void Cmd_CvarInfo_f( edict_t *ent ){ if( trap_Cmd_Argc() < 2 ) { G_PrintMsg( ent, "Cmd_CvarInfo_f: invalid argument count/n" ); return; } // see if the gametype script is requesting this info if( !GT_asCallGameCommand( ent->r.client, "cvarinfo", trap_Cmd_Args(), trap_Cmd_Argc() - 1 ) ) { // if the gametype script wasn't interested in this command, print the output to console G_Printf( "%s%s's cvar '%s' is '%s%s'/n", ent->r.client->netname, S_COLOR_WHITE, trap_Cmd_Argv( 1 ), trap_Cmd_Argv( 2 ), S_COLOR_WHITE ); }}
开发者ID:codetwister,项目名称:qfusion,代码行数:18,
示例5: Cmd_RemoveIP_f/** Cmd_RemoveIP_f*/static void Cmd_RemoveIP_f( void ){ ipfilter_t f; int i, j; if( trap_Cmd_Argc() < 2 ) { G_Printf( "Usage: removeip <ip-mask>/n" ); return; } if( !StringToFilter( trap_Cmd_Argv( 1 ), &f ) ) return; for( i = 0; i < numipfilters; i++ ) if( ipfilters[i].mask == f.mask && ipfilters[i].compare == f.compare ) { for( j = i+1; j < numipfilters; j++ ) ipfilters[j-1] = ipfilters[j]; numipfilters--; G_Printf( "Removed./n" ); return; } G_Printf( "Didn't find %s./n", trap_Cmd_Argv( 1 ) );}
开发者ID:Clever-Boy,项目名称:qfusion,代码行数:29,
示例6: Cmd_ChaseCam_f/** Cmd_ChaseCam_f*/void Cmd_ChaseCam_f( edict_t *ent ) { bool team_only; const char *arg1; if( ent->s.team != TEAM_SPECTATOR && !ent->r.client->teamstate.is_coach ) { G_Teams_JoinTeam( ent, TEAM_SPECTATOR ); if( !CheckFlood( ent, false ) ) { // prevent 'joined spectators' spam G_PrintMsg( NULL, "%s%s joined the %s%s team./n", ent->r.client->netname, S_COLOR_WHITE, GS_TeamName( ent->s.team ), S_COLOR_WHITE ); } } // & 1 = scorelead // & 2 = powerups // & 4 = objectives // & 8 = fragger if( ent->r.client->teamstate.is_coach && GS_TeamBasedGametype() ) { team_only = true; } else { team_only = false; } arg1 = trap_Cmd_Argv( 1 ); if( trap_Cmd_Argc() < 2 ) { G_ChasePlayer( ent, NULL, team_only, 0 ); } else if( !Q_stricmp( arg1, "auto" ) ) { G_PrintMsg( ent, "Chasecam mode is 'auto'. It will follow the score leader when no powerup nor flag is carried./n" ); G_ChasePlayer( ent, NULL, team_only, 7 ); } else if( !Q_stricmp( arg1, "carriers" ) ) { G_PrintMsg( ent, "Chasecam mode is 'carriers'. It will switch to flag or powerup carriers when any of these items is picked up./n" ); G_ChasePlayer( ent, NULL, team_only, 6 ); } else if( !Q_stricmp( arg1, "powerups" ) ) { G_PrintMsg( ent, "Chasecam mode is 'powerups'. It will switch to powerup carriers when any of these items is picked up./n" ); G_ChasePlayer( ent, NULL, team_only, 2 ); } else if( !Q_stricmp( arg1, "objectives" ) ) { G_PrintMsg( ent, "Chasecam mode is 'objectives'. It will switch to objectives carriers when any of these items is picked up./n" ); G_ChasePlayer( ent, NULL, team_only, 4 ); } else if( !Q_stricmp( arg1, "score" ) ) { G_PrintMsg( ent, "Chasecam mode is 'score'. It will always follow the player with the best score./n" ); G_ChasePlayer( ent, NULL, team_only, 1 ); } else if( !Q_stricmp( arg1, "fragger" ) ) { G_PrintMsg( ent, "Chasecam mode is 'fragger'. The last fragging player will be followed./n" ); G_ChasePlayer( ent, NULL, team_only, 8 ); } else if( !Q_stricmp( arg1, "help" ) ) { G_PrintMsg( ent, "Chasecam modes:/n" ); G_PrintMsg( ent, "- 'auto': Chase the score leader unless there's an objective carrier or a powerup carrier./n" ); G_PrintMsg( ent, "- 'carriers': User has pov control unless there's an objective carrier or a powerup carrier./n" ); G_PrintMsg( ent, "- 'objectives': User has pov control unless there's an objective carrier./n" ); G_PrintMsg( ent, "- 'powerups': User has pov control unless there's a flag carrier./n" ); G_PrintMsg( ent, "- 'score': Always follow the score leader. User has no pov control./n" ); G_PrintMsg( ent, "- 'none': Disable chasecam./n" ); return; } else { G_ChasePlayer( ent, arg1, team_only, 0 ); } G_Teams_LeaveChallengersQueue( ent );}
开发者ID:Picmip,项目名称:qfusion,代码行数:63,
示例7: Cmd_Match_f/** Cmd_Match_f*/static void Cmd_Match_f( void ){ const char *cmd; if( trap_Cmd_Argc() != 2 ) { Com_Printf( "Usage: match <option: restart|advance|status>/n" ); return; } cmd = trap_Cmd_Argv( 1 ); if( !Q_stricmp( cmd, "restart" ) ) { level.exitNow = false; level.hardReset = false; Q_strncpyz( level.forcemap, level.mapname, sizeof( level.mapname ) ); G_EndMatch(); } else if( !Q_stricmp( cmd, "advance" ) ) { level.exitNow = false; level.hardReset = true; // level.forcemap[0] = 0; G_EndMatch(); } else if( !Q_stricmp( cmd, "status" ) ) { trap_Cmd_ExecuteText( EXEC_APPEND, "status" ); }}
开发者ID:Clever-Boy,项目名称:qfusion,代码行数:33,
示例8: ClientCommand/** ClientCommand*/void ClientCommand( edict_t *ent ){ char *cmd; int i; if( !ent->r.client || trap_GetClientState( PLAYERNUM( ent ) ) < CS_SPAWNED ) return; // not fully in game yet cmd = trap_Cmd_Argv( 0 ); if( Q_stricmp( cmd, "cvarinfo" ) ) // skip cvarinfo cmds because they are automatic responses G_Client_UpdateActivity( ent->r.client ); // activity detected for( i = 0; i < MAX_GAMECOMMANDS; i++ ) { if( !g_Commands[i].name[0] ) break; if( !Q_stricmp( g_Commands[i].name, cmd ) ) { if( g_Commands[i].func ) g_Commands[i].func( ent ); else GT_asCallGameCommand( ent->r.client, cmd, trap_Cmd_Args(), trap_Cmd_Argc() - 1 ); return; } } G_PrintMsg( ent, "Bad user command: %s/n", cmd );}
开发者ID:codetwister,项目名称:qfusion,代码行数:33,
示例9: Cmd_Say_f/** Cmd_Say_f*/void Cmd_Say_f( edict_t *ent, bool arg0, bool checkflood ){ char *p; char text[2048]; size_t arg0len = 0;#ifdef AUTHED_SAY if( sv_mm_enable->integer && ent->r.client && ent->r.client->mm_session <= 0 ) { // unauthed players are only allowed to chat to public at non play-time if( GS_MatchState() == MATCH_STATE_PLAYTIME ) { G_PrintMsg( ent, "%s", S_COLOR_YELLOW "You must authenticate to be able to communicate to other players during the match./n"); return; } }#endif if( checkflood ) { if( CheckFlood( ent, false ) ) return; } if( ent->r.client && ( ent->r.client->muted & 1 ) ) return; if( trap_Cmd_Argc() < 2 && !arg0 ) return; text[0] = 0; if( arg0 ) { Q_strncatz( text, trap_Cmd_Argv( 0 ), sizeof( text ) ); Q_strncatz( text, " ", sizeof( text ) ); arg0len = strlen( text ); Q_strncatz( text, trap_Cmd_Args(), sizeof( text ) ); } else { p = trap_Cmd_Args(); if( *p == '"' ) { if( p[strlen( p )-1] == '"' ) p[strlen( p )-1] = 0; p++; } Q_strncatz( text, p, sizeof( text ) ); } // don't let text be too long for malicious reasons text[arg0len + (MAX_CHAT_BYTES - 1)] = 0; if( !Q_stricmp( text, "gg" ) || !Q_stricmp( text, "good game" ) ) G_AwardFairPlay( ent ); G_ChatMsg( NULL, ent, false, "%s", text );}
开发者ID:DenMSC,项目名称:qfusion,代码行数:63,
示例10: SF_Music_f/** SF_Music*/static void SF_Music_f( void ){ if( trap_Cmd_Argc() == 2 ) { SF_StartBackgroundTrack( trap_Cmd_Argv( 1 ), trap_Cmd_Argv( 1 ), 0 ); } else if( trap_Cmd_Argc() == 3 ) { SF_StartBackgroundTrack( trap_Cmd_Argv( 1 ), trap_Cmd_Argv( 2 ), 0 ); } else { Com_Printf( "music <intro|playlist> [loop|shuffle]/n" ); return; }}
开发者ID:MGXRace,项目名称:racesow,代码行数:19,
示例11: CG_DemoEditMode_Cmd_f/** CG_DemoEditMode_Cmd_f*/static void CG_DemoEditMode_Cmd_f( void ) { if( !cgs.demoPlaying ) { return; } if( trap_Cmd_Argc() > 1 ) { if( !Q_stricmp( trap_Cmd_Argv( 1 ), "on" ) ) { democam_editing_mode = true; } else if( !Q_stricmp( trap_Cmd_Argv( 1 ), "off" ) ) { democam_editing_mode = false; } } else { democam_editing_mode = !democam_editing_mode; } CG_Printf( "demo cam editing mode %s/n", democam_editing_mode ? "on" : "off" ); if( democam_editing_mode ) { trap_Cmd_AddCommand( "addcam", CG_AddCam_Cmd_f ); trap_Cmd_AddCommand( "deletecam", CG_DeleteCam_Cmd_f ); trap_Cmd_AddCommand( "editcam", CG_EditCam_Cmd_f ); trap_Cmd_AddCommand( "saverecam", CG_SaveCam_Cmd_f ); trap_Cmd_AddCommand( "clearcams", CG_Democam_FreeCams ); trap_Cmd_AddCommand( "importcams", CG_Democam_ImportCams_f ); trap_Cmd_AddCommand( "subtitle", CG_AddSub_Cmd_f ); trap_Cmd_AddCommand( "addprint", CG_AddPrint_Cmd_f ); } else { CG_DemoEditMode_RemoveCmds(); }}
开发者ID:Picmip,项目名称:qfusion,代码行数:32,
示例12: UI_Force_f/** UI_Force_f*/void UI_Force_f( void ){ if( trap_Cmd_Argc() != 2 ) return; uis.forceUI = (qboolean)( atoi( trap_Cmd_Argv( 1 ) ) != 0 );}
开发者ID:Kaperstone,项目名称:warsow,代码行数:10,
示例13: CG_AddCam_Cmd_f/** CG_AddCam_Cmd_f*/static void CG_AddCam_Cmd_f( void ) { int type, i; CG_DemoCam_UpdateDemoTime(); if( trap_Cmd_Argc() == 2 ) { // type type = -1; for( i = 0; cam_TypeNames[i] != NULL; i++ ) { if( !Q_stricmp( cam_TypeNames[i], trap_Cmd_Argv( 1 ) ) ) { type = i; break; } } if( type != -1 ) { // valid. Register and return if( CG_Democam_RegisterCam( type ) != NULL ) { CG_Printf( "cam added/n" ); // update current cam CG_Democam_ExecutePathAnalysis(); currentcam = CG_Democam_FindCurrent( demo_time ); nextcam = CG_Democam_FindNext( demo_time ); return; } } } // print help CG_Printf( " : Usage: AddCam <type>/n" ); CG_Printf( " : Available types:/n" ); for( i = 0; cam_TypeNames[i] != NULL; i++ ) CG_Printf( " : %s/n", cam_TypeNames[i] );}
开发者ID:Picmip,项目名称:qfusion,代码行数:38,
示例14: CG_SC_DemoGet/** CG_SC_DemoGet*/static void CG_SC_DemoGet( void ){ if( cgs.demoPlaying ) { // ignore download commands coming from demo files return; } if( !demo_requested ) { CG_Printf( "Warning: demoget when not requested, ignored/n" ); return; } demo_requested = qfalse; if( trap_Cmd_Argc() < 2 ) { CG_Printf( "No such demo found/n" ); return; } if( !COM_ValidateRelativeFilename( trap_Cmd_Argv( 1 ) ) ) { CG_Printf( "Warning: demoget: Invalid filename, ignored/n" ); return; } trap_DownloadRequest( trap_Cmd_Argv( 1 ), qfalse );}
开发者ID:hettoo,项目名称:racesow,代码行数:33,
示例15: Cmd_GameOperator_f/** Cmd_GameOperator_f*/static void Cmd_GameOperator_f( edict_t *ent ){ if( !g_operator_password->string[0] ) { G_PrintMsg( ent, "Operator is disabled in this server/n" ); return; } if( trap_Cmd_Argc() < 2 ) { G_PrintMsg( ent, "Usage: 'operator <password>' or 'op <password>'/n" ); return; } if( !Q_stricmp( trap_Cmd_Argv( 1 ), g_operator_password->string ) ) { if( !ent->r.client->isoperator ) G_PrintMsg( NULL, "%s"S_COLOR_WHITE" is now a game operator/n", ent->r.client->netname ); ent->r.client->isoperator = true; return; } G_PrintMsg( ent, "Incorrect operator password./n" );}
开发者ID:codetwister,项目名称:qfusion,代码行数:28,
示例16: SF_Music_f/** S_Music*/static void SF_Music_f( void ){ if( trap_Cmd_Argc() < 2 ) { Com_Printf( "music: <introfile|playlist> [loopfile|shuffle]/n" ); return; } SF_StartBackgroundTrack( trap_Cmd_Argv( 1 ), trap_Cmd_Argv( 2 ), 0 );}
开发者ID:cfr,项目名称:qfusion,代码行数:13,
示例17: CG_Cmd_UseItem_f/** CG_Cmd_UseItem_f*/static void CG_Cmd_UseItem_f( void ){ if( !trap_Cmd_Argc() ) { CG_Printf( "Usage: 'use <item name>' or 'use <item index>'/n" ); return; } CG_UseItem( trap_Cmd_Args() );}
开发者ID:hettoo,项目名称:racesow,代码行数:13,
示例18: Cmd_Score_f/** Cmd_Score_f*/static void Cmd_Score_f( edict_t *ent ){ qboolean newvalue; if( trap_Cmd_Argc() == 2 ) newvalue = ( atoi( trap_Cmd_Argv( 1 ) ) != 0 ); else newvalue = !ent->r.client->level.showscores; ent->r.client->level.showscores = newvalue;}
开发者ID:j0ki,项目名称:racesow,代码行数:14,
示例19: Cmd_Score_f/** Cmd_Score_f*/static void Cmd_Score_f( edict_t *ent ){ bool newvalue; if( trap_Cmd_Argc() == 2 ) newvalue = ( atoi( trap_Cmd_Argv( 1 ) ) != 0 ) ? true : false; else newvalue = !ent->r.client->level.showscores ? true : false; ent->r.client->level.showscores = newvalue;}
开发者ID:codetwister,项目名称:qfusion,代码行数:14,
示例20: Cmd_Whois_f/** Cmd_Whois_f*/static void Cmd_Whois_f( edict_t *ent ){ edict_t *target; gclient_t *cl; const char *login; if( trap_Cmd_Argc() > 2 ) { G_PrintMsg( ent, "Usage: whois [player]/n" ); return; } if( trap_Cmd_Argc() == 2 ) { target = G_PlayerForText( trap_Cmd_Argv( 1 ) ); if( target == NULL ) { G_PrintMsg( ent, "No such player/n" ); return; } } else { if( ent->r.client->resp.chase.active && game.edicts[ent->r.client->resp.chase.target].r.client ) target = &game.edicts[ent->r.client->resp.chase.target]; else target = ent; } cl = target->r.client; if( cl->mm_session <= 0 ) { G_PrintMsg( ent, "Unregistered player/n" ); return; } login = Info_ValueForKey( cl->userinfo, "cl_mm_login" ); G_PrintMsg( ent, "%s%s is %s/n", cl->netname, S_COLOR_WHITE, login );}
开发者ID:codetwister,项目名称:qfusion,代码行数:44,
示例21: CG_SC_MenuCustom/** CG_SC_MenuCustom*/static void CG_SC_MenuCustom( void ){ char request[MAX_STRING_CHARS]; int i, c; if( cgs.demoPlaying || cgs.tv ) return; if( trap_Cmd_Argc() < 2 ) return; Q_strncpyz( request, va( "menu_open custom title /"%s/" ", trap_Cmd_Argv( 1 ) ), sizeof( request ) ); for( i = 2, c = 1; i < trap_Cmd_Argc() - 1; i += 2, c++ ) { Q_strncatz( request, va( "btn%i /"%s/" ", c, trap_Cmd_Argv( i ) ), sizeof( request ) ); Q_strncatz( request, va( "cmd%i /"%s/" ", c, trap_Cmd_Argv( i + 1 ) ), sizeof( request ) ); } trap_Cmd_ExecuteText( EXEC_APPEND, va( "%s/n", request ) );}
开发者ID:hettoo,项目名称:racesow,代码行数:24,
示例22: CG_SC_ChannelRemove/** CG_SC_ChannelRemove*/static void CG_SC_ChannelRemove( void ){ int i, id; for( i = 1; i < trap_Cmd_Argc(); i++ ) { id = atoi( trap_Cmd_Argv( i ) ); if( id <= 0 ) continue; trap_Cmd_ExecuteText( EXEC_NOW, va( "menu_tvchannel_remove %i/n", id ) ); }}
开发者ID:hettoo,项目名称:racesow,代码行数:15,
示例23: TVM_Cmd_PlayersExt_f/** TVM_Cmd_PlayersExt_f*/static void TVM_Cmd_PlayersExt_f( edict_t *ent, bool onlyspecs ) { int i; int count = 0; int start = 0; char line[64]; char msg[1024]; edict_t *e; tvm_relay_t *relay = ent->relay; if( trap_Cmd_Argc() > 1 ) { start = atoi( trap_Cmd_Argv( 1 ) ); } clamp( start, 0, relay->maxclients - 1 ); // print information msg[0] = 0; for( i = start + 1; PLAYERNUM( ( relay->edicts + i ) ) < relay->maxclients; i++ ) { e = relay->edicts + i; if( e->r.inuse && !e->local && e->r.client ) { char *userinfo; userinfo = relay->configStrings[CS_PLAYERINFOS + PLAYERNUM( e )]; Q_snprintfz( line, sizeof( line ), "%3i %s/n", i, Info_ValueForKey( userinfo, "name" ) ); if( strlen( line ) + strlen( msg ) > sizeof( msg ) - 100 ) { // can't print all of them in one packet Q_strncatz( msg, ".../n", sizeof( msg ) ); break; } if( count == 0 ) { Q_strncatz( msg, "num name/n", sizeof( msg ) ); Q_strncatz( msg, "--- ---------------/n", sizeof( msg ) ); } Q_strncatz( msg, line, sizeof( msg ) ); count++; } } if( count ) { Q_strncatz( msg, "--- ---------------/n", sizeof( msg ) ); } Q_strncatz( msg, va( "%3i %s/n", count, trap_Cmd_Argv( 0 ) ), sizeof( msg ) ); TVM_PrintMsg( relay, ent, "%s", msg ); if( i < relay->maxclients ) { TVM_PrintMsg( relay, ent, "Type '%s %i' for more %s/n", trap_Cmd_Argv( 0 ), i, trap_Cmd_Argv( 0 ) ); }}
开发者ID:Picmip,项目名称:qfusion,代码行数:54,
示例24: Cmd_PlayersExt_f/** Cmd_PlayersExt_f*/static void Cmd_PlayersExt_f( edict_t *ent, bool onlyspecs ){ int i; int count = 0; int start = 0; char line[64]; char msg[1024]; if( trap_Cmd_Argc() > 1 ) start = atoi( trap_Cmd_Argv( 1 ) ); clamp( start, 0, gs.maxclients - 1 ); // print information msg[0] = 0; for( i = start; i < gs.maxclients; i++ ) { if( trap_GetClientState( i ) >= CS_SPAWNED ) { if( onlyspecs && game.edicts[i+1].s.team != TEAM_SPECTATOR ) continue; Q_snprintfz( line, sizeof( line ), "%3i %s%s/n", i, game.clients[i].netname, game.clients[i].isoperator ? " op" : "" ); if( strlen( line ) + strlen( msg ) > sizeof( msg ) - 100 ) { // can't print all of them in one packet Q_strncatz( msg, ".../n", sizeof( msg ) ); break; } if( count == 0 ) { Q_strncatz( msg, "num name/n", sizeof( msg ) ); Q_strncatz( msg, "--- ---------------/n", sizeof( msg ) ); } Q_strncatz( msg, line, sizeof( msg ) ); count++; } } if( count ) Q_strncatz( msg, "--- ---------------/n", sizeof( msg ) ); Q_strncatz( msg, va( "%3i %s/n", count, trap_Cmd_Argv( 0 ) ), sizeof( msg ) ); G_PrintMsg( ent, "%s", msg ); if( i < gs.maxclients ) G_PrintMsg( ent, "Type '%s %i' for more %s/n", trap_Cmd_Argv( 0 ), i, trap_Cmd_Argv( 0 ) );}
开发者ID:codetwister,项目名称:qfusion,代码行数:54,
示例25: CG_DemoFreeFly_Cmd_f/** CG_DemoFreeFly_Cmd_f*/static void CG_DemoFreeFly_Cmd_f( void ) { if( trap_Cmd_Argc() > 1 ) { if( !Q_stricmp( trap_Cmd_Argv( 1 ), "on" ) ) { CamIsFree = true; } else if( !Q_stricmp( trap_Cmd_Argv( 1 ), "off" ) ) { CamIsFree = false; } } else { CamIsFree = !CamIsFree; } VectorClear( cam_velocity ); CG_Printf( "demo cam mode %s/n", CamIsFree ? "Free Fly" : "Preview" );}
开发者ID:Picmip,项目名称:qfusion,代码行数:17,
示例26: SF_Play_fstatic void SF_Play_f( void ){ int i; char name[MAX_QPATH]; i = 1; while( i < trap_Cmd_Argc() ) { Q_strncpyz( name, trap_Cmd_Argv( i ), sizeof( name ) ); S_StartLocalSound( name ); i++; }}
开发者ID:MGXRace,项目名称:racesow,代码行数:14,
示例27: Cmd_Say_f/** Cmd_Say_f*/void Cmd_Say_f( edict_t *ent, qboolean arg0, qboolean checkflood ){ char *p; char text[2048]; if( checkflood ) { if( CheckFlood( ent, qfalse ) ) return; } if( ent->r.client && ent->r.client->muted & 1 ) return; if( trap_Cmd_Argc() < 2 && !arg0 ) return; text[0] = 0; if( arg0 ) { Q_strncatz( text, trap_Cmd_Argv( 0 ), sizeof( text ) ); Q_strncatz( text, " ", sizeof( text ) ); Q_strncatz( text, trap_Cmd_Args(), sizeof( text ) ); } else { p = trap_Cmd_Args(); if( *p == '"' ) { if( p[strlen( p )-1] == '"' ) p[strlen( p )-1] = 0; p++; } Q_strncatz( text, p, sizeof( text ) ); } // don't let text be too long for malicious reasons if( strlen( text ) > 150 ) text[150] = 0; G_ChatMsg( NULL, ent, qfalse, "%s", text ); // racesow RS_ircSendMessage( va( "%s", COM_RemoveColorTokens(( ent->r.client->netname ) )), va( "%s", COM_RemoveColorTokens(( text)) ) ); // !racesow}
开发者ID:j0ki,项目名称:racesow,代码行数:52,
示例28: SF_Play_fstatic void SF_Play_f( void ){ int i; sfx_t *sfx; for( i = 1; i < trap_Cmd_Argc(); i++ ) { sfx = SF_RegisterSound( trap_Cmd_Argv( i ) ); if( !sfx ) { Com_Printf( "Couldn't play: %s/n", trap_Cmd_Argv( i ) ); continue; } S_StartGlobalSound( sfx, S_CHANNEL_AUTO, 1.0 ); }}
开发者ID:cfr,项目名称:qfusion,代码行数:16,
注:本文中的trap_Cmd_Argc函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ trap_Cmd_ExecuteText函数代码示例 C++ trap_Characteristic_BFloat函数代码示例 |