您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ AP函数代码示例

51自学网 2021-06-01 19:35:14
  C++
这篇教程C++ AP函数代码示例写得很实用,希望能帮到您。

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

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

示例1: G_MapRestart_v

// *** Map Restart ***int G_MapRestart_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;			}		}		// Vote action (vote has passed)	}	else	{		// Restart the map back to warmup		Svcmd_ResetMatch_f(qfalse, qtrue);		AP("cp /"^1*** Level Restarted! ***/n/"");	}	return G_OK;}
开发者ID:dstaesse,项目名称:etlegacy,代码行数:26,


示例2: includePointTriangle

  // Checks whether 3D points p lies inside or outside of the triangle ABC  bool includePointTriangle(Vec3r& P,			    Vec3r& A,			    Vec3r& B,			    Vec3r& C) {    Vec3r AB(B - A);    Vec3r BC(C - B);    Vec3r CA(A - C);    Vec3r AP(P - A);    Vec3r BP(P - B);    Vec3r CP(P - C);    Vec3r N(AB ^ BC); // triangle's normal    N.normalize();    Vec3r J(AB ^ AP), K(BC ^ BP), L(CA ^ CP);    J.normalize();    K.normalize();    L.normalize();    if(J * N < 0)      return false; // on the right of AB    if(K * N < 0)      return false; // on the right of BC    if(L * N < 0)      return false; // on the right of CA    return true;  }
开发者ID:GodZza,项目名称:contours,代码行数:32,


示例3: G_Pub_v

// *** Load public settings for current mode ***int G_Pub_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_pub.integer <= 0 && ent && !ent->client->sess.referee)		{			G_voteDisableMessage(ent, arg);			return(G_INVALID);		}		// Vote action (vote has passed)	}	else	{		// Load in pub settings for current gametype		G_configSet(g_gametype.integer, qfalse);		AP("cpm /"Public Settings Loaded!/n/"");	}	return(G_OK);}
开发者ID:BulldogDrummond,项目名称:etlegacy-mysql,代码行数:28,


示例4: G_MatchReset_v

// *** Match Restart ***int G_MatchReset_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd){	// Vote request (vote is being initiated)	if (arg)	{		if (!vote_allow_matchreset.integer && ent && !ent->client->sess.referee)		{			G_voteDisableMessage(ent, arg);			return(G_INVALID);		}		else if (trap_Argc() != 2 && G_voteDescription(ent, fRefereeCmd, dwVoteIndex))		{			return(G_INVALID);		}		// Vote action (vote has passed)	}	else	{		// Restart the map back to warmup		Svcmd_ResetMatch_f(qtrue, qtrue);		AP("cp /"^1*** Match Reset! ***/n/"");	}	return(G_OK);}
开发者ID:BulldogDrummond,项目名称:etlegacy-mysql,代码行数:27,


示例5: 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:Kajos,项目名称:RTCW.ET.Rift,代码行数:48,


示例6: G_ready_cmd

// ************** READY / NOTREADY//// Sets a player's "ready" status.void G_ready_cmd( gentity_t *ent, unsigned int dwCommand, qboolean state ) {	char *status[2] = { " NOT", "" };	if ( g_gamestate.integer == GS_PLAYING || g_gamestate.integer == GS_INTERMISSION ) {		CP( "cpm /"Match is already in progress!/n/"" );		return;	}	if ( !state && g_gamestate.integer == GS_WARMUP_COUNTDOWN ) {		CP( "cpm /"Countdown started.... ^3notready^7 ignored!/n/"" );		return;	}	if ( ent->client->sess.sessionTeam == TEAM_SPECTATOR ) {		CP( "cpm /"You must be in the game to be ^3ready^7!/n/"" );		return;	}	// Can't ready until enough players.	if ( level.numPlayingClients < match_minplayers.integer ) {		CP( "cpm /"Not enough players to start match!/n/"" );		return;	}	if ( !G_cmdDebounce( ent, aCommandInfo[dwCommand].pszCommandName ) ) {		return;	}	// Move them to correct ready state	if ( ent->client->pers.ready == state ) {		CP( va( "print /"You are already%s ready!/n/"", status[state] ) );	} else {		ent->client->pers.ready = state;		if ( !level.intermissiontime ) {			if ( state ) {				G_MakeReady( ent );			} else {				G_MakeUnready( ent );			}			AP( va( "print /"%s^7 is%s ready!/n/"", ent->client->pers.netname, status[state] ) );			AP( va( "cp /"/n%s/n^3is%s ready!/n/"", ent->client->pers.netname, status[state] ) );		}	}	G_readyMatchState();}
开发者ID:jussirantala,项目名称:TrueCombat,代码行数:50,


示例7: A0

//.......................................................// New speed up method to Cache time integralsvoid Bs2JpsiPhi_SignalAlt_MO_v4::CacheAmplitudesAndAngles() {		CachedA1 = A0()*A0() * angleFactorA0A0( ) ;	CachedA2 = AP()*AP() * angleFactorAPAP( ) ;	CachedA3 = AT()*AT() * angleFactorATAT( ) ;		CachedA4 = AP()*AT() * angleFactorImAPAT( ) ;	CachedA5 = A0()*AP() * angleFactorReA0AP( ) ;	CachedA6 = A0()*AT() * angleFactorImA0AT( ) ;		CachedA7 = AS()*AS() * angleFactorASAS( ) ;		CachedA8 = AS()*AP() * angleFactorReASAP( ) ;	CachedA9 = AS()*AT() * angleFactorImASAT( ) ;	CachedA10= AS()*A0() * angleFactorReASA0( ) ;		}
开发者ID:abmorris,项目名称:RapidFit,代码行数:19,


示例8: attachProcess

SNRESULTattachProcess(int target, uint unitId, uint processId){    HINSTANCE               hLib = LoadLibrary("PS3TMAPI_NET.DLL");    __cAttachProcess        AP = (__cAttachProcess)GetProcAddress(hLib, "SNPS3ProcessAttach");    return (AP(target, unitId, processId));}
开发者ID:Linsap,项目名称:PS3,代码行数:8,


示例9: 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.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:gitter-badger,项目名称:etlegacy,代码行数:59,


示例10: gamma

double Bs2JpsiPhi_mistagObservable_alt::Normalisation(DataPoint * measurement, PhaseSpaceBoundary * boundary){			// Get observables into member variables	t = measurement->GetObservable( timeName )->GetValue() - timeOffset;	ctheta_tr = measurement->GetObservable( cosThetaName )->GetValue();	phi_tr      = measurement->GetObservable( phiName )->GetValue();	ctheta_1   = measurement->GetObservable( cosPsiName )->GetValue();		tagFraction = measurement->GetObservable( mistagName )->GetValue();	//tagFraction= 0.5;  //PELC	// Get time boundaries into member variables	IConstraint * timeBound = boundary->GetConstraint("time");	if ( timeBound->GetUnit() == "NameNotFoundError" ) {		cerr << "Bound on time not provided" << endl;		return 0;	}	else {		tlo = timeBound->GetMinimum();		thi = timeBound->GetMaximum();	}			// Recalculate cached values if Physics parameters have changed	// Must do this for each of the two resolutions.//PELC// I dont think you can cache any more as normalisation depends upon the mistag which now changes per event.	if( true /*! normalisationCacheValid*/ )  {		for( tag = -1; tag <= 1; tag ++ ) {            resolution =  resolution1 ;			normalisationCacheValueRes1[tag+1] = this->diffXsecNorm1( );            resolution =  resolution2 ;			normalisationCacheValueRes2[tag+1] = this->diffXsecNorm1( );		}		normalisationCacheValid = true ;	}			// Return normalisation value according to tag 	tag = (int)measurement->GetObservable( tagName )->GetValue();	double returnValue  = resolution1Fraction*normalisationCacheValueRes1[tag+1] + (1. - resolution1Fraction)*normalisationCacheValueRes2[tag+1] ;		if( (returnValue <= 0.) || isnan(returnValue) ) {		cout << " Bs2JpsiPhi_mistagObservable_alt::Normalisation() returns <=0 or nan " << endl ;		cout << " gamma " << gamma() ;		cout << " gl    " << gamma_l() ;		cout << " gh    " << gamma_h() ;		cout << " AT    " << AT() ;		cout << " AP    " << AP() ;		cout << " A0    " << A0() ;		exit(1) ;	}		return returnValue ;}
开发者ID:abmorris,项目名称:RapidFit,代码行数:57,


示例11: G_pause_cmd

// ************** PAUSE / UNPAUSE//// Pause/unpause a match.void G_pause_cmd(gentity_t *ent, unsigned int dwCommand, qboolean fPause){	char *status[2] = { "^5UN", "^1" };	if(team_nocontrols.integer) { G_noTeamControls(ent); return; }	if((PAUSE_UNPAUSING >= level.match_pause && !fPause) || (PAUSE_NONE != level.match_pause && fPause)) {		CP(va("print /"The match is already %sPAUSED^7!/n/"", status[fPause]));		return;	}	// Alias for referees	if(ent->client->sess.referee) G_refPause_cmd(ent, fPause);	else {		int tteam = G_teamID(ent);		if(!G_cmdDebounce(ent, aCommandInfo[dwCommand].pszCommandName)) return;		// Trigger the auto-handling of pauses		if(fPause) {			if(0 == teamInfo[tteam].timeouts) {				CP("cpm /"^3Your team has no more timeouts remaining!/n/"");				return;			} else {				teamInfo[tteam].timeouts--;				level.match_pause = tteam + 128;				G_globalSound("sound/misc/referee.wav");				G_spawnPrintf(DP_PAUSEINFO, level.time + 15000, NULL);				AP(va("print /"^3Match is ^1PAUSED^3!/n^7[%s^7: - %d Timeouts Remaining]/n/"", aTeams[tteam], teamInfo[tteam].timeouts));				CP(va("cp /"^3Match is ^1PAUSED^3! (%s^3)/n/"", aTeams[tteam]));				level.server_settings |= CV_SVS_PAUSE;				trap_SetConfigstring(CS_SERVERTOGGLES, va("%d", level.server_settings));			}		} else if(tteam + 128 != level.match_pause) {			CP("cpm /"^3Your team didn't call the timeout!/n/"");			return;		} else {			AP("print /"/n^3Match is ^5UNPAUSED^3 ... resuming in 10 seconds!/n/n/"");			level.match_pause = PAUSE_UNPAUSING;			G_globalSound("sound/osp/prepare.wav");			G_spawnPrintf(DP_UNPAUSING, level.time + 10, NULL);		}	}}
开发者ID:BulldogDrummond,项目名称:etpub,代码行数:47,


示例12: 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,


示例13: G_lock_cmd

// ************** LOCK / UNLOCK//// Locks/unlocks a player's team.void G_lock_cmd(gentity_t *ent, unsigned int dwCommand, qboolean fLock){	int tteam;	if(team_nocontrols.integer) { G_noTeamControls(ent); return; }	if(!G_cmdDebounce(ent, aCommandInfo[dwCommand].pszCommandName)) return;	tteam = G_teamID(ent);	if(tteam == TEAM_AXIS || tteam == TEAM_ALLIES) {		if(teamInfo[tteam].team_lock == fLock) CP(va("print /"^3Your team is already %sed!/n/"", lock_status[fLock]));		else {			char *info = va("/"The %s team is now %sed!/n/"", aTeams[tteam], lock_status[fLock]);			teamInfo[tteam].team_lock = fLock;			AP(va("print %s", info));			AP(va("cp %s", info));		}	} else CP(va("print /"Spectators can't %s a team!/n/"", lock_status[fLock]));}
开发者ID:BulldogDrummond,项目名称:etpub,代码行数:22,


示例14: 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,


示例15: 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:Kajos,项目名称:RTCW.ET.Rift,代码行数:43,


示例16: G_CoinToss_v

// pheno: cointossint G_CoinToss_v( gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd ){	// Vote request (vote is being initiated)	if( arg ) {		if( !vote_allow_cointoss.integer &&			ent &&			!ent->client->sess.referee ) {			G_voteDisableMessage( ent, arg );			return ( G_INVALID );		}	// Vote action (vote has passed)	} else {		char *side = rand() % 2 ? "HEADS" : "TAILS";		AP( va( "cp /"Coin toss comes up^3 %s^7!/"", side ) );		AP( va( "cpm /"Coin toss comes up^3 %s^7!/"", side ) );	}	return ( G_OK );}
开发者ID:BulldogDrummond,项目名称:etpub,代码行数:21,


示例17: 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,


示例18: ClientInactivityTimer

/*=================ClientInactivityTimerReturns qfalse if the client is dropped=================*/qboolean ClientInactivityTimer(gclient_t *client) {	int i;	int counter = 0;	// suburb, take viewangles for inactivity drop instead of buttons	for (i = 0; i < 3; ++i) {		if (client->ps.viewangles[i] == client->pers.oldViewangles[i]) {			counter++;		}	}	// OSP - modified	if ((g_inactivity.integer == 0 && client->sess.sessionTeam != TEAM_SPECTATOR) || (g_spectatorInactivity.integer == 0 && client->sess.sessionTeam == TEAM_SPECTATOR)) {		// give everyone some time, so if the operator sets g_inactivity during		// gameplay, everyone isn't kicked		client->inactivityTime    = level.time + 60 * 1000;		client->inactivityWarning = qfalse;	} else if (counter != 3) {		client->inactivityWarning = qfalse;		client->inactivityTime    = level.time + 1000 * ((client->sess.sessionTeam != TEAM_SPECTATOR) ? g_inactivity.integer : g_spectatorInactivity.integer);	} else if (!client->pers.localClient) {		if (level.time > client->inactivityTime && client->inactivityWarning) {			client->inactivityWarning = qfalse;			client->inactivityTime    = level.time + 60 * 1000;			// Nico, move inactive player to spec instead of kicking them			// trap_DropClient( client - level.clients, "Dropped due to inactivity", 0 );			AP(va("cpm /"%s ^7removed from teams due to inactivity! ^z(%i seconds) /n/"", client->pers.netname, g_inactivity.integer));			SetTeam(g_entities + (client - level.clients), "s", -1, -1, qfalse);			return qfalse;		}		if (!client->inactivityWarning && level.time > client->inactivityTime - 10000) {			CPx(client - level.clients, "cp /"^310 seconds until inactivity drop!/n/"");			CPx(client - level.clients, "print /"^310 seconds until inactivity drop!/n/"");			G_Printf("10s inactivity warning issued to: %s/n", client->pers.netname);			client->inactivityWarning = qtrue;			client->inactivityTime    = level.time + 10000; // Just for safety		}	}	// suburb, update viewangles	if (counter != 3) {		for (i = 0; i < 3; ++i) {			client->pers.oldViewangles[i] = client->ps.viewangles[i];		}	}	return qtrue;}
开发者ID:ETrun,项目名称:ETrun,代码行数:61,


示例19: 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,


示例20: 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,


示例21: isCustomMOD

/*===========Custom MODs===========*/qboolean isCustomMOD(int mod, gentity_t *self, gentity_t *attacker){	// Killed by !kill command	if (mod == MOD_ADMKILL)	{			return qtrue;	}	else if (mod == MOD_SELFKILL)	{		int r = rand() % 2; // randomize messages		if (r == 0)			AP(va("print /"%s ^7slit his throat./n/"", self->client->pers.netname));		else if (r == 1)			AP(va("print /"%s ^7commited suicide./n/"", self->client->pers.netname));		return qtrue;	}	else if (mod == MOD_THROWKNIFE)	{		AP(va("print /"%s ^7was impaled by %s^7s throwing knife./n/"", self->client->pers.netname, attacker->client->pers.netname));		attacker->client->pers.knifeKills++;		write_RoundStats(attacker->client->pers.netname, attacker->client->pers.knifeKills, ROUND_KNIFETHROW);		return qtrue;	}	else if (mod == MOD_CHICKEN)	{		AP(va("print /"%s ^6was scared to death by ^7%s^7./n/"", self->client->pers.netname, attacker->client->pers.netname));		self->client->pers.chicken++;		write_RoundStats(self->client->pers.netname, self->client->pers.chicken, ROUND_CHICKEN);		// Give props to attacker		attacker->client->pers.kills++;		attacker->client->pers.lifeKills++;		write_RoundStats(attacker->client->pers.netname, attacker->client->pers.kills, ROUND_KILLS);		write_RoundStats(attacker->client->pers.netname, attacker->client->pers.lifeKills, ROUND_KILLPEAK);		return qtrue;	}	else if (mod == MOD_POISONDMED)	{		int r = rand() % 2;		if (r == 0)			AP(va("print /"%s ^7was poisoned by %s^7./n/"", self->client->pers.netname, attacker->client->pers.netname));		else if (r == 1)			AP(va("print /"%s ^7tasted %s^7's poison./n/"", self->client->pers.netname, attacker->client->pers.netname));		// Stats		attacker->client->pers.poison++;		write_RoundStats(attacker->client->pers.netname, attacker->client->pers.poison, ROUND_POISON);				return qtrue;	}	else		return qfalse;}
开发者ID:natelo,项目名称:rtcwPub,代码行数:65,


示例22: 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,


示例23: G_ref_cmd

// Request for ref status or lists ref commands.void G_ref_cmd(gentity_t *ent, unsigned int dwCommand, qboolean fValue){	char arg[MAX_TOKEN_CHARS];		// Roll through ref commands if already a ref	if(ent == NULL || ent->client->sess.referee) {		voteInfo_t votedata;		trap_Argv(1, arg, sizeof(arg));		memcpy( &votedata, &level.voteInfo, sizeof( voteInfo_t ) );		if( Cmd_CallVote_f(ent, 0, qtrue) ) {			memcpy( &level.voteInfo, &votedata, sizeof( voteInfo_t ) );			return;		} else {			memcpy( &level.voteInfo, &votedata, sizeof( voteInfo_t ) );			if(G_refCommandCheck(ent, arg)) {				return;			} else {				G_refHelp_cmd(ent);			}		}		return;	}	if(ent) {		if(!Q_stricmp(refereePassword.string, "none") || !refereePassword.string[0]) {			CP("cpm /"Sorry, referee status disabled on this server./n/"");			return;		}		if(trap_Argc() < 2) {			CP("cpm /"Usage: ref [password]/n/"");			return;		}		trap_Argv(1, arg, sizeof(arg));		if(Q_stricmp(arg, refereePassword.string)) {			CP("cpm /"Invalid referee password!/n/"");			return;		}		ent->client->sess.referee = 1;		ent->client->sess.spec_invite = TEAM_AXIS | TEAM_ALLIES;		AP(va("cp /"%s/n^3has become a referee/n/"", ent->client->pers.netname));		ClientUserinfoChanged( ent-g_entities );	}}
开发者ID:GenaSG,项目名称:ET,代码行数:53,


示例24: TouchPowerupSatchelBoost

void TouchPowerupSatchelBoost(gentity_t *self, gentity_t *player, trace_t *trace){    if(!player->client)    {        return;    }    player->client->powerups[PW_SATCHELBOOST] = sr_pw_satchelBoost.integer;    AP(va("chat /"%s ^7picked up a ^5Satchel Boost ^7powerup/"", player->client->pers.netname));    self->parent->child = NULL;    G_FreeEntity(self);}
开发者ID:haapanen,项目名称:satchelrace,代码行数:13,


示例25: TouchPowerupLowGravity

void TouchPowerupLowGravity(gentity_t *self, gentity_t *player, trace_t *trace){    if(!player->client)    {        return;    }    player->client->powerups[PW_LOWGRAVITY] = level.time + sr_pw_lowGravityDuration.integer;    AP(va("chat /"%s ^7picked up a ^5Low Gravity ^7powerup/"", player->client->pers.netname));    self->parent->child = NULL;    G_FreeEntity(self);}
开发者ID:haapanen,项目名称:satchelrace,代码行数:13,


示例26: TouchPowerupNoSlow

void TouchPowerupNoSlow(gentity_t *self, gentity_t *player, trace_t *trace){    if(!player->client)    {        return;    }    player->client->powerups[PW_NOSLOW] = level.time + sr_pw_noSlowDuration.integer;         AP(va("chat /"%s ^7picked up a ^5No Slow ^7powerup/"", player->client->pers.netname));    self->parent->child = NULL;    G_FreeEntity(self);}
开发者ID:haapanen,项目名称:satchelrace,代码行数:13,



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


C++ AP4_DYNAMIC_CAST函数代码示例
C++ AO_load函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。