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


C++ TeleportPlayer函数代码示例

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


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

示例1: PortalTouch

static void PortalTouch(gentity_t * self, gentity_t * other, trace_t * trace)
{
	gentity_t      *destination;

	// see if we will even let other try to use it
	if(other->health <= 0)
	{
		return;
	}
	if(!other->client)
	{
		return;
	}
//  if( other->client->ps.persistant[PERS_TEAM] != self->spawnflags ) {
//      return;
//  }

	if(other->client->ps.powerups[PW_NEUTRALFLAG])
	{							// only happens in One Flag CTF
		Drop_Item(other, BG_FindItemForPowerup(PW_NEUTRALFLAG), 0);
		other->client->ps.powerups[PW_NEUTRALFLAG] = 0;
	}
	else if(other->client->ps.powerups[PW_REDFLAG])
	{							// only happens in standard CTF
		Drop_Item(other, BG_FindItemForPowerup(PW_REDFLAG), 0);
		other->client->ps.powerups[PW_REDFLAG] = 0;
	}
	else if(other->client->ps.powerups[PW_BLUEFLAG])
	{							// only happens in standard CTF
		Drop_Item(other, BG_FindItemForPowerup(PW_BLUEFLAG), 0);
		other->client->ps.powerups[PW_BLUEFLAG] = 0;
	}

	// find the destination
	destination = NULL;
	while((destination = G_Find(destination, FOFS(classname), "hi_portal destination")) != NULL)
	{
		if(destination->count == self->count)
		{
			break;
		}
	}

	// if there is not one, die!
	if(!destination)
	{
		if(self->pos1[0] || self->pos1[1] || self->pos1[2])
		{
			TeleportPlayer(other, self->pos1, self->s.angles);
		}
		G_Damage(other, other, other, NULL, NULL, 100000, DAMAGE_NO_PROTECTION, MOD_TELEFRAG);
		return;
	}

	TeleportPlayer(other, destination->s.pos.trBase, destination->s.angles);
}
开发者ID:SinSiXX,项目名称:Rogue-Reborn,代码行数:56,代码来源:g_misc.c

示例2: Cmd_SetViewpos_f

/*
=================
Cmd_SetViewpos_f
=================
*/
void Cmd_SetViewpos_f( gentity_t *ent ) {
	vec3_t		origin, angles;
	char		buffer[MAX_TOKEN_CHARS];
	int			i;

	if ( !g_cheats.integer ) {
		trap_SendServerCommand( ent-g_entities, va("print \"Cheats are not enabled on this server.\n\""));
		return;
	}
	if ( trap_Argc() != 5 ) {
		trap_SendServerCommand( ent-g_entities, va("print \"usage: setviewpos x y z yaw\n\""));
		return;
	}

	VectorClear( angles );
	for ( i = 0 ; i < 3 ; i++ ) {
		trap_Argv( i + 1, buffer, sizeof( buffer ) );
		origin[i] = atof( buffer );
	}

	trap_Argv( 4, buffer, sizeof( buffer ) );
	angles[YAW] = atof( buffer );

	TeleportPlayer( ent, origin, angles );
}
开发者ID:MasaMune692,项目名称:alcexamples,代码行数:30,代码来源:g_cmds.c

示例3: trigger_teleporter_touch

void trigger_teleporter_touch( gentity_t *self, gentity_t *other, trace_t *trace )
{
    gentity_t *dest;

    if( self->s.eFlags & EF_NODRAW )
        return;

    if( !other->client )
        return;

    if( other->client->ps.pm_type == PM_DEAD )
        return;

    // Spectators only?
    if( ( self->spawnflags & 1 ) &&
            other->client->sess.spectatorState == SPECTATOR_NOT )
        return;


    dest = G_PickTarget( self->target );

    if( !dest )
    {
        G_Printf( "Couldn't find teleporter destination\n" );
        return;
    }

    TeleportPlayer( other, dest->s.origin, dest->s.angles );
}
开发者ID:redrumrobot,项目名称:trem-gpp-bots,代码行数:29,代码来源:g_trigger.c

示例4: Cmd_SetViewpos_f

void Cmd_SetViewpos_f(gentity_t* entity)
{
    if (!(*g_cheats)->current.boolean)
    {
        SV_GameSendServerCommand(GENTITY_TO_CLIENTNUM(entity), 0, va("%c \"GAME_CHEATSNOTENABLED\"", 101));
        return;
    }

    if (Cmd_ArgcSV() < 4 || Cmd_ArgcSV() > 6)
    {
        SV_GameSendServerCommand(GENTITY_TO_CLIENTNUM(entity), 0, va("%c \"Usage: setviewpos x y z yaw pitch\"", 101));
        return;
    }

    float pos[3];
    for (int i = 1; i < 4; i++)
    {
        pos[i - 1] = (float)atof(Cmd_ArgvSV(i));
    }

    float orientation[3] = { 0.0f, 0.0f, 0.0f };
    if (Cmd_ArgcSV() >= 5)
    {
        orientation[1] = (float)atof(Cmd_ArgvSV(4));
    }

    if (Cmd_ArgcSV() == 6)
    {
        orientation[0] = (float)atof(Cmd_ArgvSV(5));
    }

    TeleportPlayer(entity, pos, orientation);
}
开发者ID:cubedj,项目名称:fourdeltaone,代码行数:33,代码来源:PatchMW2ClientCommands.cpp

示例5: MM_JailClient

void MM_JailClient(gentity_t *ent, qboolean respawn)
{
	jail_t *jail = MM_GetJail();

	if (jail == NULL)
	{
		MM_SendMessage(ent - g_entities, "print \"No jail spots found on this map. Please add a jail spot before trying to jail a client.\n\"");
		ent->client->sess.jailed = qfalse;
	}
	else
	{
		ent->client->sess.jailed = qtrue;

		if(respawn)
			TeleportPlayer(ent, jail->origin, jail->angles);
		else
		{
			G_SetOrigin(ent, jail->origin);
			VectorCopy(jail->origin, ent->client->ps.origin);
			SetClientViewAngle(ent, jail->angles);
		}

		G_Unempower(ent);
		ent->client->ps.fd.forcePowersKnown = 0;
		ent->client->ps.stats[STAT_WEAPONS] = (1 << WP_MELEE);
		ent->client->ps.weapon = WP_MELEE;
		ent->client->ps.pm_flags &= ~PM_NOCLIP;
	}
}
开发者ID:spior,项目名称:Makermod,代码行数:29,代码来源:mm_jail.c

示例6: trigger_teleporter_touch

void trigger_teleporter_touch(gentity_t * self, gentity_t * other, trace_t * trace)
{
	gentity_t      *dest;

	if(!other->client)
		return;

	if(other->client->ps.pm_type == PM_DEAD)
		return;

	// Spectators only?
	if((self->spawnflags & 1) && other->client->sess.sessionTeam != TEAM_SPECTATOR)
		return;


	dest = G_PickTarget(self->target);

	if(!dest)
	{
		G_Printf("Couldn't find teleporter destination\n");
		return;
	}

#ifdef G_LUA
	// Lua API callbacks
	if(self->luaTrigger)
	{
		G_LuaHook_EntityTrigger(self->luaTrigger, self->s.number, other->s.number);
	}
#endif

	TeleportPlayer(other, dest->s.origin, dest->s.angles);
}
开发者ID:redrumrobot,项目名称:dretchstorm,代码行数:33,代码来源:g_trigger.c

示例7: trigger_teleporter_touch

void trigger_teleporter_touch (gentity_t *self, gentity_t *other, trace_t *trace)
{
	gentity_t	*dest;

	if (!other->client)
	{
		return;
	}
	if (other->client->ps.pm_type == PM_DEAD)
	{
		return;
	}
	// Spectators only?
	if ((self->spawnflags & 1) &&
		other->client->sess.sessionTeam != TEAM_SPECTATOR)
		{
		return;
	}


	dest = 	G_PickTarget(self->target);
	if (!dest)
	{
		G_Printf ("Couldn't find teleporter destination\n");
		return;
	}

	TeleportPlayer(other, dest->s.origin, dest->s.angles);
}
开发者ID:ElderPlayerX,项目名称:Invasion,代码行数:29,代码来源:g_trigger.c

示例8: Touch_TeleporterTrigger

/*
=======================================================================================================================================
Touch_TeleporterTrigger
=======================================================================================================================================
*/
void Touch_TeleporterTrigger(gentity_t *self, gentity_t *other, trace_t *trace) {
	playerState_t *ps;
	gentity_t *dest;

	ps = G_GetEntityPlayerState(other);

	if (!ps) {
		return;
	}

	if (ps->pm_type == PM_DEAD) {
		return;
	}
	// spectators only?
	if ((self->spawnflags & 1) && other->client->sess.sessionTeam != TEAM_SPECTATOR) {
		return;
	}

	dest = G_PickTarget(self->target);

	if (!dest) {
		G_Printf("Couldn't find teleporter destination\n");
		return;
	}

	TeleportPlayer(other, dest->s.origin, dest->s.angles);
}
开发者ID:KuehnhammerTobias,项目名称:ioqw,代码行数:32,代码来源:g_trigger.c

示例9: trigger_teleporter_touch

void trigger_teleporter_touch (gentity_t *self, gentity_t *other, trace_t *trace ) 
{
	gentity_t	*dest;

	if ( self->svFlags & SVF_INACTIVE )
	{//set by target_deactivate
		return;
	}
	
	dest = 	G_PickTarget( self->target );
	if (!dest) 
	{
		gi.Printf ("Couldn't find teleporter destination\n");
		return;
	}

	if ( other->client ) 
	{
		if ( other->client->ps.pm_type == PM_DEAD ) 
		{
			if ( !(self->spawnflags&TTSF_DEAD_OK) )
			{//dead men can't teleport
				return;
			}
		}
		if ( other->NPC )
		{
			if ( self->spawnflags & NO_NPCS )
			{
				return;
			}
		}

		if ( other->client->playerTeam != TEAM_FREE && SpotWouldTelefrag2( other, dest->currentOrigin ) )//SpotWouldTelefrag( dest, other->client->playerTeam ) )
		{//Don't go through if something blocking on the other side
			return;
		}
		
		TeleportPlayer( other, dest->s.origin, dest->s.angles );
	}
	//FIXME: check for SVF_NO_TELEPORT
	else if ( !(self->svFlags & SVF_NO_TELEPORT) && !(self->spawnflags & NO_MISSILES) && VectorLengthSquared( other->s.pos.trDelta ) )
	{//It's a mover of some sort and is currently moving
		vec3_t	diffAngles = {0, 0, 0};
		qboolean	snap = qfalse;

		if ( self->lastEnemy )
		{
			VectorSubtract( dest->s.angles, self->lastEnemy->s.angles, diffAngles );
		}
		else
		{//snaps to angle
			VectorSubtract( dest->s.angles, other->currentAngles, diffAngles );
			snap = qtrue;
		}

		TeleportMover( other, dest->s.origin, diffAngles, snap );
	}
}
开发者ID:AlexXT,项目名称:OpenJK,代码行数:59,代码来源:g_trigger.cpp

示例10: Player_Teleport

	static int Player_Teleport( lua_State *L ) {
		luaPlayer_t *player = CheckPlayer( L, 1 );
		gentity_t *ent = &g_entities[player->clientNum];
		vector3 *pos = CheckVector( L, 2 );
		vector3 *angles = CheckVector( L, 3 );

		TeleportPlayer( ent, pos, angles );

		return 0;
	}
开发者ID:Mauii,项目名称:japp,代码行数:10,代码来源:bg_luaplayer.cpp

示例11: target_teleporter_use

void target_teleporter_use( gentity_t *self, gentity_t *other, gentity_t *activator ) {
	gentity_t	*dest;

	if (!activator->client)
		return;
	dest = 	G_PickTarget( self->target );
	if (!dest) {
		G_Printf ("Couldn't find teleporter destination\n");
		return;
	}

	TeleportPlayer( activator, dest->s.origin, dest->s.angles, qfalse, qtrue );
}
开发者ID:ElderPlayerX,项目名称:Rune,代码行数:13,代码来源:g_target.c

示例12: target_teleporter_use

void target_teleporter_use( gentity_t *self, gentity_t *other, gentity_t *activator ) {
	gentity_t	*dest;

	if (!activator->client)
		return;

	G_ActivateBehavior(self,BSET_USE);

	dest = 	G_PickTarget( self->target );
	if (!dest) {
		gi.Printf ("Couldn't find teleporter destination\n");
		return;
	}

	TeleportPlayer( activator, dest->s.origin, dest->s.angles );
}
开发者ID:AlexCSilva,项目名称:jediacademy,代码行数:16,代码来源:g_target.cpp

示例13: target_teleporter_use

void target_teleporter_use( gentity_t *self, gentity_t *other, gentity_t *activator ) {
	gentity_t	*dest;

	/* LQ3A */
	UNREFERENCED_PARAMETER(other);

	if (!activator->client)
		return;
	dest = 	G_PickTarget( self->target );
	if (!dest) {
		G_Printf ("Couldn't find teleporter destination\n");
		return;
	}

	TeleportPlayer( activator, dest->s.origin, dest->s.angles );
}
开发者ID:monoknot,项目名称:loaded-q3a,代码行数:16,代码来源:g_target.c

示例14: clock

// Teleport player to this map and this coord.
bool CMap::TeleportPlayer( CPlayer* player, fPoint coord, bool TelePassenger )
{
    GServer->MapList.Index[player->Position->Map]->RemovePlayer( player, false );
    player->Position->Map = id;
    player->Position->current = coord;
    player->Position->destiny = coord;
    player->Session->inGame = false;
    player->Position->lastMoveTime = clock();
    if(player->Stats->HP<1)player->Stats->HP=player->Stats->MaxHP * 10 / 100;
    if(!allowpat || !TelePassenger)
    {
        if(!allowpat)
            player->Status->Stance=0x03;
        player->Ride->Drive = false;
        player->Ride->charid= 0;
        player->Ride->Ride = false;
    }
    AddPlayer( player );
	BEGINPACKET( pak, 0x07a8 );
	ADDWORD    ( pak, player->clientid );
	ADDWORD    ( pak, player->Position->Map );
	ADDFLOAT   ( pak, player->Position->current.x*100 );
	ADDFLOAT   ( pak, player->Position->current.y*100 );
    ADDWORD    ( pak, (player->Status->Stance==0x04?0x0201:0x0001) );
	player->client->SendPacket( &pak );
    if( player->Ride->Drive && player->Ride->charid!=0 )
    {
            CPlayer* otherclient = GServer->GetClientByCID( player->Ride->charid );
            if( otherclient!=NULL )
            {
                if(TelePassenger)
                {
                    TeleportPlayer( otherclient, coord );
                }
                else
                {
                    otherclient->Ride->Drive = false;
                    otherclient->Ride->charid= 0;
                    otherclient->Ride->Ride = false;
                }
            }
    }
    GServer->pakClearUser( player );
    GServer->ClearClientID( player->clientid );
    player->RestartPlayerVal( );
    return true;
}
开发者ID:RavenX8,项目名称:osirose,代码行数:48,代码来源:mapfunctions.cpp

示例15: target_teleporter_use

void target_teleporter_use(gentity_t *self, gentity_t *other, gentity_t *activator) {
	gentity_t *dest;

	// Nico, silent GCC
	(void)other;

	if (!activator->client) {
		return;
	}
	dest = G_PickTarget(self->target);
	if (!dest) {
		G_Printf("Couldn't find teleporter destination\n");
		return;
	}

	TeleportPlayer(activator, dest->s.origin, dest->s.angles);
}
开发者ID:boutetnico,项目名称:ETrun,代码行数:17,代码来源:g_target.c


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