| okletsgo |
12-07-2011 05:01 |
Not work ,why ?
1 Attachment(s)
I find this code , bu not work ,why ?
Can fix this plugin ?
PHP Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN ""
#define VERSION "1.0"
#define AUTHOR "scriptxxcaz"
static jointeam[] = "jointeam"
static Spectator[] = "3"
new players[32],t_num,ct_num
new players_per_team
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event( "TeamInfo", "join_team", "a")
players_per_team = register_cvar("amxx_playerspt","5")
}
bool:teams_full() {
get_players(players,t_num,"c","T")
get_players(players,ct_num,"c","CT")
new total_num = t_num + ct_num
if(total_num == (players_per_team * 2)) return true
return false
}
public client_putinserver(id) {
new full = bool:teams_full()
if(full)
{
engclient_cmd(id,jointeam,Spectator)
}
}
public join_team() {
new id = read_data(1)
new user_team[32]
read_data(2, user_team, 31)
if(!is_user_connected(id)) return PLUGIN_CONTINUE
new msg[32]
format(msg,31,"echo Only %s players per team allowed",players_per_team)
switch(user_team[0])
{
case 'C':
{
if(teams_full())
{
engclient_cmd(id,"disconnect")
engclient_cmd(id,msg)
}
if(ct_num == 5)
{
client_print(id,print_chat,"Counter Terrorist's have 5 players already. You must join the Terrorist's")
engclient_cmd(id,jointeam,Spectator)
}
}
case 'T':
{
if(teams_full())
{
engclient_cmd(id,"disconnect")
engclient_cmd(id,msg)
}
if(t_num == 5)
{
client_print(id,print_chat,"Terrorist's have 5 players already. You must join the Counter Terrorist's")
engclient_cmd(id,jointeam,Spectator)
}
}
}
return PLUGIN_CONTINUE
}
|