View Single Post
Author Message
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 05-30-2018 , 15:46   [L4D/L4D2] Getting coordinates of "warp_all_survivors_to_checkpoint"
Reply With Quote #1

I'm wondering if there's an efficient way of getting the coordinates of where in the Saferoom survivors are teleported to when "warp_all_survivors_to_checkpoint" is used.

I want to get those coordinates at the start of each map. This is the only method I can think of but I fear that it may cause the round to end.

PHP Code:
float g_flPosition[3];
...
public 
Action eRoundStart(Event event, const char[] namebool dontBroadcast)
{
     
g_flPosition[0] = 0.0;
     
g_flPosition[1] = 0.0;
     
g_flPosition[2] = 0.0;
     
// As long as it's not a finale map
     
if (!bIsFinaleMap())
     {
          
ServerCommand("warp_all_survivors_to_checkpoint"); // Teleport to saferoom
          
for (int iSurvivor 1iSurvivor <= MaxClientsiSurvivor++)
          {
               
// Get position of the 1st survivor
               
if (bIsSurvivor(iSurvivor))
               {
                    
GetClientAbsOrigin(iSurvivorg_flPosition);
                    break;
               }
               
// Teleport all survivors back to starting saferoom
               
TeleportEntity(iSurvivorg_flOriginNULL_VECTORNULL_VECTOR); // g_flOrigin would be set on "player_activate" event
          
}
     }
}
...
void Blah(int targetint client)
{
     
TeleportEntity(targetg_flPositionNULL_VECTORNULL_VECTOR);
     
PrintToChat(client"%N was teleported to the Saferoom."target);

__________________

Last edited by Psyk0tik; 05-04-2021 at 23:37. Reason: Marked as solved
Psyk0tik is offline