Senior Member
Join Date: May 2013
Location: Portugal
|
02-05-2016
, 19:00
Re: Plugin Simon
|
#2
|
PHP Code:
#include < amxmodx > #include < cstrike > #include < ColorChat > #include < fun > #include < hamsandwich > #include < dhudmessage >
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" ); register_clcmd( "say /lider", "CmdSimon" ); register_clcmd( "say /mudar", "CmdChange" ); 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, 32) ColorChat(0, NORMAL, "^04[SMART TEAM PORTUGAL]^01 ^03%s^01 e o ^04lider!^01", nick); } }
public CmdChange( id ) { if( id != g_iSimon ) { ColorChat( id, NORMAL, "%s So o ^03lider ^01pode usar este comando!", g_szPrefix ); return PLUGIN_HANDLED; } new hMenu = menu_create( "\r[SMART TEAM PORTUGAL]^n\yEscolhe outro lider:", "ChangeMenu_Handler" ); new szName[ 32 ], szData[ 6 ]; new iPlayers[ 32 ], iNum; get_players( iPlayers, iNum, "ae", "CT" ); for( new i = 0, iPlayer; i < iNum; i++ ) { iPlayer = iPlayers[ i ]; get_user_name( iPlayer, szName, charsmax( szName ) ); num_to_str( iPlayer, szData, charsmax( szData ) ); menu_additem( hMenu, szName, szData ); } menu_display( id, hMenu, 0 ); return PLUGIN_HANDLED; }
public ChangeMenu_Handler( id, hMenu, iItem ) { if( iItem == MENU_EXIT ) { menu_destroy( hMenu ); return PLUGIN_HANDLED; } new iAccess, hCallback, szData[ 6 ], szName[ 32 ]; menu_item_getinfo( hMenu, iItem, iAccess, szData, charsmax( szData ), szName, charsmax( szName ), hCallback ); new iPlayer = str_to_num( szData ); if( !is_user_alive( iPlayer ) ) { ColorChat( id, NORMAL, "%s Esse jogador nao esta mais disponivel para ser o ^03lider^01.", g_szPrefix ); return PLUGIN_HANDLED; } g_iSimon = iPlayer; ColorChat( 0, NORMAL, "%s ^03%s ^01e o novo ^03lider^01.", g_szPrefix, szName ); return PLUGIN_HANDLED; }
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 ); return PLUGIN_HANDLED; } return PLUGIN_HANDLED; }
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; }
Is this later? XD
#edit
If u are here you can put this plugin on hud here
Code:
get_user_name(Simon, nick, 32)
ColorChat(0, NORMAL, "^04[SMART TEAM PORTUGAL]^01 ^03%s^01 e o ^04lider!^01", nick);
|
|