View Single Post
Hectik17
AlliedModders Donor
Join Date: Oct 2005
Old 01-30-2017 , 11:40   Re: Team ratio (not JB)
Reply With Quote #12



anyone can edit this to work ?

Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
 
#define PLUGIN "Team limiter"
#define VERSION "1.0"
#define AUTHOR "EFFx"
 
public plugin_init() 
{
 register_plugin(PLUGIN, VERSION, AUTHOR)
 
 register_clcmd("jointeam","PugJoinTeam")
}
public PugJoinTeam(id) 
{
 new sArg[3];
 read_argv(1,sArg,charsmax(sArg));
 return PugCheckTeam(id,str_to_num(sArg));
}
public PugTeamSelect(id,iKey) return PugCheckTeam(id,iKey + 1);
public PugCheckTeam(id,iTeamNew) 
{ 
 switch(iTeamNew)
 {
  case 1,2,5:
  {
   new iPlayers[32],iNum[CsTeams];
   get_players(iPlayers,iNum[CS_TEAM_T],"eh","TERRORIST");
   get_players(iPlayers,iNum[CS_TEAM_CT],"eh","CT");
   
   if((iNum[CS_TEAM_T] >= 5) && (iTeamNew == 1) || (iTeamNew == 5))
   {
    pug_chatcolor(id,"This team is already full!");
    client_cmd(id,"speak buttons/blip2")
    engclient_cmd(id,"chooseteam")
    return PLUGIN_HANDLED
   }
   else if((iNum[CS_TEAM_CT] >= 5) && (iTeamNew == 2) || (iTeamNew == 5))
   {
    pug_chatcolor(id,"This team is already full!");
    client_cmd(id,"speak buttons/blip2")
    engclient_cmd(id,"chooseteam")
    return PLUGIN_HANDLED
   }
  }
 }
 return PLUGIN_CONTINUE
}
stock pug_chatcolor(const id, const input[], any:...)
{
 new count = 1, players[ 32 ]
 static msg[ 191 ]
 vformat( msg, 190, input, 3 )
 format(msg,sizeof msg,"!g[PugMod]!y: %s",msg)
   
 replace_all( msg, 190, "!g", "^4" )
 replace_all( msg, 190, "!y", "^1" )
 replace_all( msg, 190, "!t", "^3" )
   
 if(id) players[ 0 ] = id; else get_players( players, count, "ch" )
 {
  for(new i = 0; i < count; i++)
  {
   if( is_user_connected( players[ i ] ) )
   {
    message_begin( MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[ i ] )  
    write_byte( players[ i ] )
    write_string( msg )
    message_end( )
   }
  }
 }
}

Last edited by Hectik17; 01-30-2017 at 11:44.
Hectik17 is offline