Raised This Month: $12 Target: $400
 3% 

Team Limiter is not working


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Shad0w93
Member
Join Date: May 2011
Old 01-12-2012 , 16:00   Team Limiter is not working
Reply With Quote #1

Can u guys say me why this is not working?
It should swap a player to CT if there are more Terrorists than the sm_max_terror says.

Code:
#include <sourcemod>

new Handle:g_CvarIgnoreTeamChange = INVALID_HANDLE;
new Handle:g_CvarMax_Terror = INVALID_HANDLE;

public OnPluginStart()
{
    g_CvarIgnoreTeamChange = CreateConVar("sm_ignoreteamchange", "0","Ein- oder Ausschalten!");
    g_CvarMax_Terror = CreateConVar("sm_max_terror", "1","Maximale Anzahl Terroristen");
    AutoExecConfig(true, "TeamLimiter");
}

public Action:Event_PlayerTeam(Handle:event, const String:name[], bool:dontBroadcast)
{   
    PrintToChatAll("Jemand ist zu T gegangen!");
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    new team2 = GetEventInt(event, "team");
    new team;
    new team3;
    for(new i=1;i<=MaxClients;++i)
    {
        if(IsClientInGame(i) && i != client)
        {
            team = GetClientTeam(i);
            if(team == 2)
            {
                team3=team3+1;
            }
                
        }
    }
    if(!GetConVarBool(g_CvarIgnoreTeamChange))
    {

        if(team2 == 2)
        {
            if(GetConVarInt(g_CvarMax_Terror)<team3)
            {
                ChangeClientTeam(client, 3);
            }
        }
        
    }
    return Plugin_Continue;
}
Shad0w93 is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 01-12-2012 , 17:19   Re: Team Limiter is not working
Reply With Quote #2

if that's your entire code, then you're missing hooking the event player_team

I didn't look through your whole code, just noticed you were missing the hook

Last edited by TnTSCS; 01-12-2012 at 17:19.
TnTSCS 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 07:42.


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