Raised This Month: $32 Target: $400
 8% 

[TF2]Simple change team on suicide.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sweg.
Junior Member
Join Date: Jan 2017
Location: Why do you want to know
Old 03-11-2021 , 20:24   [TF2]Simple change team on suicide.
Reply With Quote #1

Hello, i just need a simple plugin that switch RED players to BLU when they commit suicide.
__________________
damn you
sweg. is offline
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 03-12-2021 , 09:01   Re: [TF2]Simple change team on suicide.
Reply With Quote #2

Untested, should work though.
PHP Code:
#include <sourcemod>
#include <tf2_stocks>

bool g_bWaitingForPlayers false;

public 
void OnPluginStart()
{
    
HookEvent("player_death"Event_PlayerDeath);
}

public 
void TF2_OnWaitingForPlayersStart()
{
    
g_bWaitingForPlayers true;
}

public 
void TF2_OnWaitingForPlayersEnd()
{
    
g_bWaitingForPlayers false;
}

public 
void Event_PlayerDeath(Event hEvent, const char[] sNamebool bDontBroadcast)
{
    if (
GameRules_GetRoundState() == RoundState_RoundRunning && !g_bWaitingForPlayers && !(hEvent.GetInt("death_flags") & TF_DEATHFLAG_DEADRINGER)) // Make sure death event was not triggered by dead ringer
    
{
        
int iVictim GetClientOfUserId(hEvent.GetInt("userid"));
        if (
iVictim == GetClientOfUserId(hEvent.GetInt("attacker")) && iVictim != && TF2_GetClientTeam(iVictim) == TFTeam_Red)
        {
            
TF2_ChangeClientTeam(iVictimTFTeam_Blue);
        }
    }

Attached Files
File Type: sp Get Plugin or Get Source (change_team_on_suicide.sp - 65 views - 880 Bytes)

Last edited by ThatKidWhoGames; 03-20-2021 at 09:33.
ThatKidWhoGames is offline
sweg.
Junior Member
Join Date: Jan 2017
Location: Why do you want to know
Old 03-12-2021 , 10:56   Re: [TF2]Simple change team on suicide.
Reply With Quote #3

thank you !
__________________
damn you
sweg. is offline
sweg.
Junior Member
Join Date: Jan 2017
Location: Why do you want to know
Old 03-12-2021 , 17:15   Re: [TF2]Simple change team on suicide.
Reply With Quote #4

I don't know if you'll see this or if anyone will, but if you or anyone does i'd like to have it so it only happens after the round has started
__________________
damn you
sweg. is offline
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 03-12-2021 , 22:04   Re: [TF2]Simple change team on suicide.
Reply With Quote #5

Quote:
Originally Posted by sweg. View Post
I don't know if you'll see this or if anyone will, but if you or anyone does i'd like to have it so it only happens after the round has started
Updated my post to reflect this change, let me know how it goes!
ThatKidWhoGames is offline
sweg.
Junior Member
Join Date: Jan 2017
Location: Why do you want to know
Old 03-19-2021 , 16:04   Re: [TF2]Simple change team on suicide.
Reply With Quote #6

Well i have to say, it works pretty damn well ! Thanks a lot. If i had one last request it would be to disable the plugin during setup.
__________________
damn you

Last edited by sweg.; 03-19-2021 at 16:52.
sweg. is offline
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 03-20-2021 , 09:34   Re: [TF2]Simple change team on suicide.
Reply With Quote #7

Quote:
Originally Posted by sweg. View Post
Well i have to say, it works pretty damn well ! Thanks a lot. If i had one last request it would be to disable the plugin during setup.
Updated my post, let me know how it goes!
ThatKidWhoGames is offline
sweg.
Junior Member
Join Date: Jan 2017
Location: Why do you want to know
Old 03-26-2021 , 01:23   Re: [TF2]Simple change team on suicide.
Reply With Quote #8

Well the round part doesn't seems to work. Oh well, it doesn't matter. Apart for that it works just fine. Thanks you for your help !
__________________
damn you
sweg. is offline
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 03-26-2021 , 07:33   Re: [TF2]Simple change team on suicide.
Reply With Quote #9

Quote:
Originally Posted by sweg. View Post
Well the round part doesn't seems to work. Oh well, it doesn't matter. Apart for that it works just fine. Thanks you for your help !
My bad, for some reason I read your post as disabling it during the waiting for players period!
ThatKidWhoGames 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 10:38.


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