Raised This Month: $ Target: $400
 0% 

[TF2] Autobalance immunity/swapteam


Post New Thread Reply   
 
Thread Tools Display Modes
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 12-25-2016 , 17:16   Re: [TF2] Autobalance immunity/swapteam
Reply With Quote #21

Quote:
Originally Posted by Stropy View Post
Can you make this compatible with arena mod? If player is alive or dead and changes team, in this version it respawns him, which is not what should happen in arena mod.
add back the check if they are alive
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
Stropy
Senior Member
Join Date: Feb 2016
Old 12-26-2016 , 14:41   Re: [TF2] Autobalance immunity/swapteam
Reply With Quote #22

Yea, i did that, and then the teamswitch is not working properly
Stropy is offline
Alice.bnd
Member
Join Date: Sep 2011
Location: Russia, SPb
Old 12-27-2016 , 06:04   Re: [TF2] Autobalance immunity/swapteam
Reply With Quote #23

TF2_RemoveAllWeapons(client) do not kill engineer's buildings... Why?
__________________
Alice.bnd is offline
Send a message via ICQ to Alice.bnd
NicronS
New Member
Join Date: Dec 2016
Old 12-27-2016 , 06:32   Re: [TF2] Autobalance immunity/swapteam
Reply With Quote #24

Quote:
Originally Posted by friagram View Post
Oh i see, you have to respawn them to remove the projectiles.
Change team no longer kills them.

PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <tf2_stocks>
#include <sdkhooks>

public Plugin:myinfo =  {
    
name "Change Team Fix"
    
author "Friagram"
    
description "burp"
    
version "1.0"
    
url "http://steamcommunity.com/groups/poniponiponi"
};

public 
OnPluginStart()
{
    
HookEvent("player_team"Event_PlayerTeam);
    
    for (new 
client 1client <= MaxClientsclient++) // late load
    
{
        if (
IsClientInGame(client))
        {
            
OnClientPutInServer(client);
        }
    }
}

public 
OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
}

public 
Action:OnTakeDamage(client, &attacker, &inflictor, &Float:damage, &damagetype, &weaponFloat:damageForce[3], Float:damagePosition[3], damagecustom)
{
    if (
attacker && attacker <= MaxClients && IsClientInGame(attacker) && GetClientTeam(attacker) < 2)
    {
        
damage 0.0;
        return 
Plugin_Changed;
    }
    
    return 
Plugin_Continue;
}

public 
Event_PlayerTeam(Handle:hEvent, const String:name[], bool:dontBroadcast)
{
    if (
GetEventInt(hEvent"team") == 1)
    {
        new 
userid GetEventInt(hEvent"userid");
        new 
client GetClientOfUserId(userid);
        if (
client && IsClientInGame(client))
        {
            
FakeClientCommand(client"kill");
            
SDKHooks_TakeDamage(clientclientclient9999.0);
            
            
RequestFrame(frame_respawnuserid);
        }
    }
}

public 
frame_respawn(any:userid)
{
    new 
client GetClientOfUserId(userid);
    if (
client && IsClientInGame(client))
    {
        
TF2_RemoveAllWeapons(client); // engineer buildings
        
TF2_RespawnPlayer(client);
    }

here's an approach to stop the damage when they switch to spectator

This code seems not to work when a player switches to spectate using console. At least in our multiple servers.
NicronS is offline
Stropy
Senior Member
Join Date: Feb 2016
Old 12-28-2016 , 12:18   Re: [TF2] Autobalance immunity/swapteam
Reply With Quote #25

It is fixed w/ solly and demoman, but it is still possible with pyro
the killing i mean

Last edited by Stropy; 12-29-2016 at 04:58.
Stropy is offline
D4rkl0rd
Member
Join Date: Aug 2013
Old 12-29-2016 , 16:03   Re: [TF2] Autobalance immunity/swapteam
Reply With Quote #26

Quote:
Originally Posted by friagram View Post
Oh i see, you have to respawn them to remove the projectiles.
Change team no longer kills them.

PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <tf2_stocks>
#include <sdkhooks>

public Plugin:myinfo =  {
    
name "Change Team Fix"
    
author "Friagram"
    
description "burp"
    
version "1.0"
    
url "http://steamcommunity.com/groups/poniponiponi"
};

public 
OnPluginStart()
{
    
HookEvent("player_team"Event_PlayerTeam);
    
    for (new 
client 1client <= MaxClientsclient++) // late load
    
{
        if (
IsClientInGame(client))
        {
            
OnClientPutInServer(client);
        }
    }
}

public 
OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
}

public 
Action:OnTakeDamage(client, &attacker, &inflictor, &Float:damage, &damagetype, &weaponFloat:damageForce[3], Float:damagePosition[3], damagecustom)
{
    if (
attacker && attacker <= MaxClients && IsClientInGame(attacker) && GetClientTeam(attacker) < 2)
    {
        
damage 0.0;
        return 
Plugin_Changed;
    }
    
    return 
Plugin_Continue;
}

public 
Event_PlayerTeam(Handle:hEvent, const String:name[], bool:dontBroadcast)
{
    if (
GetEventInt(hEvent"team") == 1)
    {
        new 
userid GetEventInt(hEvent"userid");
        new 
client GetClientOfUserId(userid);
        if (
client && IsClientInGame(client))
        {
            
FakeClientCommand(client"kill");
            
SDKHooks_TakeDamage(clientclientclient9999.0);
            
            
RequestFrame(frame_respawnuserid);
        }
    }
}

public 
frame_respawn(any:userid)
{
    new 
client GetClientOfUserId(userid);
    if (
client && IsClientInGame(client))
    {
        
TF2_RemoveAllWeapons(client); // engineer buildings
        
TF2_RespawnPlayer(client);
    }

here's an approach to stop the damage when they switch to spectator
AAAAnd the plugin crashes MGE when someone tries to join a second arena.
D4rkl0rd is offline
depthbomb
Junior Member
Join Date: Jul 2014
Old 01-03-2017 , 16:56   Re: [TF2] Autobalance immunity/swapteam
Reply With Quote #27

Is there any update on this situation? Using the quoted code above somewhat works albeit engineer buildings still remain for some reason. Using Sourcemod 1.7.3+5325
depthbomb is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 01-03-2017 , 21:10   Re: [TF2] Autobalance immunity/swapteam
Reply With Quote #28

Quote:
Originally Posted by Alice.bnd View Post
TF2_RemoveAllWeapons(client) do not kill engineer's buildings... Why?
Because it Removes All Weapons, not Kill Engineer Buildings.

PHP Code:
stock DestroyBuildings(iEngie// Works for Spy sappers too
{
    new 
iEnt MaxClients 1;
    while ((
iEnt FindEntityByClassname(iEnt"obj_*")) != -1)
    {
        if (
GetEntPropEnt(iEntProp_Send"m_hBuilder") == iEngie)
        {
            
AcceptEntityInput(iEnt"Kill");
        }
    }

__________________

Last edited by Chdata; 01-03-2017 at 21:17.
Chdata is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 01-03-2017 , 22:56   Re: [TF2] Autobalance immunity/swapteam
Reply With Quote #29

This is a blunder on valve's side. They should have fixed it already. There must be some big green xmas-tree shaped cookies in the break room keeping everyone occupied.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 01-04-2017 , 10:07   Re: [TF2] Autobalance immunity/swapteam
Reply With Quote #30

Also this

PHP Code:
    new iNewTeam GetEventInt(hEvent"team");
    new 
iOldTeam GetEventInt(hEvent"oldteam");

    if (
iNewTeam <= TEAM_SPEC && iOldTeam TEAM_SPEC)
    { 
__________________
Chdata 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 23:11.


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