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

[NEED] Plugin to disable autoteamselect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kamizun
AlliedModders Donor
Join Date: May 2015
Location: Portugal
Old 06-05-2015 , 16:48   [NEED] Plugin to disable autoteamselect
Reply With Quote #1

Hi there, i have a bhop / mg server and there is only one team, the other team dont have spawn points, but somehow they can press "m" to change team and then 5 wich is autoteamselect?
So they go to the other team, and end the round.
I need to disable that but i dont know any plugin, and dont know how to create.
Sry for my bad english
They spam the team and auto select button, or just m5 m5 m5.

Last edited by Kamizun; 06-06-2015 at 16:19.
Kamizun is offline
Darkness_
Veteran Member
Join Date: Nov 2014
Old 06-05-2015 , 18:29   Re: [NEED] Plugin to disable autoteamselect
Reply With Quote #2

Not tested.

PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>

#define CS_TEAM_SPEC 1
#define CS_TEAM_T 2
#define CS_TEAM_CT 3

int g_iTSpawns;
int g_iCTSpawns;

public 
void OnPluginStart() {
    
AddCommandListener(Command_OnJoinTeam"jointeam");
    
CountSpawns();
}

public 
void OnMapStart() {
    
CreateTimer(1.0Timer_CountSpawnsINVALID_HANDLETIMER_FLAG_NO_MAPCHANGE);
}

public 
Action Timer_CountSpawns(Handle timer) {
    
CountSpawns();
    return 
Plugin_Stop;
}

stock void CountSpawns() {
    
g_iTSpawns 0;
    
g_iCTSpawns 0;
    
int iEnt;
    while((
iEnt FindEntityByClassname(iEnt"info_player_terrorist")) != -1) {
        if (!
IsValidEntity(iEnt))
            continue;
        
g_iTSpawns++;
    }
    while((
iEnt FindEntityByClassname(iEnt"info_player_counterterrorist")) != -1) {
        if (!
IsValidEntity(iEnt))
            continue;
        
g_iCTSpawns++;
    }
}

public 
Action Command_OnJoinTeam(int client, const char[] commandint args) {
    if (!
client || !IsClientInGame(client) || IsFakeClient(client))
        return 
Plugin_Continue;

    
char szTargetTeam[3];
    
GetCmdArg(1szTargetTeamsizeof(szTargetTeam));
    
int iTargetTeam StringToInt(szTargetTeam);
    
    if (
iTargetTeam == CS_TEAM_T && g_iTSpawns == 0) {
        
PrintToChat(client"[SM] This map does not have sufficient Terrorist spawns.");
        if (
g_iCTSpawns 0)
            
ChangeClientTeam(clientCS_TEAM_CT);
        return 
Plugin_Stop;
    } else if (
iTargetTeam == CS_TEAM_CT && g_iCTSpawns == 0) {
        
PrintToChat(client"[SM] This map does not have sufficient Counter-Terrorist spawns.");
        if (
g_iTSpawns 0)
            
ChangeClientTeam(clientCS_TEAM_T);
        return 
Plugin_Stop;
    }

    return 
Plugin_Continue;

Darkness_ is offline
Mehis
Senior Member
Join Date: Mar 2013
Location: basement
Old 06-05-2015 , 20:22   Re: [NEED] Plugin to disable autoteamselect
Reply With Quote #3

You should first try mp_ignore_round_win_conditions 1
Mehis is offline
Kamizun
AlliedModders Donor
Join Date: May 2015
Location: Portugal
Old 06-06-2015 , 09:40   Re: [NEED] Plugin to disable autoteamselect
Reply With Quote #4

Quote:
Originally Posted by Mehis View Post
You should first try mp_ignore_round_win_conditions 1
But with that, if all players die, the round dont start again, right?
Kamizun is offline
Kamizun
AlliedModders Donor
Join Date: May 2015
Location: Portugal
Old 06-06-2015 , 09:50   Re: [NEED] Plugin to disable autoteamselect
Reply With Quote #5

Quote:
Originally Posted by Darkness_ View Post
Not tested.

PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>

#define CS_TEAM_SPEC 1
#define CS_TEAM_T 2
#define CS_TEAM_CT 3

int g_iTSpawns;
int g_iCTSpawns;

public 
void OnPluginStart() {
    
AddCommandListener(Command_OnJoinTeam"jointeam");
    
CountSpawns();
}

public 
void OnMapStart() {
    
CreateTimer(1.0Timer_CountSpawnsINVALID_HANDLETIMER_FLAG_NO_MAPCHANGE);
}

public 
Action Timer_CountSpawns(Handle timer) {
    
CountSpawns();
    return 
Plugin_Stop;
}

stock void CountSpawns() {
    
g_iTSpawns 0;
    
g_iCTSpawns 0;
    
int iEnt;
    while((
iEnt FindEntityByClassname(iEnt"info_player_terrorist")) != -1) {
        if (!
IsValidEntity(iEnt))
            continue;
        
g_iTSpawns++;
    }
    while((
iEnt FindEntityByClassname(iEnt"info_player_counterterrorist")) != -1) {
        if (!
IsValidEntity(iEnt))
            continue;
        
g_iCTSpawns++;
    }
}

public 
Action Command_OnJoinTeam(int client, const char[] commandint args) {
    if (!
client || !IsClientInGame(client) || IsFakeClient(client))
        return 
Plugin_Continue;

    
char szTargetTeam[3];
    
GetCmdArg(1szTargetTeamsizeof(szTargetTeam));
    
int iTargetTeam StringToInt(szTargetTeam);
    
    if (
iTargetTeam == CS_TEAM_T && g_iTSpawns == 0) {
        
PrintToChat(client"[SM] This map does not have sufficient Terrorist spawns.");
        if (
g_iCTSpawns 0)
            
ChangeClientTeam(clientCS_TEAM_CT);
        return 
Plugin_Stop;
    } else if (
iTargetTeam == CS_TEAM_CT && g_iCTSpawns == 0) {
        
PrintToChat(client"[SM] This map does not have sufficient Counter-Terrorist spawns.");
        if (
g_iTSpawns 0)
            
ChangeClientTeam(clientCS_TEAM_T);
        return 
Plugin_Stop;
    }

    return 
Plugin_Continue;

It worked, thx a lot! // Nope, fail it doesnt work.

They spam the terrorist button, and the auto select, and they can change team.

Last edited by Kamizun; 06-06-2015 at 11:56.
Kamizun 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 17:36.


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