Quote:
Originally Posted by dylstew
You cna just decrease the mapxplayercount to 12 and it would be the same thing.
|
OK I will try to do this thing instead. This is a code I wrote. I learn a lot from warmod, but it still not work. If anyone could see what the problem is, I really appreciate that.
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <tf2>
#define TEAM_SPEC 1
#define TEAM_RED 2
#define TEAM_BLUE 3
new Handle:g_hTeamLimit;
new Handle:g_hEnableTeamLimit;
public Plugin:myinfo =
{
name = "TF2 Limit 6 Players Per Team",
author = "duydangle, noobcannonlol",
description = "For use on competitive server",
version = "1.0",
url = "Xtremezone.VN"
}
public OnPluginStart()
{
g_hEnableTeamLimit = CreateConVar("sm_enableteamlimit", "1", "1 (on) or 0 (off)");
g_hTeamLimit = CreateConVar("sm_teamlimit", "6", "Limit teams to this value");
HookEvent("player_team", Event_Player_Team, EventHookMode_Pre);
}
public Action:Event_Player_Team(Handle:event, const String:name[], bool:dontBroadcast)
{
if (!GetConVarBool(g_hEnableTeamLimit))
return Plugin_Continue;
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new oldteam = GetEventInt(event, "oldteam");
new newteam = GetEventInt(event, "team");
if ((newteam == TEAM_RED) || (newteam == TEAM_BLUE))
{
if (GetTeamClientCount(newteam) > GetTeamLimit())
{
PrintToChat(client, "That team is full (%s/%s)!",g_hTeamLimit, g_hTeamLimit);
ChangeClientTeam(client, oldteam);
return Plugin_Handled;
}
}
return Plugin_Continue;
}
public GetTeamLimit()
{
return GetConVarInt(g_hTeamLimit);
}