Raised This Month: $ Target: $400
 0% 

[SOLVED][L4D2] Teleport player to the group (8coop)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
cigs
Senior Member
Join Date: Jul 2006
Old 02-18-2010 , 14:24   [SOLVED][L4D2] Teleport player to the group (8coop)
Reply With Quote #1

On an 8coop server, I'm trying to teleport the client once he has taken over a bot. The coordinates are retrieved from the first client found who is alive and not a fakeclient.

Problem
The player takes control of the bot, but he isn't teleported. (to the group) He is still spawned at the beginning of the map.
Everything works except the teleport part itself.

PHP Code:
public Action:TimerJoinTeamSurvivors(Handle:timerany:client)
{
    if (
IsClientConnected(client))
    {
        if (
IsClientInGame(client))
        {
            
FakeClientCommand(client"jointeam %i"TEAM_SURVIVOR);
                    
            
// teleport client to the position of any alive client
            
for (new 1<= MaxClientsi++)
            {
                if (
IsClientInGame(i))
                {
                    continue;
                }
                if (
GetClientTeam(i) == TEAM_SURVIVOR)
                {
                    continue;
                }
                if (!
IsFakeClient(i))
                {
                    continue;
                }
                if (
IsPlayerAlive(i))
                {
                    continue;
                }
                    
                
// get the position coordinates of any active living player
                
new Float:coordinates[3];
                
GetClientAbsOrigin(icoordinates);                
                
TeleportEntity(clientcoordinatesNULL_VECTORNULL_VECTOR);
                
                break;
            }
        }
    }    
    
    return 
Plugin_Stop;

For more code click here; the event determining when a fakeclient needs to be created and when the player can be switch to the survivor team.

Last edited by cigs; 02-19-2010 at 17:25. Reason: add [SOLVED] to title
cigs is offline
cigs
Senior Member
Join Date: Jul 2006
Old 02-19-2010 , 05:12   Re: [L4D2] Teleport player to the group (8coop)
Reply With Quote #2

bump - some help please
__________________
cigs is offline
dirka_dirka
Veteran Member
Join Date: Nov 2009
Old 02-19-2010 , 10:50   Re: [L4D2] Teleport player to the group (8coop)
Reply With Quote #3

all your ifs inside the for loop are wrong.

continue causes that value of i to be skipped, yet all those checks are what you want to pass...

make them all negative (!)
dirka_dirka is offline
cigs
Senior Member
Join Date: Jul 2006
Old 02-19-2010 , 10:59   Re: [L4D2] Teleport player to the group (8coop)
Reply With Quote #4

A million thanks, dirka_dirka! Gonna report back if there is anything else.
__________________
cigs is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:36.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode