本文整理汇总了C++中AP函数的典型用法代码示例。如果您正苦于以下问题:C++ AP函数的具体用法?C++ AP怎么用?C++ AP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AP函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:g_vote.c
示例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,代码来源:GeomUtils.cpp
示例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,代码来源:g_vote.c
示例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,代码来源:g_vote.c
示例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,代码来源:g_vote.c
示例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,代码来源:g_cmds_ext.c
示例7: A0
//.......................................................
// New speed up method to Cache time integrals
void 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,代码来源:Bs2JpsiPhi_SignalAlt_MO_v4.cpp
示例8: attachProcess
SNRESULT
attachProcess(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,代码来源:test_dex_attachProcess.c
示例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,代码来源:g_vote.c
示例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,代码来源:Bs2JpsiPhi_mistagObservable_alt.cpp
示例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,代码来源:g_cmds_ext.c
示例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,代码来源:g_vote.c
示例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,代码来源:g_cmds_ext.c
示例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,代码来源:g_vote.c
示例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,代码来源:g_vote.c
示例16: G_CoinToss_v
// pheno: cointoss
int 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,代码来源:g_vote.c
示例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,代码来源:g_vote.c
示例18: ClientInactivityTimer
/*
=================
ClientInactivityTimer
Returns 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,代码来源:g_active.c
示例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,代码来源:g_vote.c
示例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,代码来源:g_vote.c
注:本文中的AP函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论