Raised This Month: $56 Target: $400
 14% 

[solved] Tank same coordinate


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eric0279
AlliedModders Donor
Join Date: May 2007
Old 09-04-2013 , 21:24   [solved] Tank same coordinate
Reply With Quote #1

Hello,

i found this plugin but doesn't work's....

I do not want to use confogl

same map :
Tank spawn: [17%]
Tank spawn: [21%]

PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>

#define DEBUG_BS    0

#define MAX_TANKS    5
#define MAX_WITCHES    5

const NUM_OF_SURVIVORS 4;
const 
TEAM_SURVIVOR 2;
const 
TEAM_INFECTED 3;

//Survivor indexing stuff
new iSurvivorIndex[NUM_OF_SURVIVORS] = 0;

SI_BuildIndex()
{
    if (!
IsServerProcessing()) {return;}
    
    new 
ifoundsurvivors 0;
    
decl char;
    
    
// Make sure kicked survivors don't freak us out.
    
for(new 0NUM_OF_SURVIVORS;i++)
        
iSurvivorIndex[i]=0;
    
    for (new 
client 1client <= MaxClientsclient++)
    {
        if (
ifoundsurvivors == NUM_OF_SURVIVORS)
        {
            break;
        }
        
        if (!
IsClientInGame(client) || GetClientTeam(client) != 2)
        {
            continue;
        }
        
        
char GetEntProp(client,Prop_Send,"m_survivorCharacter");
        
ifoundsurvivors++;
        
        if (
char || char 0)
        {
            continue;
        }
        
        
iSurvivorIndex[char] = 0;
        
        if (!
IsPlayerAlive(client))
        {
            continue;
        }
        
        
iSurvivorIndex[char] = client;
    }
}

public 
SI_BuildIndexDelay_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
    
CreateTimer(0.3SI_BuildIndex_Timer);
}

public 
Action:SI_BuildIndex_Timer(Handle:timer)
{
    
SI_BuildIndex();
}

public 
SI_BuildIndex_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
    
SI_BuildIndex();
}

GetSurvivorIndex(index)
{
    if (
index || index 3)
    {
        return 
0;
    }
    
    return 
iSurvivorIndex[index];
}


//Map data functions and stuff
new Handle:kMIData INVALID_HANDLE;

stock GetMapValueInt(const String:key[], defvalue=0
{
    return 
KvGetNum(kMIDatakeydefvalue); 
}
stock Float:GetMapValueFloat(const String:key[], Float:defvalue=0.0
{
    return 
KvGetFloat(kMIDatakeydefvalue); 
}
stock GetMapValueVector(const String:key[], Float:vector[3], Float:defvalue[3]=NULL_VECTOR
{
    
KvGetVector(kMIDatakeyvectordefvalue);
}


//The actual boss spawning stuff
new bool:BS_bIsFirstRound true;
new 
bool:BS_bDeleteWitches false;
new 
bool:BS_bFinaleStarted false;
new 
bool:BS_bExpectTankSpawn false;

new 
BS_iTankCount[2];
new 
BS_iWitchCount[2];

new 
Float:BS_fTankSpawn[MAX_TANKS][3];
new 
Float:BS_fWitchSpawn[MAX_WITCHES][2][3];

new 
String:BS_sMap[64];

public 
BS_OnModuleStart()
{
    
HookEvent("tank_spawn"BS_TankSpawn);
    
HookEvent("witch_spawn"BS_WitchSpawn);
    
HookEvent("round_end"BS_RoundEndEventHookMode_PostNoCopy);
    
HookEvent("finale_start"BS_FinaleStartEventHookMode_PostNoCopy);
}

public 
BS_OnMapStart()
{
    
BS_bIsFirstRound true;
    
BS_bFinaleStarted false;
    
BS_bExpectTankSpawn false;
    
BS_iTankCount[0] = 0;
    
BS_iTankCount[1] = 0;
    
BS_iWitchCount[0] = 0;
    
BS_iWitchCount[1] = 0;
    
    
GetCurrentMap(BS_sMapsizeof(BS_sMap));
}

public 
Action:BS_WitchSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
iWitch GetEventInt(event"witchid");
    
    if (
BS_bDeleteWitches)
    {
        
// Used to delete round2 extra witches, which spawn on round start instead of by flow
        
AcceptEntityInput(iWitch"Kill");
        return;
    }
    
    
// Can't track more witches if our witch array is full
    
if (BS_iWitchCount[!BS_bIsFirstRound] >= MAX_WITCHES) return;
    
    if (
BS_bIsFirstRound)
    {
        
// If it's the first round, track our witch.
        
GetEntPropVector(iWitchProp_Send"m_vecOrigin"BS_fWitchSpawn[BS_iWitchCount[0]][0]);
        
GetEntPropVector(iWitchProp_Send"m_angRotation"BS_fWitchSpawn[BS_iWitchCount[0]][1]);
        
BS_iWitchCount[0]++;
    }
    else if (
BS_iWitchCount[0] > BS_iWitchCount[1])
    {
        
// Until we have found the same number of witches as from round1, teleport them to round1 locations
        
TeleportEntity(iWitchBS_fWitchSpawn[BS_iWitchCount[1]][0], BS_fWitchSpawn[BS_iWitchCount[1]][1], NULL_VECTOR);
        
BS_iWitchCount[1]++;
    }
}

//Doesn't seem to do anything here
/*Action:BS_OnTankSpawn_Forward()
{
    BS_bExpectTankSpawn = true;
    return Plugin_Continue;
}*/

public Action:BS_TankSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    
// Don't touch tanks on finale events
    
if (BS_bFinaleStarted) return;
    
// Stop if this isn't the first tank_spawn for this tank
    
if(!BS_bExpectTankSpawn) return;
    
BS_bExpectTankSpawn false;
    
// Don't track tank spawns on c5m5 or tank can spawn behind other team.
    
if(StrEqual(BS_sMap"c5m5_bridge") || StrEqual(BS_sMap"c8m1_apartment")) return; 
    
    new 
iTankClient GetClientOfUserId(GetEventInt(event"userid"));
    
    if (
GetMapValueInt("tank_z_fix")) FixZDistance(iTankClient); // fix stuck tank spawns, ex c1m1
    
    // If we reach MAX_TANKS, we don't have any room to store their locations
    
if (BS_iTankCount[!BS_bIsFirstRound] >= MAX_TANKS) return;
    
    if (
BS_bIsFirstRound)
    {
        
GetClientAbsOrigin(iTankClientBS_fTankSpawn[BS_iTankCount[0]]);

        
BS_iTankCount[0]++;
    }
    else if (
BS_iTankCount[0] > BS_iTankCount[1])
    {
        
TeleportEntity(iTankClientBS_fTankSpawn[BS_iTankCount[1]], NULL_VECTORNULL_VECTOR);

        
BS_iTankCount[1]++;
    }
}

public 
Action:BS_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    
BS_bIsFirstRound false;
    
BS_bFinaleStarted false;
    if(
StrEqual(BS_sMap"c6m1_riverbank")) {
        
BS_bDeleteWitches false;
    } else {
        
BS_bDeleteWitches true;
        
CreateTimer(5.0BS_WitchTimerReset);
    }
}

public 
Action:BS_FinaleStart(Handle:event, const String:name[], bool:dontBroadcastBS_bFinaleStarted true;

public 
Action:BS_WitchTimerReset(Handle:timer)
{
    
BS_bDeleteWitches false;
}

FixZDistance(iTankClient)
{
    
decl Float:TankLocation[3];
    
decl Float:TempSurvivorLocation[3];
    
decl index;
    
    
GetClientAbsOrigin(iTankClientTankLocation);
    
    for (new 
0NUM_OF_SURVIVORSi++)
    {
        new 
Float:distance GetMapValueFloat("max_tank_z"99999999999999.9);
        
index GetSurvivorIndex(i);
        if (
index != && IsValidEntity(index))
        {
            
GetClientAbsOrigin(indexTempSurvivorLocation);
            
            if (
FloatAbs(TempSurvivorLocation[2] - TankLocation[2]) > distance)
            {
                new 
Float:WarpToLocation[3];
                
GetMapValueVector("tank_warpto"WarpToLocation);
                if (!
GetVectorLength(WarpToLocationtrue))
                {
                    
LogMessage("[BS] tank_warpto missing from mapinfo.txt");
                    return;
                }
                
TeleportEntity(iTankClientWarpToLocationNULL_VECTORNULL_VECTOR);
            }
        }
    }

Could you correct for it to work ?

Sincerely,

Last edited by eric0279; 09-06-2013 at 09:49.
eric0279 is offline
JackieChan
AlliedModders Donor
Join Date: Nov 2009
Old 09-05-2013 , 01:39   Re: [L4D2] Tank same coordinate
Reply With Quote #2

Have you tried using "versus_tank_flow_team_variation"?
__________________
JackieChan is offline
eric0279
AlliedModders Donor
Join Date: May 2007
Old 09-05-2013 , 02:01   Re: [L4D2] Tank same coordinate
Reply With Quote #3

Quote:
Originally Posted by JackieChan View Post
Have you tried using "versus_tank_flow_team_variation"?
should be :
versus_tank_flow_team_variation 0 for same ?

Last edited by eric0279; 09-05-2013 at 02:03.
eric0279 is offline
JackieChan
AlliedModders Donor
Join Date: Nov 2009
Old 09-05-2013 , 02:38   Re: [L4D2] Tank same coordinate
Reply With Quote #4

Yeah. I use that variable set at 0 and I never notice any difference in flow distance for Tank spawns.
__________________
JackieChan is offline
eric0279
AlliedModders Donor
Join Date: May 2007
Old 09-05-2013 , 08:50   Re: [L4D2] Tank same coordinate
Reply With Quote #5

I'll test, thanks
eric0279 is offline
eric0279
AlliedModders Donor
Join Date: May 2007
Old 09-06-2013 , 09:50   Re: [solved] Tank same coordinate
Reply With Quote #6

Thanks, work's fine!
eric0279 is offline
Reply


Thread Tools
Display Modes

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 05:53.


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