Raised This Month: $ Target: $400
 0% 

[TF2] Autobalance immunity/swapteam


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
WebNoob
Senior Member
Join Date: Jul 2008
Old 12-22-2016 , 18:28   [TF2] Autobalance immunity/swapteam
Reply With Quote #1

SO...after having this functionality for 8+ years, it appears the "Smissmass 2016" update that changed the autobalance functionality has also broken the "swapteam" function our supporters have been able to use for years.

Specifically, the game no longer kills the player when they swapteams, it simply (and instantly) changes their team, which means people can create havoc by swapping teams in spawn, etc.

My question is - is this going to require an alteration to the underlying plugin/extension, or is this something that will be fixed in Sourcemod itself?
WebNoob is offline
psychonic

BAFFLED
Join Date: May 2008
Old 12-22-2016 , 18:49   Re: [TF2] Autobalance immunity/swapteam
Reply With Quote #2

From what I recall seeing on IRC recently, just calling ChangeClientTeam on TF2 is no longer enough to change a client's team. TF2_RespawnPlayer must be called afterward. This would be best fixed in the SM plugins that do this.
psychonic is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 12-23-2016 , 01:51   Re: [TF2] Autobalance immunity/swapteam
Reply With Quote #3

Quote:
Originally Posted by psychonic View Post
From what I recall seeing on IRC recently, just calling ChangeClientTeam on TF2 is no longer enough to change a client's team. TF2_RespawnPlayer must be called afterward. This would be best fixed in the SM plugins that do this.
calling respawn when changeteam happens doesn't do it. Mabye a frame or 2 later will
Looks like you actually have to kill them.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.

Last edited by friagram; 12-23-2016 at 01:54.
friagram is offline
Fearts
ferts of daeth
Join Date: Oct 2008
Old 12-22-2016 , 23:19   Re: [TF2] Autobalance immunity/swapteam
Reply With Quote #4

@psychonic

Is there no other way then editing every plugin? Like a very large number of plugins use ChangeClientTeam.
__________________
Fearts is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 12-23-2016 , 02:07   Re: [TF2] Autobalance immunity/swapteam
Reply With Quote #5

PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <tf2>
#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);
}

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) && IsPlayerAlive(client) && GetClientTeam(client) == 1)
    {
        
TF2_RespawnPlayer(client);
    }

__________________
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-23-2016 , 11:13   Re: [TF2] Autobalance immunity/swapteam
Reply With Quote #6

Got your plugin on 3 servers, if i switch player to spectate, it works as always, thanks to your plugin, but when i switch someone from red/blu to red/blu, they just change the team and don't die.
Stropy is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 12-23-2016 , 12:47   Re: [TF2] Autobalance immunity/swapteam
Reply With Quote #7

Quote:
Originally Posted by Stropy View Post
Got your plugin on 3 servers, if i switch player to spectate, it works as always, thanks to your plugin, but when i switch someone from red/blu to red/blu, they just change the team and don't die.
right, the problem is, the game used to kill on team change. doing that in a plugin here may interfere with stuff like ff2. You can just always kill/respawn them, removing the team checks I added if you like.
__________________
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-24-2016 , 02:22   Re: [TF2] Autobalance immunity/swapteam
Reply With Quote #8

Oh, right, tbh i know nothing about coding, could you please remove the team checks for me? Sorry for being stupid..

Last edited by Stropy; 12-24-2016 at 02:23.
Stropy is offline
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 12-24-2016 , 07:00   Re: [TF2] Autobalance immunity/swapteam
Reply With Quote #9

Quote:
Originally Posted by Stropy View Post
Oh, right, tbh i know nothing about coding, could you please remove the team checks for me? Sorry for being stupid..
You don't have to be sorry, the simple fact you used that plugin and gave feedbacks does not make you stupid

Code:
#pragma semicolon 1 #include <sourcemod> #include <sdktools> #include <tf2> #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); } public Event_PlayerTeam(Handle:hEvent, const String:name[], bool:dontBroadcast) {     new userid = GetEventInt(hEvent, "userid");     new client = GetClientOfUserId(userid);     if(client && IsClientInGame(client))     {                  FakeClientCommand(client, "kill");          SDKHooks_TakeDamage(client, client, client, 9999.0);                RequestFrame(frame_respawn, userid);     } } public frame_respawn(any:userid) {     new client = GetClientOfUserId(userid);     if(client && IsClientInGame(client) && IsPlayerAlive(client))     {         TF2_RespawnPlayer(client);     } }

Edited friagram's code, I'm kinda surprised respawning a spectator does not cause a crash.
I remember it being a problem with my tf2 respawn api code (https://github.com/Benoist3012/-TF2--Respawn-System-API)
__________________
Benoist3012 is offline
YoNer
Member
Join Date: Jul 2014
Old 12-24-2016 , 11:52   Re: [TF2] Autobalance immunity/swapteam
Reply With Quote #10

Quote:
Originally Posted by Benoist3012 View Post
You don't have to be sorry, the simple fact you used that plugin and gave feedbacks does not make you stupid

Code:
#pragma semicolon 1 #include <sourcemod> #include <sdktools> #include <tf2> #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); } public Event_PlayerTeam(Handle:hEvent, const String:name[], bool:dontBroadcast) {     new userid = GetEventInt(hEvent, "userid");     new client = GetClientOfUserId(userid);     if(client && IsClientInGame(client))     {                  FakeClientCommand(client, "kill");          SDKHooks_TakeDamage(client, client, client, 9999.0);                RequestFrame(frame_respawn, userid);     } } public frame_respawn(any:userid) {     new client = GetClientOfUserId(userid);     if(client && IsClientInGame(client) && IsPlayerAlive(client))     {         TF2_RespawnPlayer(client);     } }

Edited friagram's code, I'm kinda surprised respawning a spectator does not cause a crash.
I remember it being a problem with my tf2 respawn api code (https://github.com/Benoist3012/-TF2--Respawn-System-API)

There is still one issue with this approach, if you launch a missile and or pipe bomb and join spec they are not destroyed and keep hurting other players. Couldnt this be fixed by killing all child entities as well?

Last edited by YoNer; 12-24-2016 at 12:04.
YoNer 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 08:55.


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