AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Need fix "Teams Limiter" (https://forums.alliedmods.net/showthread.php?t=173703)

okletsgo 12-09-2011 09:37

Need fix "Teams Limiter"
 
Link : http://forums.alliedmods.net/showpos...3&postcount=12

This code null in HLDS 4554 , Need fix this.

PHP Code:

#include <amxmodx>

enum
{
    
TEAM_T 1,
    
TEAM_CT
};

new const 
TEAM_SPEC 6;

new 
Count[3];
new 
LimitPcvar;
new 
ChangedTeams[33]; // bypass double call.

public plugin_init()
{
    
register_plugin("Teams Limiter""1.0""Dores");
    
    
LimitPcvar register_cvar("teams_limit""5");
    
    
register_event("TeamInfo""moved_not_spec""a""2=TERRORIST""2=CT");
    
register_event("TeamInfo""moved_spectator""a""2=SPECTATOR");
    
    
register_clcmd("jointeam""Cmd_HookJoinTeam");
}

public 
client_disconnect(id)
{
    new 
team ChangedTeams[id];
    
    if (
team == TEAM_T || team == TEAM_CT)
        
Count[team]--;
    
    
ChangedTeams[id] = 0;
}

public 
server_changelevel(map[])
{
    
Count[TEAM_T] = 0;
    
Count[TEAM_CT] = 0;
}

public 
plugin_pause()
{
    
Count[TEAM_T] = 0;
    
Count[TEAM_CT] = 0;
}

public 
Cmd_HookJoinTeam(id)
{
    new 
arg[1], team;
    
    
read_argv(1arg1);
    
team str_to_num(arg);
    
    if(
team == TEAM_SPEC || team == 5)
        return 
PLUGIN_CONTINUE;
    
    if(
Count[team] == get_pcvar_num(LimitPcvar))
    {
        
client_print(idprint_center"[AMXX] This team has reached it's limit!");        
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
moved_not_spec()
{
    new 
team[1], Team;
    
read_data(2team1);
    
Team team[0] == 'C' TEAM_CT TEAM_T;
    
    new 
id read_data(1);
    
    if (
ChangedTeams[id] == Team)
        return 
PLUGIN_CONTINUE;
    
    
Count[Team]++;
    
ChangedTeams[id] = Team;
    
    new 
oppTeam Team// 3 - Team is the opposite team (if Team = 1(terror), the opposite team will be 2(CT)).
    
if (get_user_team(id) == oppTeam// changed teams. get_user_team() updates only after this event.
        
Count[oppTeam]--;
    
    return 
PLUGIN_CONTINUE;
}

public 
moved_spectator()
{
    new 
id read_data(1);
    
    new 
lastTeam ChangedTeams[id];
    if (
lastTeam == TEAM_T || lastTeam == TEAM_CT)
    {
        
Count[lastTeam]--;
        
ChangedTeams[id] = 0;
    }


Note: I tried to Team Limiter , have bug ,I would not look at such Team Limiter .

okletsgo 12-09-2011 09:39

Re: Need fix "Teams Limiter"
 
help ,plz

fysiks 12-09-2011 16:57

Re: Need fix "Teams Limiter"
 
Use this one.

okletsgo 12-09-2011 23:31

Re: Need fix "Teams Limiter"
 
Quote:

Originally Posted by fysiks (Post 1610461)
Use this one.

can't limit 5(ct)-5(t)

fysiks 12-09-2011 23:35

Re: Need fix "Teams Limiter"
 
Quote:

Originally Posted by okletsgo (Post 1610603)
can't limit 5(ct)-5(t)

Sorry, I got the wrong Exolent plugin. A quick search in the Approved Plugins section for "team limiter" results in this.

okletsgo 12-10-2011 01:29

Re: Need fix "Teams Limiter"
 
Quote:

Originally Posted by fysiks (Post 1610604)
Sorry, I got the wrong Exolent plugin. A quick search in the Approved Plugins section for "team limiter" results in this.

I tried Team Limiter , have bug ,I would not look at such Team Limiter .

Can u write a only limit t(5) - ct(5) ?

fysiks 12-10-2011 19:30

Re: Need fix "Teams Limiter"
 
Quote:

Originally Posted by okletsgo (Post 1610627)
I tried Team Limiter , have bug ,I would not look at such Team Limiter .

Can u write a only limit t(5) - ct(5) ?

The one I posted this time should work fine. Read through the thread and see if someone else has already solved your issue.

okletsgo 12-10-2011 23:32

Re: Need fix "Teams Limiter"
 
When team_limits 5 5, I got this, can't join any team :
(Early pm author ,but not reply.)

http://forums.alliedmods.net/attachm...6&d=1265215932

fysiks 12-11-2011 18:10

Re: Need fix "Teams Limiter"
 
Quote:

Originally Posted by okletsgo (Post 1611128)
(Early pm author ,but not reply.)

Don't PM the author. Search the thread then post in the thread if you can't find the solution.

okletsgo 12-12-2011 07:24

Re: Need fix "Teams Limiter"
 
Quote:

Originally Posted by fysiks (Post 1611597)
Don't PM the author. Search the thread then post in the thread if you can't find the solution.

This problem is not solved .


All times are GMT -4. The time now is 20:51.

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