• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ G_refPrintf函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中G_refPrintf函数的典型用法代码示例。如果您正苦于以下问题:C++ G_refPrintf函数的具体用法?C++ G_refPrintf怎么用?C++ G_refPrintf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了G_refPrintf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: G_refMute_cmd

// (Un)Mutes a player
void G_refMute_cmd(gentity_t *ent, qboolean mute)
{
	int pid;
	char arg[MAX_TOKEN_CHARS];
	gentity_t *player;

	// Find the player to mute.
	trap_Argv(2, arg, sizeof(arg));
	if((pid = ClientNumberFromString(ent, arg)) == -1) return;

	player = g_entities + pid;

	if( player->client->sess.referee != RL_NONE ) {
		G_refPrintf(ent, "Cannot mute a referee.\n" );
		return;
	}

	if(player->client->sess.muted == mute) {
		G_refPrintf(ent, "\"%s^*\" %s\n", player->client->pers.netname, mute ? "is already muted!" : "is not muted!" );
		return;
	}

	if( mute ) {
		CPx(pid, "print \"^5You've been muted\n\"" );
		player->client->sess.muted = qtrue;
		G_Printf( "\"%s^*\" has been muted\n",  player->client->pers.netname );
		ClientUserinfoChanged( pid );
	} else {
		CPx(pid, "print \"^5You've been unmuted\n\"" );
		player->client->sess.muted = qfalse;
		G_Printf( "\"%s^*\" has been unmuted\n",  player->client->pers.netname );
		ClientUserinfoChanged( pid );
	}
}
开发者ID:GenaSG,项目名称:ET,代码行数:35,代码来源:g_referee.c


示例2: G_WarmupDamageTypeList

void G_WarmupDamageTypeList( gentity_t *ent ) {
	int i;

	G_refPrintf( ent, "\nAvailable Warmup Damage types:\n------------------------------" );
	for ( i = 0; i < ( sizeof( warmupType ) / sizeof( char * ) ); i++ ) G_refPrintf( ent, "  %d ^3(%s)", i, warmupType[i] );
	G_refPrintf( ent, "\n" );
}
开发者ID:AdrienJaguenet,项目名称:Enemy-Territory,代码行数:7,代码来源:g_vote.c


示例3: G_refRemove_cmd

// Removes a player from a team.
void G_refRemove_cmd(gentity_t *ent)
{
	int pid;
	char arg[MAX_TOKEN_CHARS];
	gentity_t *player;

	// Works for teamplayish matches
	if(g_gametype.integer < GT_WOLF) {
		G_refPrintf(ent, "\"remove\" only for team-based games!");
		return;
	}

	// Find the player to remove.
	trap_Argv(2, arg, sizeof(arg));
	if((pid = ClientNumberFromString(ent, arg)) == -1) return;

	player = g_entities + pid;

	// Can only remove active players.
	if(player->client->sess.sessionTeam == TEAM_SPECTATOR) {
		G_refPrintf(ent, "You can only remove people in the game!");
		return;
	}

	// Announce the removal
	AP(va("cp \"%s\n^7removed from team %s\n\"", player->client->pers.netname, aTeams[player->client->sess.sessionTeam]));
	CPx(pid, va("print \"^5You've been removed from the %s team\n\"", aTeams[player->client->sess.sessionTeam]));

	SetTeam( player, "s", qtrue, -1, -1, qfalse );

	if(g_gamestate.integer == GS_WARMUP || g_gamestate.integer == GS_WARMUP_COUNTDOWN) {
		G_readyMatchState();
	}
}
开发者ID:GenaSG,项目名称:ET,代码行数:35,代码来源:g_referee.c


示例4: G_StartMatch_v

// *** Start Match ***
int G_StartMatch_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
	// Vote request (vote is being initiated)
	if(arg) {
		if(trap_Argc() > 2) {
			if(!Q_stricmp(arg2, "?")) {
				G_refPrintf(ent, "Usage: ^3%s %s%s\n", ((fRefereeCmd) ? "\\ref" : "\\callvote"), arg, aVoteInfo[dwVoteIndex].pszVoteHelp);
				return(G_INVALID);
			}
		}

		if(g_gamestate.integer == GS_PLAYING || g_gamestate.integer == GS_INTERMISSION) {
			G_refPrintf(ent, "^3Match is already in progress!");
			return(G_INVALID);
		}

		if(g_gamestate.integer == GS_WARMUP_COUNTDOWN) {
			G_refPrintf(ent, "^3Countdown already started!");
			return(G_INVALID);
		}

		if(level.numPlayingClients < match_minplayers.integer) {
			G_refPrintf(ent, "^3Not enough players to start match!");
			return(G_INVALID);
		}

	// Vote action (vote has passed)
	} else {
		// Set everyone to "ready" status
		G_refAllReady_cmd(NULL);
	}

	return(G_OK);
}
开发者ID:Kajos,项目名称:RTCW.ET.Rift,代码行数:35,代码来源:g_vote.c


示例5: G_refWarning_cmd

void G_refWarning_cmd(gentity_t *ent)
{
	char cmd[MAX_TOKEN_CHARS];
	char reason[MAX_TOKEN_CHARS];
	int  kicknum;

	trap_Argv(2, cmd, sizeof(cmd));

	if (!*cmd)
	{
		G_refPrintf(ent, "usage: ref warn <clientname> [reason].");
		return;
	}

	trap_Argv(3, reason, sizeof(reason));

	kicknum = G_refClientnumForName(ent, cmd);

	if (kicknum != MAX_CLIENTS)
	{
		if (level.clients[kicknum].sess.referee == RL_NONE || ((!ent || ent->client->sess.referee == RL_RCON) && level.clients[kicknum].sess.referee <= RL_REFEREE))
		{
			trap_SendServerCommand(-1, va("cpm \"%s^7 was issued a ^1Warning^7 (%s)\n\"\n", level.clients[kicknum].pers.netname, *reason ? reason : "No Reason Supplied"));
		}
		else
		{
			G_refPrintf(ent, "Insufficient rights to issue client a warning.");
		}
	}
}
开发者ID:morsik,项目名称:war-territory,代码行数:30,代码来源:g_referee.c


示例6: G_voteHelp

// Voting help summary.
void G_voteHelp(gentity_t *ent, qboolean fShowVote)
{
	int i, rows = 0, num_cmds = sizeof(aVoteInfo) / sizeof(aVoteInfo[0]) - 1;     // Remove terminator;
	int vi[100];            // Just make it large static.

	if (fShowVote)
	{
		CP("print \"\nValid ^3callvote^7 commands are:\n^3----------------------------\n\"");
	}

	for (i = 0; i < num_cmds; i++)
	{
		if (aVoteInfo[i].dwGameTypes & (1 << g_gametype.integer))
		{
			vi[rows++] = i;
		}
	}

	num_cmds = rows;
	rows     = num_cmds / HELP_COLUMNS;

	if (num_cmds % HELP_COLUMNS)
	{
		rows++;
	}

	for (i = 0; i < rows; i++)
	{
		if (i + rows * 3 + 1 <= num_cmds)
		{
			G_refPrintf(ent, "^5%-25s%-25s%-25s%-25s", aVoteInfo[vi[i]].pszVoteName,
			            aVoteInfo[vi[i + rows]].pszVoteName,
			            aVoteInfo[vi[i + rows * 2]].pszVoteName,
			            aVoteInfo[vi[i + rows * 3]].pszVoteName);
		}
		else if (i + rows * 2 + 1 <= num_cmds)
		{
			G_refPrintf(ent, "^5%-25s%-25s%-25s", aVoteInfo[vi[i]].pszVoteName,
			            aVoteInfo[vi[i + rows]].pszVoteName,
			            aVoteInfo[vi[i + rows * 2]].pszVoteName);
		}
		else if (i + rows + 1 <= num_cmds)
		{
			G_refPrintf(ent, "^5%-25s%-25s", aVoteInfo[vi[i]].pszVoteName,
			            aVoteInfo[vi[i + rows]].pszVoteName);
		}
		else
		{
			G_refPrintf(ent, "^5%-25s", aVoteInfo[vi[i]].pszVoteName);
		}
	}

	if (fShowVote)
	{
		CP("print \"\nUsage: ^3\\callvote <command> <params>\n^7For current settings/help, use: ^3\\callvote <command> ?\n\"");
	}

	return;
}
开发者ID:gitter-badger,项目名称:etlegacy,代码行数:60,代码来源:g_vote.c


示例7: G_Nextmap_v

// *** Nextmap ***
int G_Nextmap_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
	// Vote request (vote is being initiated)
	if (arg)
	{
		if (trap_Argc() > 2)
		{
			G_refPrintf(ent, "Usage: ^3%s %s%s\n", ((fRefereeCmd) ? "\\ref" : "\\callvote"), arg, aVoteInfo[dwVoteIndex].pszVoteHelp);
			return(G_INVALID);
		}
		else if (!vote_allow_nextmap.integer && ent && !ent->client->sess.referee)
		{
			G_voteDisableMessage(ent, arg);
			return(G_INVALID);
		}
		else
		{
			char s[MAX_STRING_CHARS];
			if (g_gametype.integer == GT_WOLF_CAMPAIGN)
			{
				trap_Cvar_VariableStringBuffer("nextcampaign", s, sizeof(s));
				if (!*s)
				{
					G_refPrintf(ent, "'nextcampaign' is not set.");
					return(G_INVALID);
				}
			}
			else
			{
				trap_Cvar_VariableStringBuffer("nextmap", s, sizeof(s));
				if (!*s)
				{
					G_refPrintf(ent, "'nextmap' is not set.");
					return(G_INVALID);
				}
			}
		}

		// Vote action (vote has passed)
	}
	else
	{
		if (g_gametype.integer == GT_WOLF_CAMPAIGN)
		{
			// Load in the nextcampaign
			trap_SendConsoleCommand(EXEC_APPEND, "vstr nextcampaign\n");
			AP("cp \"^3*** Loading nextcampaign! ***\n\"");
		}
		else
		{
			// Load in the nextmap
			trap_SendConsoleCommand(EXEC_APPEND, "vstr nextmap\n");
			AP("cp \"^3*** Loading nextmap! ***\n\"");
		}
	}

	return(G_OK);
}
开发者ID:morsik,项目名称:war-territory,代码行数:59,代码来源:g_vote.c


示例8: G_Kick_v

// *** Player Kick ***
int G_Kick_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
	// Vote request (vote is being initiated)
	if (arg)
	{
		int pid;

		if (!vote_allow_kick.integer && ent && !ent->client->sess.referee)
		{
			G_voteDisableMessage(ent, arg);
			return G_INVALID;
		}
		else if (G_voteDescription(ent, fRefereeCmd, dwVoteIndex))
		{
			return G_INVALID;
		}
		else if ((pid = ClientNumberFromString(ent, arg2)) == -1)
		{
			return G_INVALID;
		}

		if (level.clients[pid].sess.referee)
		{
			G_refPrintf(ent, "Can't vote to kick referees!");
			return G_INVALID;
		}

		if (g_entities[pid].r.svFlags & SVF_BOT)
		{
			G_refPrintf(ent, "Can't vote to kick bots!");
			return G_INVALID;
		}

		if (!fRefereeCmd && ent)
		{
			if (level.clients[pid].sess.sessionTeam != TEAM_SPECTATOR && level.clients[pid].sess.sessionTeam != ent->client->sess.sessionTeam)
			{
				G_refPrintf(ent, "Can't vote to kick players on opposing team!");
				return G_INVALID;
			}
		}

		Com_sprintf(level.voteInfo.vote_value, VOTE_MAXSTRING, "%d", pid);
		Com_sprintf(arg2, VOTE_MAXSTRING, "%s", level.clients[pid].pers.netname);

		// Vote action (vote has passed)
	}
	else
	{
		// Kick a player
		trap_SendConsoleCommand(EXEC_APPEND, va("clientkick %d\n", atoi(level.voteInfo.vote_value)));
		AP(va("cp \"%s\n^3has been kicked!\n\"", level.clients[atoi(level.voteInfo.vote_value)].pers.netname));
	}

	return G_OK;
}
开发者ID:gitter-badger,项目名称:etlegacy,代码行数:57,代码来源:g_vote.c


示例9: G_Surrender_v

int G_Surrender_v( gentity_t *ent, unsigned int dwVoteIndex,
		char *arg, char *arg2, qboolean fRefereeCmd )
{
	team_t team;
	
	// Vote request (vote is being initiated)
	if(arg) {
		if(g_gamestate.integer != GS_PLAYING) {
			return G_INVALID;
		}
		if(!vote_allow_surrender.integer)
			return G_INVALID;
			
		// yada - noone ever seemes to have thought of refs calling this
		if(	!ent||
				ent->client->sess.sessionTeam==TEAM_SPECTATOR
		){
			if(trap_Argc()==2){
				G_refPrintf(ent,"Usage: \\%s surrender <team>",fRefereeCmd?"ref":"callvote");
				return G_INVALID;
			}
			team=TeamFromString(arg2);
			if(	team!=TEAM_AXIS&&
					team!=TEAM_ALLIES
			){
				G_refPrintf(ent,"Invalid team specified.");
				return G_INVALID;
			}
			level.voteInfo.voteTeam=team;
		}else{
			team=ent->client->sess.sessionTeam;
		}
		
		Q_strncpyz(arg2,
			(team == TEAM_AXIS) ?
				"[AXIS]" : "[ALLIES]",
			VOTE_MAXSTRING);
	}
	// Vote action (vote has passed)
	else if(g_gamestate.integer == GS_PLAYING){
		char cs[MAX_STRING_CHARS];

		trap_GetConfigstring(CS_MULTI_MAPWINNER, cs, sizeof(cs));
		Info_SetValueForKey(cs, "winner",
			(level.voteInfo.voteTeam == TEAM_AXIS) ? "1" : "0");
		trap_SetConfigstring(CS_MULTI_MAPWINNER, cs);
		LogExit(va("%s Surrender\n",
			(level.voteInfo.voteTeam == TEAM_AXIS) ?
			"Axis" : "Allies"));
		AP(va("chat \"%s have surrendered!\" -1",
			(level.voteInfo.voteTeam == TEAM_AXIS) ?
			"^1AXIS^7" : "^4ALLIES^7"));
	}
	return(G_OK);
}
开发者ID:BulldogDrummond,项目名称:etpub,代码行数:55,代码来源:g_vote.c


示例10: G_Kick_v

// *** Player Kick ***
int G_Kick_v( gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd ) {
	// Vote request (vote is being initiated)
	if( arg ) {
		int pid;

		if( !vote_allow_kick.integer && ent && !ent->client->sess.referee ) {
			G_voteDisableMessage(ent, arg);
			return G_INVALID;
		} else if( G_voteDescription(ent, fRefereeCmd, dwVoteIndex) ) {
			return G_INVALID;
		} else if( ( pid = ClientNumberFromString( ent, arg2 ) ) == -1 ) {
			return G_INVALID;
		}

		if( level.clients[ pid ].sess.referee ) {
			G_refPrintf( ent, "Can't vote to kick referees!" );
			return G_INVALID;
		}

		if(G_shrubbot_permission(&g_entities[pid], SBF_IMMUNITY)) {
			G_refPrintf( ent, "Can't vote to kick admins!" );
			return G_INVALID;
		}

		// pheno: prevent ettv slaves from being callvote kicked 
		if( level.clients[pid].sess.ettv &&
			( g_ettvFlags.integer & ETTV_IMMUNITY ) ) {
			G_refPrintf( ent, "Can't vote to kick ettv slaves!" );
			return G_INVALID;
		}

		if( !fRefereeCmd && ent ) {
			if( level.clients[ pid ].sess.sessionTeam != TEAM_SPECTATOR && level.clients[ pid ].sess.sessionTeam != ent->client->sess.sessionTeam ) {
				G_refPrintf( ent, "Can't vote to kick players on opposing team!" );
				return G_INVALID;
			}
		}

		Com_sprintf( level.voteInfo.vote_value, VOTE_MAXSTRING, "%d", pid );
		Com_sprintf( arg2, VOTE_MAXSTRING, "%s^7", level.clients[pid].pers.netname );

	// Vote action (vote has passed)
	} else {
		// Kick a player
		//trap_SendConsoleCommand( EXEC_APPEND, va( "clientkick %d\n", atoi( level.voteInfo.vote_value ) ) );
		// tjw: clientkick doesn't work in 2.60
		trap_DropClient(atoi(level.voteInfo.vote_value),
			"You have been kicked", 120);

		AP( va( "cp \"%s\n^3has been kicked!\n\"", level.clients[ atoi( level.voteInfo.vote_value ) ].pers.netname ) );
	}

	return G_OK;
}
开发者ID:BulldogDrummond,项目名称:etpub,代码行数:55,代码来源:g_vote.c


示例11: G_Unreferee_v

// *** Un-Referee voting ***
int G_Unreferee_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
	// Vote request (vote is being initiated)
	if(arg) {
		int pid;

		if(!vote_allow_referee.integer && ent && !ent->client->sess.referee) {
			G_voteDisableMessage(ent, arg);
			return(G_INVALID);
		}

		// yada - ent==NULL for console... 
		if( (!ent || ent->client->sess.referee) && trap_Argc() == 2) {
			G_playersMessage(ent);
			return(G_INVALID);
		} else if(ent && trap_Argc() == 2) pid = ent - g_entities; // yada - ent still NULL for console... 
		else if(G_voteDescription(ent, fRefereeCmd, dwVoteIndex)) return(G_INVALID);
		else if((pid = ClientNumberFromString(ent, arg2)) == -1) return(G_INVALID);

		if(level.clients[pid].sess.referee == RL_NONE) {
			G_refPrintf(ent, "[lof]%s [lon]isn't a referee!", level.clients[pid].pers.netname);
			return(G_INVALID);
		}

		if(level.clients[pid].sess.referee == RL_RCON) {
			G_refPrintf(ent, "[lof]%s's [lon]status cannot be removed", level.clients[pid].pers.netname);
			return(G_INVALID);
		}

		if( level.clients[pid].pers.localClient ) {
			G_refPrintf(ent, "[lof]%s [lon]^7is the Server Host", level.clients[pid].pers.netname);
			return(G_INVALID);
		}

		Com_sprintf(level.voteInfo.vote_value, VOTE_MAXSTRING, "%d", pid);
		Com_sprintf(arg2, VOTE_MAXSTRING, "%s^7", level.clients[pid].pers.netname);

	// Vote action (vote has passed)
	} else {
		// Stripping of referee status
		gclient_t *cl = &level.clients[atoi(level.voteInfo.vote_value)];

		cl->sess.referee = RL_NONE;
		
		if( !cl->sess.shoutcaster ) { // don't remove shoutcaster's invitation
			cl->sess.spec_invite = 0;
		}
		
		AP(va("cp \"%s^7\nis no longer a referee\n\"", cl->pers.netname));
		ClientUserinfoChanged( atoi(level.voteInfo.vote_value) );
	}

	return(G_OK);
}
开发者ID:BulldogDrummond,项目名称:etpub,代码行数:55,代码来源:g_vote.c


示例12: G_refPlayerPut_cmd

// Puts a player on a team.
void G_refPlayerPut_cmd( gentity_t *ent, int team_id )
{
	int       pid;
	char      arg[ MAX_TOKEN_CHARS ];
	gentity_t *player;

	// Works for teamplayish matches
	if ( g_gametype.integer < GT_WOLF )
	{
		G_refPrintf( ent, "\"put[allies|axis]\" only for team-based games!" );
		return;
	}

	// Find the player to place.
	trap_Argv( 2, arg, sizeof( arg ) );

	if ( ( pid = ClientNumberFromString( ent, arg ) ) == -1 )
	{
		return;
	}

	player = g_entities + pid;

	// Can only move to other teams.
	if ( player->client->sess.sessionTeam == team_id )
	{
		G_refPrintf( ent, "\"%s\" is already on team %s!", player->client->pers.netname, aTeams[ team_id ] );  // CHRUKER: b047 - Removed unneeded linebreak
		return;
	}

	if ( team_maxplayers.integer && TeamCount( -1, team_id ) >= team_maxplayers.integer )
	{
		G_refPrintf( ent, "Sorry, the %s team is already full!", aTeams[ team_id ] );  // CHRUKER: b047 - Removed unneeded linebreak
		return;
	}

	player->client->pers.invite = team_id;
	player->client->pers.ready = qfalse;

	if ( team_id == TEAM_AXIS )
	{
		SetTeam( player, "red", qtrue, -1, -1, qfalse );
	}
	else
	{
		SetTeam( player, "blue", qtrue, -1, -1, qfalse );
	}

	if ( g_gamestate.integer == GS_WARMUP || g_gamestate.integer == GS_WARMUP_COUNTDOWN )
	{
		G_readyMatchState();
	}
}
开发者ID:SHOVELL,项目名称:Unvanquished,代码行数:54,代码来源:g_referee.c


示例13: G_PutSpec_v

// *** Player PutSpec ***
int G_PutSpec_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
	// yada - my ass... this isnt handled elsewhere at all
	//if( fRefereeCmd ){
	//	// handled elsewhere
	//	return(G_NOTFOUND);
	//}

	// Vote request (vote is being initiated)
	if(arg) {
		int pid;

		if(!vote_allow_putspec.integer && ent && !ent->client->sess.referee) {
			G_voteDisableMessage(ent, arg);
			return(G_INVALID);
		} else if(G_voteDescription(ent, fRefereeCmd, dwVoteIndex)) return(G_INVALID);
		else if((pid = ClientNumberFromString(ent, arg2)) == -1) return(G_INVALID);

		if(level.clients[pid].sess.referee) {
			G_refPrintf(ent, "Can't vote to PutSpec referees!");
			return(G_INVALID);
		}

		if(G_shrubbot_permission(&g_entities[pid], SBF_IMMUNITY)) {
			G_refPrintf( ent, "Can't vote to PutSpec admins!" );
			return G_INVALID;
		}

		if(level.clients[pid].sess.sessionTeam == TEAM_SPECTATOR ||
			level.clients[pid].sess.sessionTeam != ent->client->sess.sessionTeam) {
			G_refPrintf(ent, "You can only PutSpec players in your own team!");
			return G_INVALID;
		}

		Com_sprintf(level.voteInfo.vote_value, VOTE_MAXSTRING, "%d", pid);
		Com_sprintf(arg2, VOTE_MAXSTRING, "%s^7", level.clients[pid].pers.netname);

	// Vote action (vote has passed)
	} else {
		int pid = atoi(level.voteInfo.vote_value);

		SetTeam( &g_entities[pid], "s", qtrue, -1, -1, qfalse );
		trap_SendServerCommand( pid, va( "cpm \"^3You have been moved to the Spectators\"") );
		AP(va("cp \"%s ^3has been\nmoved to the Spectators!\n\"", level.clients[pid].pers.netname));
		ClientUserinfoChanged( pid );
		
		if(g_gamestate.integer == GS_WARMUP || g_gamestate.integer == GS_WARMUP_COUNTDOWN) {
			G_readyMatchState();
		}
	}

	return(G_OK);
}
开发者ID:BulldogDrummond,项目名称:etpub,代码行数:54,代码来源:g_vote.c


示例14: G_Gametype_v

// *** GameType ***
int G_Gametype_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
	// Vote request (vote is being initiated)
	if (arg)
	{
		int i = atoi(arg2);

		if (!vote_allow_gametype.integer && ent && !ent->client->sess.referee)
		{
			G_voteDisableMessage(ent, arg);
			G_GametypeList(ent);
			G_voteCurrentSetting(ent, arg, va("%d (%s)", g_gametype.integer, gameNames[g_gametype.integer]));
			return G_INVALID;
		}
		else if (G_voteDescription(ent, fRefereeCmd, dwVoteIndex))
		{
			G_GametypeList(ent);
			G_voteCurrentSetting(ent, arg, va("%d (%s)", g_gametype.integer, gameNames[g_gametype.integer]));
			return G_INVALID;
		}

		if (i < GT_WOLF || i >= GT_MAX_GAME_TYPE || i == GT_WOLF_CAMPAIGN)
		{
			G_refPrintf(ent, "\n^3Invalid gametype: ^7%d", i);
			G_GametypeList(ent);
			return G_INVALID;
		}

		if (i == g_gametype.integer)
		{
			G_refPrintf(ent, "\n^3Gametype^5 is already set to %s!", gameNames[i]);
			return G_INVALID;
		}

		Com_sprintf(level.voteInfo.vote_value, VOTE_MAXSTRING, "%s", arg2);
		Com_sprintf(arg2, VOTE_MAXSTRING, "%s", gameNames[i]);

		// Vote action (vote has passed)
	}
	else
	{
		char s[MAX_STRING_CHARS];

		// Set gametype
		G_voteSetValue("Gametype", "g_gametype");

		trap_Cvar_VariableStringBuffer("mapname", s, sizeof(s));
		trap_SendConsoleCommand(EXEC_APPEND, va("map %s\n", s));
	}

	return G_OK;
}
开发者ID:gitter-badger,项目名称:etlegacy,代码行数:53,代码来源:g_vote.c


示例15: G_Mute_v

// *** Player Mute ***
int G_Mute_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
	// yada - no its handled here now
	//if( fRefereeCmd )
	//	// handled elsewhere
	//	return(G_NOTFOUND);

	// Vote request (vote is being initiated)
	if(arg) {
		int pid;

		if(!vote_allow_muting.integer && ent && !ent->client->sess.referee) {
			G_voteDisableMessage(ent, arg);
			return(G_INVALID);
		} else if(G_voteDescription(ent, fRefereeCmd, dwVoteIndex)) return(G_INVALID);
		else if((pid = ClientNumberFromString(ent, arg2)) == -1) return(G_INVALID);

		if(level.clients[pid].sess.referee) {
			G_refPrintf(ent, "Can't vote to mute referees!");
			return(G_INVALID);
		}

		if(G_shrubbot_permission(&g_entities[pid], SBF_IMMUNITY)) {
			G_refPrintf( ent, "Can't vote to mute admins!" );
			return G_INVALID;
		}

		if(level.clients[pid].sess.auto_unmute_time != 0) {
			G_refPrintf(ent, "Player is already muted!");
			return(G_INVALID);
		}

		Com_sprintf(level.voteInfo.vote_value, VOTE_MAXSTRING, "%d", pid);
		Com_sprintf(arg2, VOTE_MAXSTRING, "%s^7", level.clients[pid].pers.netname);

	// Vote action (vote has passed)
	} else {
		int pid = atoi(level.voteInfo.vote_value);

		// Mute a player
		if( level.clients[pid].sess.referee != RL_RCON ) {
			trap_SendServerCommand( pid, va( "cpm \"^3You have been muted\"") );
			level.clients[pid].sess.auto_unmute_time = -1;
			AP(va("cp \"%s\n^3has been muted!\n\"", level.clients[pid].pers.netname));
			ClientUserinfoChanged( pid );
		} else {
			G_Printf( "Cannot mute a referee.\n" );
		}
	}

	return(G_OK);
}
开发者ID:BulldogDrummond,项目名称:etpub,代码行数:53,代码来源:g_vote.c


示例16: G_GametypeList

void G_GametypeList( gentity_t *ent ) {
	int i;

	G_refPrintf( ent, "\nAvailable gametypes:\n--------------------" );

	for ( i = GT_WOLF; i < GT_MAX_GAME_TYPE; i++ ) {
		if ( i != GT_WOLF_CAMPAIGN ) {
			G_refPrintf( ent, "  %d ^3(%s)", i, gameNames[i] );
		}
	}

	G_refPrintf( ent, "\n" );
}
开发者ID:AdrienJaguenet,项目名称:Enemy-Territory,代码行数:13,代码来源:g_vote.c


示例17: G_Warmupfire_v

// *** Warmup Weapon Fire ***
int G_Warmupfire_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
	// Vote request (vote is being initiated)
	if (arg)
	{
		int i = atoi(arg2), val = (match_warmupDamage.integer < 0) ? 0 :
		                          (match_warmupDamage.integer > 2) ? 2 :
		                          match_warmupDamage.integer;

		if (!vote_allow_warmupdamage.integer && ent && !ent->client->sess.referee)
		{
			G_voteDisableMessage(ent, arg);
			G_WarmupDamageTypeList(ent);
			G_voteCurrentSetting(ent, arg, va("%d (%s)", val, warmupType[val]));
			return(G_INVALID);
		}
		else if (G_voteDescription(ent, fRefereeCmd, dwVoteIndex))
		{
			G_WarmupDamageTypeList(ent);
			G_voteCurrentSetting(ent, arg, va("%d (%s)", val, warmupType[val]));
			return(G_INVALID);
		}

		if (i < 0 || i > 2)
		{
			G_refPrintf(ent, "\n^3Invalid Warmup Damage type: ^7%d", i);
			G_WarmupDamageTypeList(ent);
			return(G_INVALID);
		}

		if (i == val)
		{
			G_refPrintf(ent, "\n^3Warmup Damage^5 is already set to %s!", warmupType[i]);
			return(G_INVALID);
		}

		Com_sprintf(level.voteInfo.vote_value, VOTE_MAXSTRING, "%s", arg2);
		Com_sprintf(arg2, VOTE_MAXSTRING, "%s", warmupType[i]);


		// Vote action (vote has passed)
	}
	else
	{
		// Warmup damage setting
		AP(va("print \"^3Warmup Damage set to: ^5%s\n\"", warmupType[atoi(level.voteInfo.vote_value)]));
		trap_SendConsoleCommand(EXEC_APPEND, va("match_warmupDamage %s\n", level.voteInfo.vote_value));
	}

	return(G_OK);
}
开发者ID:morsik,项目名称:war-territory,代码行数:52,代码来源:g_vote.c


示例18: G_refPlayerPut_cmd

// Puts a player on a team.
void G_refPlayerPut_cmd(gentity_t *ent, int team_id)
{
	int pid;
	char arg[MAX_TOKEN_CHARS];
	gentity_t *player;

	// Works for teamplayish matches
	if(g_gametype.integer < GT_WOLF) {
		G_refPrintf(ent, "\"put[allies|axis]\" only for team-based games!");
		return;
	}
	
	// yada - yeah right not giving an arg will end up as slot 0...
	// fixme: could maybe also be handled in ClientNumberFromString
	// if(ent&&!*s) return ent-g_entities;
	if(trap_Argc()!=3){
		G_refPrintf(ent,"Usage: \\ref put[allies|axis] <pid>");
		return;
	}

	// Find the player to place.
	trap_Argv(2, arg, sizeof(arg));
	if((pid = ClientNumberFromString(ent, arg)) == -1) return;

	player = g_entities + pid;

	// Can only move to other teams.
	if(player->client->sess.sessionTeam == team_id) {
		// CHRUKER: b047 - Remove unneeded linebreak
		G_refPrintf(ent, "\"%s\" is already on team %s!", player->client->pers.netname, aTeams[team_id]);
		return;
	}

	if(team_maxplayers.integer && TeamCount(-1, team_id) >= team_maxplayers.integer) {
		// CHRUKER: b047 - Remove unneeded linebreak
		G_refPrintf(ent, "Sorry, the %s team is already full!",  aTeams[team_id]);
		return;
	}

	player->client->pers.invite = team_id;
	player->client->pers.ready = qfalse;

	if( team_id == TEAM_AXIS ) {
		SetTeam( player, "red", qtrue, -1, -1, qfalse );
	} else {
		SetTeam( player, "blue", qtrue, -1, -1, qfalse );
	}

	if(g_gamestate.integer == GS_WARMUP || g_gamestate.integer == GS_WARMUP_COUNTDOWN)
		G_readyMatchState();
}
开发者ID:thewolfteam,项目名称:Reloaded,代码行数:52,代码来源:g_referee.c


示例19: G_Referee_v

// *** Referee voting ***
int G_Referee_v( gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd ) {
	// Vote request (vote is being initiated)
	if ( arg ) {
		int pid;

		if ( !vote_allow_referee.integer && ent && !ent->client->sess.referee ) {
			G_voteDisableMessage( ent, arg );
			return( G_INVALID );
		}

		if ( !ent->client->sess.referee && level.numPlayingClients < 3 ) {
			G_refPrintf( ent, "Sorry, not enough clients in the game to vote for a referee" );
			return( G_INVALID );
		}

		if ( ent->client->sess.referee && trap_Argc() == 2 ) {
			G_playersMessage( ent );
			return( G_INVALID );
		} else if ( trap_Argc() == 2 ) {
			pid = ent - g_entities;
		} else if ( G_voteDescription( ent, fRefereeCmd, dwVoteIndex ) ) {
			return( G_INVALID );
		} else if ( ( pid = ClientNumberFromString( ent, arg2 ) ) == -1 )                                                                                        {
			return( G_INVALID );
		}

		if ( level.clients[pid].sess.referee ) {
			G_refPrintf( ent, "[lof]%s [lon]is already a referee!", level.clients[pid].pers.netname );
			return( -1 );
		}

		Com_sprintf( level.voteInfo.vote_value, VOTE_MAXSTRING, "%d", pid );
		Com_sprintf( arg2, VOTE_MAXSTRING, "%s", level.clients[pid].pers.netname );

		// Vote action (vote has passed)
	} else {
		// Voting in a new referee
		gclient_t *cl = &level.clients[atoi( level.voteInfo.vote_value )];

		if ( cl->pers.connected == CON_DISCONNECTED ) {
			AP( "print \"Player left before becoming referee\n\"" );
		} else {
			cl->sess.referee = RL_REFEREE;  // FIXME: Differentiate voted refs from passworded refs
			cl->sess.spec_invite = TEAM_AXIS | TEAM_ALLIES;
			AP( va( "cp \"%s^7 is now a referee\n\"", cl->pers.netname ) );
			ClientUserinfoChanged( atoi( level.voteInfo.vote_value ) );
		}
	}
	return( G_OK );
}
开发者ID:AdrienJaguenet,项目名称:Enemy-Territory,代码行数:51,代码来源:g_vote.c


示例20: G_UnMute_v

// *** Player Un-Mute ***
int G_UnMute_v( gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd ) {
	if ( fRefereeCmd ) {
		// handled elsewhere
		return( G_NOTFOUND );
	}

	// Vote request (vote is being initiated)
	if ( arg ) {
		int pid;

		if ( !vote_allow_muting.integer && ent && !ent->client->sess.referee ) {
			G_voteDisableMessage( ent, arg );
			return( G_INVALID );
		} else if ( G_voteDescription( ent, fRefereeCmd, dwVoteIndex ) ) {
			return( G_INVALID );
		} else if ( ( pid = ClientNumberFromString( ent, arg2 ) ) == -1 ) {
			return( G_INVALID );
		}

		if ( level.clients[pid].sess.referee ) {
			G_refPrintf( ent, "Can't vote to un-mute referees!" );
			return( G_INVALID );
		}

		if ( !level.clients[pid].sess.muted ) {
			G_refPrintf( ent, "Player is not muted!" );
			return( G_INVALID );
		}

		Com_sprintf( level.voteInfo.vote_value, VOTE_MAXSTRING, "%d", pid );
		Com_sprintf( arg2, VOTE_MAXSTRING, "%s", level.clients[pid].pers.netname );

		// Vote action (vote has passed)
	} else {
		int pid = atoi( level.voteInfo.vote_value );

		// Mute a player
		if ( level.clients[pid].sess.referee != RL_RCON ) {
			trap_SendServerCommand( pid, va( "cpm \"^3You have been un-muted\"" ) );
			level.clients[pid].sess.muted = qfalse;
			AP( va( "cp \"%s\n^3has been un-muted!\n\"", level.clients[pid].pers.netname ) );
			ClientUserinfoChanged( pid );
		} else {
			G_Printf( "Cannot un-mute a referee.\n" );
		}
	}

	return( G_OK );
}
开发者ID:AdrienJaguenet,项目名称:Enemy-Territory,代码行数:50,代码来源:g_vote.c



注:本文中的G_refPrintf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ G_sprint函数代码示例发布时间:2022-05-30
下一篇:
C++ G_realloc函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap