AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   General (https://forums.alliedmods.net/forumdisplay.php?f=58)
-   -   [TF2] Autobalance immunity/swapteam (https://forums.alliedmods.net/showthread.php?t=291820)

WebNoob 12-22-2016 18:28

[TF2] Autobalance immunity/swapteam
 
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?

psychonic 12-22-2016 18:49

Re: [TF2] Autobalance immunity/swapteam
 
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.

Fearts 12-22-2016 23:19

Re: [TF2] Autobalance immunity/swapteam
 
@psychonic

Is there no other way then editing every plugin? Like a very large number of plugins use ChangeClientTeam.

friagram 12-23-2016 01:51

Re: [TF2] Autobalance immunity/swapteam
 
Quote:

Originally Posted by psychonic (Post 2479816)
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.

friagram 12-23-2016 02:07

Re: [TF2] Autobalance immunity/swapteam
 
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);
    }



Stropy 12-23-2016 11:13

Re: [TF2] Autobalance immunity/swapteam
 
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.

friagram 12-23-2016 12:47

Re: [TF2] Autobalance immunity/swapteam
 
Quote:

Originally Posted by Stropy (Post 2479973)
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.

Stropy 12-24-2016 02:22

Re: [TF2] Autobalance immunity/swapteam
 
Oh, right, tbh i know nothing about coding, could you please remove the team checks for me? Sorry for being stupid..

Benoist3012 12-24-2016 07:00

Re: [TF2] Autobalance immunity/swapteam
 
Quote:

Originally Posted by Stropy (Post 2480121)
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 :bee:

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)

ZulukinG 12-24-2016 09:18

Re: [TF2] Autobalance immunity/swapteam
 
Friagram, would you mind explaining me how to use this code you just posted? Do I need to write into a specific file ? Can you give detailed explanations plz? Thank you !


All times are GMT -4. The time now is 22:05.

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