Raised This Month: $23 Target: $400
 5% 

[CSGO]Disable team switch for losing team plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sajmooooon
Senior Member
Join Date: Nov 2018
Location: Slovakia
Old 02-20-2021 , 14:59   [CSGO]Disable team switch for losing team plugin
Reply With Quote #1

Hi, I'm looking for plugin that will disable team switch during game for players who are in team which is losing. I found only older plugins and they disable switching for both teams.

Thanks for help.

Last edited by Sajmooooon; 02-20-2021 at 14:59.
Sajmooooon is offline
xFlane
AlliedModders Donor
Join Date: Nov 2017
Location: Israel
Old 02-23-2021 , 09:26   Re: [CSGO]Disable team switch for losing team plugin
Reply With Quote #2

PHP Code:
#include <sourcemod>
#include <cstrike>

#pragma semicolon 1

#define PLUGIN_VERSION "1.00"

public Plugin:myinfo = {
    
name "Lock losing team",
    
author "xFlane",
    
description "Prevents switching team when on the losing team.",
    
version PLUGIN_VERSION,
    
url "https://steamcommunity.com/id/xflane/"
};

public 
OnPluginStart() {
    
AddCommandListener(Event_JoinTeam"jointeam");    
}

public 
Action Event_JoinTeam(int client, const char[] commandint args) {
    
int iLosingTeam GetLosingTeam();

    if (
iLosingTeam == -1// Tie.
        
return Plugin_Continue;

    if (
GetClientTeam(client) != iLosingTeam)
        return 
Plugin_Continue;

    
PrintToChat(client"You cant switch teams when your team is losing!");
    return 
Plugin_Handled;
}

int GetLosingTeam() {
    
int iCTScore CS_GetTeamScore(CS_TEAM_CT);
    
int iTScore CS_GetTeamScore(CS_TEAM_T);

    if (
iCTScore == iTScore)
        return -
1;

    return 
iCTScore iTScore CS_TEAM_T CS_TEAM_CT;

Not tested but there's no reason it wouldn't work.
Attached Files
File Type: sp Get Plugin or Get Source (locklosingteam.sp - 8 views - 975 Bytes)
File Type: smx locklosingteam.smx (3.0 KB, 5 views)
__________________
Taking private requests.
xFlane is offline
Sajmooooon
Senior Member
Join Date: Nov 2018
Location: Slovakia
Old 02-23-2021 , 09:29   Re: [CSGO]Disable team switch for losing team plugin
Reply With Quote #3

Quote:
Originally Posted by xFlane View Post
PHP Code:
#include <sourcemod>
#include <cstrike>

#pragma semicolon 1

#define PLUGIN_VERSION "1.00"

public Plugin:myinfo = {
    
name "Lock losing team",
    
author "xFlane",
    
description "Prevents switching team when on the losing team.",
    
version PLUGIN_VERSION,
    
url "https://steamcommunity.com/id/xflane/"
};

public 
OnPluginStart() {
    
AddCommandListener(Event_JoinTeam"jointeam");    
}

public 
Action Event_JoinTeam(int client, const char[] commandint args) {
    
int iLosingTeam GetLosingTeam();

    if (
iLosingTeam == -1// Tie.
        
return Plugin_Continue;

    if (
GetClientTeam(client) != iLosingTeam)
        return 
Plugin_Continue;

    
PrintToChat(client"You cant switch teams when your team is losing!");
    return 
Plugin_Handled;
}

int GetLosingTeam() {
    
int iCTScore CS_GetTeamScore(CS_TEAM_CT);
    
int iTScore CS_GetTeamScore(CS_TEAM_T);

    if (
iCTScore == iTScore)
        return -
1;

    return 
iCTScore iTScore CS_TEAM_T CS_TEAM_CT;

Not tested but there's no reason it wouldn't work.
Thanks, works great

Last edited by Sajmooooon; 02-23-2021 at 10:56.
Sajmooooon 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 00:24.


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