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

C++ CheatsOk函数代码示例

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

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



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

示例1: Cmd_LevelShot_f

/*
==================
Cmd_LevelShot_f

This is just to help generate the level pictures
for the menus.  It goes to the intermission immediately
and sends over a command to the client to resize the view,
hide the scoreboard, and take a special screenshot
==================
*/
void Cmd_LevelShot_f( gentity_t *ent ) {
	if ( !CheatsOk( ent ) ) {
		return;
	}

	gi.SendServerCommand( ent-g_entities, "clientLevelShot" );
}
开发者ID:PJayB,项目名称:jk2src,代码行数:17,代码来源:g_cmds.cpp


示例2: Cmd_SetObjective_f

/*
=================
Cmd_SetObjective_f
=================
*/
void Cmd_SetObjective_f( gentity_t *ent ) 
{
	int objectiveI,status,displayStatus;

	if ( gi.argc() == 2 ) {
		objectiveI = atoi(gi.argv(1));
		gi.Printf("objective #%d  display status=%d, status=%d\n",objectiveI, 
			ent->client->sess.mission_objectives[objectiveI].display,
			ent->client->sess.mission_objectives[objectiveI].status
			);
		return;
	}
	if ( gi.argc() != 4 ) {
		gi.SendServerCommand( ent-g_entities, va("print \"usage: setobjective <objective #>  <display status> <status>\n\""));
		return;
	}

	if ( !CheatsOk( ent ) ) 
	{
		return;
	}

	objectiveI = atoi(gi.argv(1));
	displayStatus = atoi(gi.argv(2));
	status = atoi(gi.argv(3));

	ent->client->sess.mission_objectives[objectiveI].display = displayStatus;
	ent->client->sess.mission_objectives[objectiveI].status = status;
}
开发者ID:PJayB,项目名称:jk2src,代码行数:34,代码来源:g_cmds.cpp


示例3: Cmd_Give_f

void Cmd_Give_f( gentity_t *ent )
{
	if ( !CheatsOk( ent ) ) {
		return;
	}

	G_Give( ent, gi.argv(1), ConcatArgs( 2 ), gi.argc() );
}
开发者ID:archSeer,项目名称:OpenJK,代码行数:8,代码来源:g_cmds.cpp


示例4: Cmd_LevelShot_f

/*
==================
Cmd_LevelShot_f

This is just to help generate the level pictures
for the menus.  It goes to the intermission immediately
and sends over a command to the client to resize the view,
hide the scoreboard, and take a special screenshot
==================
*/
void Cmd_LevelShot_f( gentity_t *ent ) {
	if ( !CheatsOk( ent ) ) {
		return;
	}

	// doesn't work in single player
	if ( g_gametype.integer != 0 ) {
		trap_SendServerCommand( ent-g_entities, 
			"print \"Must be in g_gametype 0 for levelshot\n\"" );
		return;
	}

	BeginIntermission();
	trap_SendServerCommand( ent-g_entities, "clientLevelShot" );
}
开发者ID:BrendanCoughran,项目名称:ioquake3,代码行数:25,代码来源:g_cmds.c


示例5: argv

/*
==================
Cmd_Notarget_f

Sets client to notarget

argv(0) notarget
==================
*/
void Cmd_Notarget_f( gentity_t *ent ) {
	char	*msg;

	if ( !CheatsOk( ent ) ) {
		return;
	}

	ent->flags ^= FL_NOTARGET;
	if (!(ent->flags & FL_NOTARGET) )
		msg = "notarget OFF\n";
	else
		msg = "notarget ON\n";

	gi.SendServerCommand( ent-g_entities, "print \"%s\"", msg);
}
开发者ID:PJayB,项目名称:jk2src,代码行数:24,代码来源:g_cmds.cpp


示例6: Cmd_Notarget_f

/*
 * Cmd_Notarget_f
 *
 * Sets client to notarget
 *
 * argv(0) notarget
 */
void
Cmd_Notarget_f(Gentity *ent)
{
	char *msg;

	if(!CheatsOk(ent))
		return;

	ent->flags ^= FL_NOTARGET;
	if(!(ent->flags & FL_NOTARGET))
		msg = "notarget OFF\n";
	else
		msg = "notarget ON\n";

	trap_SendServerCommand(ent-g_entities, va("print \"%s\"", msg));
}
开发者ID:icanhas,项目名称:yantar,代码行数:23,代码来源:cmds.c


示例7: Cmd_God_f

/*
 * Cmd_God_f
 *
 * Sets client to godmode
 *
 * argv(0) god
 */
void
Cmd_God_f(Gentity *ent)
{
	char *msg;

	if(!CheatsOk(ent))
		return;

	ent->flags ^= FL_GODMODE;
	if(!(ent->flags & FL_GODMODE))
		msg = "godmode OFF\n";
	else
		msg = "godmode ON\n";

	trap_SendServerCommand(ent-g_entities, va("print \"%s\"", msg));
}
开发者ID:icanhas,项目名称:yantar,代码行数:23,代码来源:cmds.c


示例8: Cmd_Noclip_f

/*
 * Cmd_Noclip_f
 *
 * argv(0) noclip
 */
void
Cmd_Noclip_f(Gentity *ent)
{
	char *msg;

	if(!CheatsOk(ent))
		return;

	if(ent->client->noclip)
		msg = "noclip OFF\n";
	else
		msg = "noclip ON\n";
	ent->client->noclip = !ent->client->noclip;

	trap_SendServerCommand(ent-g_entities, va("print \"%s\"", msg));
}
开发者ID:icanhas,项目名称:yantar,代码行数:21,代码来源:cmds.c


示例9: Cmd_LevelShot_f

/*
==================
Cmd_LevelShot_f

This is just to help generate the level pictures
for the menus.  It goes to the intermission immediately
and sends over a command to the client to resize the view,
hide the scoreboard, and take a special screenshot
==================
*/
void Cmd_LevelShot_f(gentity_t *ent)
{
	if(!ent->client->pers.localClient)
	{
		trap_SendServerCommand(ent-g_entities,
			"print \"The levelshot command must be executed by a local client\n\"");
		return;
	}

	if(!CheatsOk(ent))
		return;

	// doesn't work in single player
	if(g_gametype.integer == GT_SINGLE_PLAYER)
	{
		trap_SendServerCommand(ent-g_entities,
			"print \"Must not be in singleplayer mode for levelshot\n\"" );
		return;
	}

	BeginIntermission();
	trap_SendServerCommand(ent-g_entities, "clientLevelShot");
}
开发者ID:MasaMune692,项目名称:alcexamples,代码行数:33,代码来源:g_cmds.c


示例10: Cmd_Give_f

/*
 * Cmd_Give_f
 *
 * Give items to a client
 */
void
Cmd_Give_f(Gentity *ent)
{
	char	*name;
	Gitem *it;
	int	i;
	qbool		give_all;
	Gentity *it_ent;
	Trace		trace;

	if(!CheatsOk(ent))
		return;

	name = ConcatArgs(1);

	if(Q_stricmp(name, "all") == 0)
		give_all = qtrue;
	else
		give_all = qfalse;

	if(give_all || Q_stricmp(name, "health") == 0){
		ent->health = ent->client->ps.stats[STAT_MAX_HEALTH];
		if(!give_all)
			return;
	}

	if(give_all || Q_stricmp(name, "weapons") == 0){
		/*
		 * Give all weapons except hook and Wnone
		 */
		ent->client->ps.stats[STAT_PRIWEAPS] =
			(1<<Wnumweaps) 
			- 1 - (1<<Whook) - (1<<Wnone);
		ent->client->ps.stats[STAT_SECWEAPS] =
			(1<<Wnumweaps) 
			- 1 - (1<<Whook) - (1<<Wnone);
		if(!give_all)
			return;
	}

	if(give_all || Q_stricmp(name, "ammo") == 0){
		for(i = Wnone+1; i < Wnumweaps; i++)
			if(i != Whook && i != Wmelee)
				ent->client->ps.ammo[i] = 5000;
		if(!give_all)
			return;
	}

	if(give_all || Q_stricmp(name, "armor") == 0){
		ent->client->ps.stats[STAT_SHIELD] = 5000;

		if(!give_all)
			return;
	}

	if(Q_stricmp(name, "excellent") == 0){
		ent->client->ps.persistant[PERS_EXCELLENT_COUNT]++;
		return;
	}
	if(Q_stricmp(name, "impressive") == 0){
		ent->client->ps.persistant[PERS_IMPRESSIVE_COUNT]++;
		return;
	}
	if(Q_stricmp(name, "gauntletaward") == 0){
		ent->client->ps.persistant[PERS_GAUNTLET_FRAG_COUNT]++;
		return;
	}
	if(Q_stricmp(name, "defend") == 0){
		ent->client->ps.persistant[PERS_DEFEND_COUNT]++;
		return;
	}
	if(Q_stricmp(name, "assist") == 0){
		ent->client->ps.persistant[PERS_ASSIST_COUNT]++;
		return;
	}

	/* spawn a specific item right on the player */
	if(!give_all){
		it = BG_FindItem(name);
		if(!it)
			return;

		it_ent = G_Spawn();
		copyv3(ent->r.currentOrigin, it_ent->s.origin);
		it_ent->classname = it->classname;
		G_SpawnItem (it_ent, it);
		FinishSpawningItem(it_ent);
		memset(&trace, 0, sizeof(trace));
		Touch_Item (it_ent, ent, &trace);
		if(it_ent->inuse)
			G_FreeEntity(it_ent);
	}
}
开发者ID:icanhas,项目名称:yantar,代码行数:98,代码来源:cmds.c


示例11: Cmd_Give_f

/*
==================
Cmd_Give_f

Give items to a client
==================
*/
void Cmd_Give_f (gentity_t *ent)
{
	char		*name;
	gitem_t		*it;
	int			i;
	qboolean	give_all;
	gentity_t		*it_ent;
	trace_t		trace;

	if ( !CheatsOk( ent ) ) {
		return;
	}

	name = ConcatArgs( 1 );

	if (Q_stricmp(name, "all") == 0)
		give_all = qtrue;
	else
		give_all = qfalse;

	if (give_all || Q_stricmp(name, "force") == 0)
	{
		if ( ent->client )
		{
			ent->client->ps.forcePower = FORCE_POWER_MAX;
		}
		if (!give_all)
			return;
	}

	if (give_all || Q_stricmp(gi.argv(1), "health") == 0)
	{
		if (gi.argc() == 3) {
			ent->health = atoi(gi.argv(2));
			if (ent->health > ent->client->ps.stats[STAT_MAX_HEALTH]) {
				ent->health = ent->client->ps.stats[STAT_MAX_HEALTH];
			}
		}
		else {
			ent->health = ent->client->ps.stats[STAT_MAX_HEALTH];
		}
		if (!give_all)
			return;
	}


	if (give_all || Q_stricmp(name, "inventory") == 0)
	{
		// Huh?  Was doing a INV_MAX+1 which was wrong because then you'd actually have every inventory item including INV_MAX
		ent->client->ps.stats[STAT_ITEMS] = (1 << (INV_MAX)) - ( 1 << INV_ELECTROBINOCULARS );

		ent->client->ps.inventory[INV_ELECTROBINOCULARS] = 1;
		ent->client->ps.inventory[INV_BACTA_CANISTER] = 5;
		ent->client->ps.inventory[INV_SEEKER] = 5;
		ent->client->ps.inventory[INV_LIGHTAMP_GOGGLES] = 1;
		ent->client->ps.inventory[INV_SENTRY] = 5;
		ent->client->ps.inventory[INV_GOODIE_KEY] = 5;
		ent->client->ps.inventory[INV_SECURITY_KEY] = 5;

		if (!give_all)
		{
			return;
		}
	}

	if (give_all || Q_stricmp(name, "weapons") == 0)
	{
		ent->client->ps.stats[STAT_WEAPONS] = (1 << (MAX_PLAYER_WEAPONS+1)) - ( 1 << WP_NONE );
//		ent->client->ps.stats[STAT_WEAPONS] |= (1 << (WP_MELEE));
		if (!give_all)
			return;
	}

	if ( !give_all && Q_stricmp(gi.argv(1), "weaponnum") == 0 )
	{
		ent->client->ps.stats[STAT_WEAPONS] |= (1 << atoi(gi.argv(2)));
		return;
	}

	if ( Q_stricmp(name, "eweaps") == 0)	//for developing, gives you all the weapons, including enemy
	{
		ent->client->ps.stats[STAT_WEAPONS] = (unsigned)(1 << WP_NUM_WEAPONS) - ( 1 << WP_NONE ); // NOTE: this wasn't giving the last weapon in the list
		if (!give_all)
			return;
	}

	if (give_all || Q_stricmp(name, "ammo") == 0)
	{
		for ( i = 0 ; i < AMMO_MAX ; i++ ) {
			ent->client->ps.ammo[i] = ammoData[i].max;
		}
		if (!give_all)
			return;
//.........这里部分代码省略.........
开发者ID:PJayB,项目名称:jk2src,代码行数:101,代码来源:g_cmds.cpp


示例12: ClientCommand

/*
=================
ClientCommand
=================
*/
void ClientCommand( int clientNum ) {
	gentity_t *ent;
	char	*cmd;

	ent = g_entities + clientNum;
	if ( !ent->client ) {
		return;		// not fully in game yet
	}

	cmd = gi.argv(0);

	if (Q_stricmp (cmd, "spawn") == 0)
	{
		Cmd_Spawn( ent );
		return;
	}
	
	if (Q_stricmp (cmd, "give") == 0)
		Cmd_Give_f (ent);
	else if (Q_stricmp (cmd, "god") == 0)
		Cmd_God_f (ent);
	else if (Q_stricmp (cmd, "undying") == 0)
		Cmd_Undying_f (ent);
	else if (Q_stricmp (cmd, "notarget") == 0)
		Cmd_Notarget_f (ent);
	else if (Q_stricmp (cmd, "noclip") == 0)
	{
		Cmd_Noclip_f (ent);
	}
	else if (Q_stricmp (cmd, "kill") == 0)
	{
		if ( !CheatsOk( ent ) )
		{
			return;
		}
		Cmd_Kill_f (ent);
	}
	else if (Q_stricmp (cmd, "levelshot") == 0)
		Cmd_LevelShot_f (ent);
	else if (Q_stricmp (cmd, "where") == 0)
		Cmd_Where_f (ent);
	else if (Q_stricmp (cmd, "setviewpos") == 0)
		Cmd_SetViewpos_f( ent );
	else if (Q_stricmp (cmd, "setobjective") == 0)
		Cmd_SetObjective_f( ent );
	else if (Q_stricmp (cmd, "viewobjective") == 0)
		Cmd_ViewObjective_f( ent );
	else if (Q_stricmp (cmd, "force_throw") == 0)
	{
		ent = G_GetSelfForPlayerCmd();
		ForceThrow( ent, qfalse );
	}
	else if (Q_stricmp (cmd, "force_pull") == 0)
	{
		ent = G_GetSelfForPlayerCmd();
		ForceThrow( ent, qtrue );
	}
	else if (Q_stricmp (cmd, "force_speed") == 0)
	{
		ent = G_GetSelfForPlayerCmd();
		ForceSpeed( ent );
	}
	else if (Q_stricmp (cmd, "force_heal") == 0)
	{
		ent = G_GetSelfForPlayerCmd();
		ForceHeal( ent );
	}
	else if (Q_stricmp (cmd, "force_grip") == 0)
	{
		ent = G_GetSelfForPlayerCmd();
		ForceGrip( ent );
	}
	else if (Q_stricmp (cmd, "force_distract") == 0)
	{
		ent = G_GetSelfForPlayerCmd();
		ForceTelepathy( ent );
	}
	else if (Q_stricmp (cmd, "taunt") == 0)
	{
		ent = G_GetSelfForPlayerCmd();
		G_Taunt( ent );
	}
	else if (Q_stricmp (cmd, "victory") == 0)
		G_Victory( ent );
//	else if (Q_stricmp (cmd, "use_shield") == 0)	// sounds like the design doc states that the shields will be a pickup and so the player never decides whether to use them or not.
//		G_ActivatePersonalShield( ent );			//	If you want shields (armor),  type "give all" or "give armor" or "give armor #amt#"
	else if (Q_stricmp (cmd, "fly_xwing") == 0)
		G_PilotXWing( ent );
	else if (Q_stricmp (cmd, "drive_atst") == 0)
	{
		if ( CheatsOk( ent ) )
		{
			G_DriveATST( ent, NULL );
		}
	}
//.........这里部分代码省略.........
开发者ID:PJayB,项目名称:jk2src,代码行数:101,代码来源:g_cmds.cpp


示例13: ClientCommand

/*
=================
ClientCommand
=================
*/
void ClientCommand( int clientNum ) {
	gentity_t *ent;
	const char	*cmd;

	ent = g_entities + clientNum;
	if ( !ent->client ) {
		return;		// not fully in game yet
	}

	cmd = gi.argv(0);

	if (Q_stricmp (cmd, "spawn") == 0)
	{
		Cmd_Spawn( ent );
		return;
	}
	
	if (Q_stricmp (cmd, "give") == 0)
		Cmd_Give_f (ent);
	else if (Q_stricmp (cmd, "god") == 0)
		Cmd_God_f (ent);
	else if (Q_stricmp (cmd, "undying") == 0)
		Cmd_Undying_f (ent);
	else if (Q_stricmp (cmd, "notarget") == 0)
		Cmd_Notarget_f (ent);
	else if (Q_stricmp (cmd, "noclip") == 0)
	{
		Cmd_Noclip_f (ent);
	}
	else if (Q_stricmp (cmd, "kill") == 0)
	{
		if ( !CheatsOk( ent ) )
		{
			return;
		}
		Cmd_Kill_f (ent);
	}
	else if (Q_stricmp (cmd, "levelshot") == 0)
		Cmd_LevelShot_f (ent);
	else if (Q_stricmp (cmd, "where") == 0)
		Cmd_Where_f (ent);
	else if (Q_stricmp (cmd, "setviewpos") == 0)
		Cmd_SetViewpos_f( ent );
	else if (Q_stricmp (cmd, "setobjective") == 0)
		Cmd_SetObjective_f( ent );
	else if (Q_stricmp (cmd, "viewobjective") == 0)
		Cmd_ViewObjective_f( ent );
	else if (Q_stricmp (cmd, "force_throw") == 0)
	{
		ent = G_GetSelfForPlayerCmd();
		ForceThrow( ent, qfalse );
	}
	else if (Q_stricmp (cmd, "force_pull") == 0)
	{
		ent = G_GetSelfForPlayerCmd();
		ForceThrow( ent, qtrue );
	}
	else if (Q_stricmp (cmd, "force_speed") == 0)
	{
		ent = G_GetSelfForPlayerCmd();
		ForceSpeed( ent );
	}
	else if (Q_stricmp (cmd, "force_heal") == 0)
	{
		ent = G_GetSelfForPlayerCmd();
		ForceHeal( ent );
	}
	else if (Q_stricmp (cmd, "force_grip") == 0)
	{
		ent = G_GetSelfForPlayerCmd();
		ForceGrip( ent );
	}
	else if (Q_stricmp (cmd, "force_distract") == 0)
	{
		ent = G_GetSelfForPlayerCmd();
		ForceTelepathy( ent );
	}
	else if (Q_stricmp (cmd, "force_rage") == 0)
	{
		ent = G_GetSelfForPlayerCmd();
		ForceRage(ent);
	}
	else if (Q_stricmp (cmd, "force_protect") == 0)
	{
		ent = G_GetSelfForPlayerCmd();
		ForceProtect(ent);
	}
	else if (Q_stricmp (cmd, "force_absorb") == 0)
	{
		ent = G_GetSelfForPlayerCmd();
		ForceAbsorb(ent);
	}
	else if (Q_stricmp (cmd, "force_sight") == 0)
	{
		ent = G_GetSelfForPlayerCmd();
//.........这里部分代码省略.........
开发者ID:archSeer,项目名称:OpenJK,代码行数:101,代码来源:g_cmds.cpp


示例14: Cmd_Give_f

/*
==================
Cmd_Give_f

Give items to a client
==================
*/
void Cmd_Give_f (gentity_t *ent)
{
	char		*name;
	gitem_t		*it;
	int			i;
	qboolean	give_all;
	gentity_t		*it_ent;
	trace_t		trace;

	if ( !CheatsOk( ent ) ) {
		return;
	}

	name = ConcatArgs( 1 );

	if (Q_stricmp(name, "all") == 0)
		give_all = qtrue;
	else
		give_all = qfalse;

	if (give_all || Q_stricmp( name, "health") == 0)
	{
		ent->health = ent->client->ps.stats[STAT_MAX_HEALTH];
		if (!give_all)
			return;
	}

	if (give_all || Q_stricmp(name, "weapons") == 0)
	{
		ent->client->ps.stats[STAT_WEAPONS] = (1 << WP_NUM_WEAPONS) - 1 - 
			( 1 << WP_GRAPPLING_HOOK ) - ( 1 << WP_NONE );
		if (!give_all)
			return;
	}

	if (give_all || Q_stricmp(name, "ammo") == 0)
	{
		for ( i = 0 ; i < MAX_WEAPONS ; i++ ) {
			ent->client->ps.ammo[i] = 999;
		}
		if (!give_all)
			return;
	}

	if (give_all || Q_stricmp(name, "armor") == 0)
	{
		ent->client->ps.stats[STAT_ARMOR] = 200;

		if (!give_all)
			return;
	}

	if (Q_stricmp(name, "excellent") == 0) {
		ent->client->ps.persistant[PERS_EXCELLENT_COUNT]++;
		return;
	}
	if (Q_stricmp(name, "impressive") == 0) {
		ent->client->ps.persistant[PERS_IMPRESSIVE_COUNT]++;
		return;
	}
	if (Q_stricmp(name, "gauntletaward") == 0) {
		ent->client->ps.persistant[PERS_GAUNTLET_FRAG_COUNT]++;
		return;
	}
	if (Q_stricmp(name, "defend") == 0) {
		ent->client->ps.persistant[PERS_DEFEND_COUNT]++;
		return;
	}
	if (Q_stricmp(name, "assist") == 0) {
		ent->client->ps.persistant[PERS_ASSIST_COUNT]++;
		return;
	}

	// spawn a specific item right on the player
	if ( !give_all ) {
		it = BG_FindItem (name);
		if (!it) {
			return;
		}

		it_ent = G_Spawn();
		VectorCopy( ent->r.currentOrigin, it_ent->s.origin );
		it_ent->classname = it->classname;
		G_SpawnItem (it_ent, it);
		FinishSpawningItem(it_ent );
		memset( &trace, 0, sizeof( trace ) );
		Touch_Item (it_ent, ent, &trace);
		if (it_ent->inuse) {
			G_FreeEntity( it_ent );
		}
	}
}
开发者ID:MasaMune692,项目名称:alcexamples,代码行数:99,代码来源:g_cmds.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ Check函数代码示例发布时间:2022-05-30
下一篇:
C++ ChatHandler函数代码示例发布时间: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