当前位置: 首页>>代码示例>>C++>>正文


C++ G_sprint函数代码示例

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


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

示例1: teamoverlay

void teamoverlay( )
{
    int votes;

    if ( match_in_progress )
    {
        G_sprint(self, 2, "%s %s\n", redtext("Teamoverlay"), OnOff(cvar("k_teamoverlay")));
        return;
    }

	// admin may turn this status alone on server...
	if ( !is_adm( self ) )
	{
		// Dont need to bother if less than 2 players
		if ( CountPlayers() < 2 )
		{
			G_sprint(self, 2, "You need at least 2 players to do this.\n");
			return;
		}
	}

	self->v.teamoverlay = !self->v.teamoverlay;

	G_bprint(2, "%s %s!%s\n", self->netname, 
			(self->v.teamoverlay ? redtext(va("votes for teamoverlay %s", OnOff(!cvar("k_teamoverlay")))) : 
							       redtext(va("withdraws %s teamoverlay vote", g_his(self)))),
			((votes = get_votes_req( OV_TEAMOVERLAY, true )) ? va(" (%d)", votes) : ""));

    vote_check_teamoverlay ();
}
开发者ID:deurk,项目名称:ktx,代码行数:30,代码来源:vote.c

示例2: Eng_SGUp

//=======================================
// TG Stuff
void Eng_SGUp(  )
{
    gedict_t *sg;
//    int numupg = 0;

    for ( sg = world; (sg = trap_find( sg, FOFS( s.v.classname ), "building_sentrygun" )); )
    {
	if ( sg->s.v.weapon == 3 && sg->s.v.ammo_shells == 144 && sg->s.v.ammo_rockets == 20
	     && sg->s.v.health == sg->s.v.max_health )
	    continue;

	sg->s.v.weapon = 3;
	sg->s.v.max_health = 216;
	sg->maxammo_shells = 144;
	sg->s.v.health = sg->s.v.max_health;
	sound( sg, 3, "weapons/turrset.wav", 1, 1 );
	sg->s.v.think = ( func_t ) lvl3_sentry_stand;
	sg->s.v.skin = 2;
	G_sprint( self, 2, "You have upgraded/fixed/reloaded sentrygun\n" );
	sg->s.v.ammo_shells = 144;
	sg->s.v.ammo_rockets = 20;
	return;
    }
    G_sprint( self, 2, "no sg to upgrade\n" );
}
开发者ID:MrPnut,项目名称:QHome,代码行数:27,代码来源:engineer.c

示例3: ResupplySetBot

void ResupplySetBot()
{
        int argc;
        char    value[1024];

        argc = trap_CmdArgc();
        if( argc != 3 )
        {
                if( tf_data.botResupplyBetweenKills)
                        G_sprint( self, 2, "Bot Resupply Between Kills: On\n" );
                else
                        G_sprint( self, 2, "Bot Resupply Between Kills: Off\n" );
		return;
        }

        if( tf_data.arena_mode )
        {
                tf_data.botResupplyBetweenKills = 0;
        }else
        {
              trap_CmdArgv( 2, value, sizeof( value ) );
              if( !strcmp(value,"on") )
                      tf_data.botResupplyBetweenKills = 1;
              else
                      tf_data.botResupplyBetweenKills = 0;
        }
        if( tf_data.botResupplyBetweenKills)
                G_sprint( self, 2, "Bot Resupply Between Kills: On\n" );
        else
                G_sprint( self, 2, "Bot Resupply Between Kills: Off\n" );

}
开发者ID:MrPnut,项目名称:QHome,代码行数:32,代码来源:ui.c

示例4: mctf

void mctf()
{
	if( match_in_progress && !k_matchLess )
		return;

	if ( !isCTF() ) {
		G_sprint ( self, 2, "Can't do this in non CTF mode\n" );
		return;
	}

	if ( !cvar("k_ctf_hook") && !cvar("k_ctf_runes") ) {
		G_sprint ( self, 2, "Already done\n" );
		return;
	}

	cvar_fset("k_ctf_hook", 0);
	cvar_fset("k_ctf_runes", 0);

	G_sprint ( self, 2, "%s turn off: %s\n", getname(self), redtext("hook & runes") );

	// In matchless mode, toggling runes and hook normally won't do anything since match is already in progress. Call this to handle this scenario.
	if (k_matchLess)
	{
		// If a player is carrying a rune when runes are disabled, get rid of it
		if (!cvar("k_ctf_runes")) {
			gedict_t * p;
			for (p = world; (p = find_plr(p)); ) {
				p->ctf_flag -= (p->ctf_flag & (CTF_RUNE_MASK));
				p->maxspeed = cvar("sv_maxspeed"); // Reset speed, in case was carrying haste
			}
		}
		SpawnRunes( 0 );
		AddHook ( false );
	}
}
开发者ID:deurk,项目名称:ktx,代码行数:35,代码来源:ctf.c

示例5: Engineer_UseSentryGun

//=========================================================================
// Engineer has used a Spanner on the SentryGun
void Engineer_UseSentryGun( gedict_t * gun )
{
    gedict_t *dist_checker;

    G_sprint( self, 2, "Level %.0f Sentry Gun has %.0f health, %.0f shells",
	      gun->s.v.weapon, gun->s.v.health, gun->s.v.ammo_shells );
    if ( gun->s.v.weapon == 3 )
    {
	G_sprint( self, 2, ", %.0f rockets", gun->s.v.ammo_rockets );
    }

    if ( gun->has_sentry &&  tg_data.tg_enabled )
	G_sprint( self, 2, ", static" );

    G_sprint( self, 2, "\n" );
    self->current_menu = MENU_ENGINEER_FIX_SENTRYGUN;
    self->menu_count = MENU_REFRESH_RATE;
    self->building = gun;
    dist_checker = spawn(  );
    dist_checker->s.v.classname = "timer";
    dist_checker->s.v.owner = EDICT_TO_PROG( self );
    dist_checker->s.v.enemy = EDICT_TO_PROG( gun );
    dist_checker->s.v.think = ( func_t ) CheckDistance;
    dist_checker->s.v.nextthink = g_globalvars.time + 0.3;
}
开发者ID:MrPnut,项目名称:QHome,代码行数:27,代码来源:engineer.c

示例6: BotSet

void BotSet()
{
        char    cmd_command[50];
        int argc;

        argc = trap_CmdArgc();

        if( argc < 3 )
        {
                return;
        }
        trap_CmdArgv( 2, cmd_command, sizeof( cmd_command ) );

        if( !strncmp(cmd_command,"max_yaw_speed",sizeof(cmd_command)))
        {
                if( argc == 3 )
                        G_sprint(self,2,"max_yaw_speed = %3.0f\n",max_yaw_per_sek);
                else
                {
                        trap_CmdArgv( 3, cmd_command, sizeof( cmd_command ) );
                        max_yaw_per_sek = atof(cmd_command);
                        if( max_yaw_per_sek < 10 )
                                max_yaw_per_sek = 10;

                        G_sprint(self,2,"max_yaw_speed set to %3.0f\n",max_yaw_per_sek);
                }
        
        }
        

}
开发者ID:MrPnut,项目名称:QHome,代码行数:31,代码来源:ui.c

示例7: ToggleMapLock

void ToggleMapLock ()
{
    float tmp;

    if( !is_adm( self ) )
        return;

    tmp = cvar( "k_lockmap" );

    if( tmp )
    {
		cvar_fset( "k_lockmap", 0 );

        if( !match_in_progress )
            G_bprint(2, "%s unlocks map\n", self->netname);
        else
            G_sprint(self, 2, "Map unlocked\n");

        return;
    }

	cvar_fset( "k_lockmap", 1 );

    if( !match_in_progress )
        G_bprint(2, "%s locks map\n", self->netname);
    else
        G_sprint(self, 2, "Map is locked\n");
}
开发者ID:deurk,项目名称:ktx,代码行数:28,代码来源:admin.c

示例8: TeamFortress_TeamShowMemberClasses

void TeamFortress_TeamShowMemberClasses( gedict_t * Player )
{
	gedict_t *e;
	int     found = 0;

	found = 0;

	for ( e = world; ( e = trap_find( e, FOFS( s.v.classname ), "player" ) ); )
	{
		if ( ( e->team_no == Player->team_no || !e->team_no ) && e != Player )
		{
			if ( e->s.v.model && e->s.v.model[0] )
			{
				if ( !found )
				{
					found = 1;
					G_sprint( Player, 2, "The other members of your team are:\n" );
				}
				G_sprint( Player, 2, "%s : ", e->s.v.netname );
				TeamFortress_PrintClassName( Player, e->playerclass, e->tfstate & 8 );
			}
		}
	}
	if ( !found )
		G_sprint( Player, 2, "There are no other players on your team.\n" );
}
开发者ID:MrPnut,项目名称:QHome,代码行数:26,代码来源:tforttm.c

示例9: DoKick

qbool DoKick(gedict_t *victim, gedict_t *kicker)
{
	if (!victim || !kicker)
		return false;

	if( victim == kicker )
	{
		G_bprint(2, "%s kicked %s\n", getname(kicker), g_himself( kicker ));

		// hehe
		G_sprint(kicker, 2, "Say \"bye\" and then type \"disconnect\" next time\n");

		stuffcmd(kicker, "disconnect\n");  // FIXME: stupid way

		if ( !FTE_sv )
			localcmd( "addip %s ban +30\n", cl_ip( victim ) ); // BAN for 30 seconds
	}
	else
	{
		if ( !is_can_kick(victim, kicker) )
			return false;

		G_bprint(2, "%s was kicked by %s\n", getname(victim), getname(kicker));

		G_sprint(victim, 2, "You were kicked from the server\n");

		stuffcmd(victim, "disconnect\n"); // FIXME: stupid way

		if ( !FTE_sv )
			localcmd( "addip %s ban +30\n", cl_ip( victim ) ); // BAN for 30 seconds
	}

	return true;
}
开发者ID:deurk,项目名称:ktx,代码行数:34,代码来源:admin.c

示例10: antilag

void antilag( )
{
    int votes;
	
	if ( match_in_progress )
	{
        G_sprint(self, 2, "%s mode %s\n", redtext("Antilag"), OnOff(2 == cvar("sv_antilag")));
        return;
	}

	// admin may turn this status alone on server...
	if ( !is_adm( self ) )
	{
		// Dont need to bother if less than 2 players
		if ( CountPlayers() < 2 )
		{
			G_sprint(self, 2, "You need at least 2 players to do this.\n");
			return;
		}
	}

	self->v.antilag = !self->v.antilag;

	G_bprint(2, "%s %s!%s\n", self->s.v.netname, 
			(self->v.antilag ? redtext(va("votes for antilag %s", OnOff(!(2 == cvar("sv_antilag"))))) : 
							   redtext(va("withdraws %s antilag vote", g_his(self)))),
			((votes = get_votes_req( OV_ANTILAG, true )) ? va(" (%d)", votes) : ""));

	vote_check_antilag ();
}
开发者ID:QuakePhil,项目名称:ktx-hoonymode,代码行数:30,代码来源:vote.c

示例11: VoteYes

void VoteYes()
{
	int votes;

	if( !get_votes( OV_ELECT ) )
		return;

	if( self->v.elect_type != etNone ) {
		G_sprint(self, 2, "You cannot vote for yourself\n");
		return;
	}

	if( self->v.elect ) {
		G_sprint(self, 2, "--- your vote is still good ---\n");
		return;
	}

// register the vote
	self->v.elect = 1;

	G_bprint(2, "%s gives %s vote\n", self->s.v.netname, g_his( self ));

// calculate how many more votes are needed
	if ( (votes = get_votes_req( OV_ELECT, true )) )
		G_bprint(2, "\x90%d\x91 more vote%s needed\n", votes, count_s( votes ));

	vote_check_elect ();
}
开发者ID:QuakePhil,项目名称:ktx-hoonymode,代码行数:28,代码来源:vote.c

示例12: nospecs

void nospecs( )
{
    int votes;
	
	if ( match_in_progress )
	{
        G_sprint(self, 2, "%s mode %s\n", redtext("No spectators"), OnOff(cvar("_k_nospecs")));
        return;
	}

	// admin may turn this status alone on server...
	if ( !is_adm( self ) )
	{
		// Dont need to bother if less than 2 players
		if ( CountPlayers() < 2 )
		{
			G_sprint(self, 2, "You need at least 2 players to do this.\n");
			return;
		}
	}

	self->v.nospecs = !self->v.nospecs;

	G_bprint(2, "%s %s!%s\n", self->s.v.netname, 
			(self->v.nospecs ? redtext(va("votes for nospecs %s", OnOff(!cvar("_k_nospecs")))) : 
							   redtext(va("withdraws %s nospecs vote", g_his(self)))),
			((votes = get_votes_req( OV_NOSPECS, true )) ? va(" (%d)", votes) : ""));

	vote_check_nospecs ();
}
开发者ID:QuakePhil,项目名称:ktx-hoonymode,代码行数:30,代码来源:vote.c

示例13: NextClient

void NextClient ()
{
	int from = 0;

	if( !self->k_kicking )
		return;

	self->k_playertokick = (self->k_playertokick ? self->k_playertokick : world);
	from = ( self->k_playertokick != world && self->k_playertokick->ct == ctSpec );
	self->k_playertokick = find_plrspc(self->k_playertokick, &from);

	if ( !self->k_playertokick ) {  // try find anyone at least
		from = 0;
		self->k_playertokick = find_plrspc(world, &from);
	}

	if ( !self->k_playertokick ) {
		G_sprint(self, 2, "Can't find anybody to kick\n");
		ExitKick ( self );
		return;
	}

    G_sprint(self, 2, "Kick %s %s?\n", 
					redtext(self->k_playertokick->ct == ctPlayer ? "player" : "spectator"),	getname(self->k_playertokick));
}
开发者ID:deurk,项目名称:ktx,代码行数:25,代码来源:admin.c

示例14: Vote_Cmd

void Vote_Cmd()
{
        char    cmd_command[50];
        int argc,i;
        const vote_t*ucmd;

	if ( tf_data.cb_prematch_time > g_globalvars.time )
	{
		return;
	}

	argc = trap_CmdArgc();
	
	if( argc != 2 )
	{
	        G_sprint( self, 2, "Avaliable votes:\n");
		for ( ucmd = votes ; ucmd->command  ; ucmd++ )
		{
			G_sprint( self, 2, "%s\n",ucmd->command);
		}
		return;
	}

	trap_CmdArgv( 1, cmd_command, sizeof( cmd_command ) );
	if( current_vote != -1 )
	{
		if(!strcmp(cmd_command,"yes"))
		{
		        votes[current_vote].VoteYes();
			return;
		}

		if(!strcmp(cmd_command,"no"))
		{
		        votes[current_vote].VoteNo();
			return;
		}
		G_sprint( self, 2, "Vote %s in progress\n",votes[current_vote].command);
	        return;
	}
	if( g_globalvars.time < self->last_vote_time )
	{
		G_sprint( self, 2, "You cannot vote at this time.\n");
		return;
	}
	for ( ucmd = votes,i=0 ; ucmd->command  ; ucmd++,i++ )
	{
		if( !strcmp(cmd_command,ucmd->command) )
		{
		        current_vote = i;
		        self->last_vote_time = g_globalvars.time + votes[current_vote].pause * 60;
			ucmd->VoteInit();
			return;
		}
	}
	G_sprint( self, 2, "Unknown vote.\n");
}
开发者ID:MrPnut,项目名称:QHome,代码行数:57,代码来源:vote.c

示例15: TeamFortress_SpyGoUndercover

//=========================================================================
// If its a net game, the SPY goes invisible.
// If its a LAN game, the class/skin changing menu pops up.
void TeamFortress_SpyGoUndercover(  )
{
	gedict_t *te;


	if ( tf_data.invis_only == 1 )
	{
	        // If the spy is already invisible, become visible
		if ( ( int ) self->s.v.effects & ( EF_DIMLIGHT | EF_BRIGHTLIGHT ) )
		{
			G_sprint( self, 1, "You cannot disguise while glowing.\n" );
			return;
		}
		if ( self->is_unabletospy == 1 )
		{
			G_sprint( self, 2, "You can't go undercover right now.\n" );
			return;
		}
		if ( self->is_undercover == 1 )
		{
			self->is_undercover = 0;
			self->s.v.modelindex = modelindex_player; // return to normal
			self->s.v.items = ( int ) self->s.v.items - ( ( int ) self->s.v.items & IT_INVISIBILITY );
		} else
		{
			if ( self->is_undercover == 2 )
			{
				G_sprint( self, 2, "You stop going undercover.\n" );
				self->is_undercover = 0;
			} else
			{
				if ( self->s.v.ammo_cells > 1 )
				{
					G_sprint( self, 2, "Going undercover...\n" );
					self->is_undercover = 2;
					te = spawn(  );
					te->s.v.classname = "timer";
					te->s.v.owner = EDICT_TO_PROG( self );
					te->s.v.think = ( func_t ) TeamFortress_SpyUndercoverThink;
					te->s.v.nextthink = g_globalvars.time + .01;
				}
			}
		}
		self->StatusRefreshTime = g_globalvars.time + 0.1;
	} else
	{
		if ( self->is_undercover != 2 )
		{
			self->current_menu = MENU_SPY;
			self->menu_count = MENU_REFRESH_RATE;
		} else
		{
			G_sprint( self, 2, "You stop going undercover.\n" );
			self->is_undercover = 0;
		}
	}
}
开发者ID:MrPnut,项目名称:QHome,代码行数:60,代码来源:spy.c


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