I didnt test because i cant , can some one see if its all right?
PHP Code:
#include < amxmodx >
#include < cstrike >
#include < ColorChat >
#include < fun >
#include < fakemeta >
#include < hamsandwich >
#include < dhudmessage >
#pragma tabsize 0
#define _IsPlayer(%1) (1<=%1<=g_max_players)
new g_max_players
new g_msg_saytext
public g_iSimon;
new const g_szPrefix[ ] = "^04[SMART TEAM PORTUGAL]^01";
public plugin_init()
{
register_plugin( "Simon", "1.0", "H3avY Ra1n + sempz" );
register_event( "DeathMsg", "Event_DeathMsg", "a" );
g_max_players = get_maxplayers()
g_msg_saytext = get_user_msgid("SayText")
register_clcmd( "say /lider", "CmdSimon" );
register_logevent( "LiderAutomatico", 2, "1=Round_Start");
}
public LiderAutomatico()
{
new players[32], count;
get_players(players, count, "aceh", "CT");
if (count >= 1)
{
new Simon = players[random(count)];
g_iSimon = Simon;
cs_set_user_team(Simon, CS_TEAM_CT);
new nick[33]
get_user_name(Simon, nick, 31 )
ColorChat(0, NORMAL, "^04[SMART TEAM PORTUGAL]^01 ^03%s^01 e o ^04lider!^01", nick);
}
}
public CmdSimon( id )
{
if( cs_get_user_team( id ) != CS_TEAM_CT )
{
ColorChat( id, NORMAL, "%s ^01Precissas de ser um ^03guarda^01 para usar este comando.", g_szPrefix );
return PLUGIN_HANDLED;
}
else if( g_iSimon == id )
{
ColorChat( id, NORMAL, "%s ^01Tu ja es o ^04Lider^01!", g_szPrefix );
return PLUGIN_HANDLED;
}
else if( is_user_alive( g_iSimon ) )
{
ColorChat( id, NORMAL, "%s ^01Alguem ja e o Lider.", g_szPrefix );
return PLUGIN_HANDLED;
}
g_iSimon = id;
new name[32];
get_user_name( id, name, 31 );
ColorChat( 0, NORMAL, "%s ^03%s ^01 e agora Lider.", g_szPrefix, name );
return PLUGIN_CONTINUE;
}
public client_disconnect( id )
{
if( g_iSimon == id )
{
g_iSimon = 0;
ColorChat( 0, NORMAL, "%s ^01Quem estava em Lider saiu do jogo.", g_szPrefix );
new players[32], pnum
for(new i=1; i<=g_max_players; i++)
{
if(cs_get_user_team(i) == CS_TEAM_CT)
return
players[pnum++] = i
}
if(pnum<=0)
return
new new_ct = players[random(pnum)]
g_iSimon = new_ct;
cs_set_user_team(new_ct, CS_TEAM_CT);
announce_t_change(new_ct, id)
}
}
public announce_t_change(newid, oldid)
{
new msg[160], otname[32], ntname[32]
get_user_name(oldid, otname, 31)
get_user_name(newid, ntname, 31)
{
ColorChat(0, GREEN, "[SMART TEAM PORTUGAL] O ^04Lider^01 ^03%s^01 desconectou-se e o %s foi o escolhido para ser ^03Lider^01.", otname, ntname)
}
for(new i=1; i<=g_max_players; i++){
ColorChat(0, GREEN, "[SMART TEAM PORTUGAL] O ^04Lider^01 ^03%s^01 desconectou-se e o ^03%s^01 foi o escolhido para ser ^03Lider^01.", otname, ntname)
message_begin(MSG_ONE, g_msg_saytext, _, i)
write_byte(oldid)
write_string(msg)
message_end()
}
}
public Event_DeathMsg()
{
new victim = read_data( 2 );
if( !is_user_connected( victim ) )
return PLUGIN_HANDLED;
if( victim == g_iSimon )
{
ColorChat( 0, NORMAL, "%s ^01Quem estava em Lider morreu.", g_szPrefix );
g_iSimon = 0;
return PLUGIN_HANDLED;
}
return PLUGIN_HANDLED;
}