Remove flag "a" from get_players. Put "h" instead or nothing.
http://www.amxmodx.org/funcwiki.php?go=func&id=174
Also, you don't need to check if player is connected.
I would code it this way :
PHP Code:
#include <amxmodx>
#include <fakemeta>
#define PLUGIN "Auto Change Team"
#define VERSION "1.0"
#define AUTHOR "LostSkill"
new const START[] = "sound/tmreverse.mp3"
new const END[] = "sound/tmreversed.mp3"
new g_iRoundCount = 1
new g_iMaxPlayers
public plugin_precache()
{
precache_generic(START)
precache_generic(END)
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("HLTV", "Event_HLTV_New_Round", "a", "1=0", "2=0")
register_logevent("Logevent_Round_End", 2, "1=Round_End")
register_event("TextMsg", "Event_TextMsg_Restart", "a", "2&#Game_C", "2&#Game_w")
register_event("DeathMsg", "Event_DeathMsg", "a")
g_iMaxPlayers = get_maxplayers()
}
public Event_TextMsg_Restart()
{
g_iRoundCount = 0
}
public Event_HLTV_New_Round()
{
if( ++g_iRoundCount == 6 )
client_cmd(0, "mp3 play %s", END)
}
public Logevent_Round_End()
{
if( g_iRoundCount != 5 )
return
client_print(0, print_chat, "** Don't change team !!")
client_cmd(0, "mp3 play %s", START)
for(new id; id<=g_iMaxPlayers; id++)
{
if( !is_user_connected(id) || is_user_hltv(id) )
{
continue
}
switch( get_pdata_int(id, 114) )
{
case 1:set_pdata_int(id, 114, 2)
case 2:set_pdata_int(id, 114, 1)
}
}
}
public Event_DeathMsg()
{
if( g_iRoundCount == 5 )
{
client_print(read_data(2), print_chat, "** Don't change team !!")
}
}
__________________