Thread: Plugin Simon
View Single Post
JoaoVieira
Senior Member
Join Date: May 2013
Location: Portugal
Old 02-05-2016 , 19:00   Re: Plugin Simon
Reply With Quote #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(playerscount"aceh""CT");
    
    if (
count >= 1)
    {
        new 
Simon players[random(count)];
        
g_iSimon Simon;
        
cs_set_user_team(SimonCS_TEAM_CT);
        new 
nick[33]
        
get_user_name(Simonnick32)
        
ColorChat(0NORMAL"^04[SMART TEAM PORTUGAL]^01 ^03%s^01 e o ^04lider!^01"nick);
    }
}

public 
CmdChangeid )
{
    if( 
id != g_iSimon )
    {
        
ColorChatidNORMAL"%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 
szName32 ], szData];
    new 
iPlayers32 ], iNum;
    
get_playersiPlayersiNum"ae""CT" );
    
    for( new 
0iPlayeriNumi++ )
    {
        
iPlayer iPlayers];
        
        
get_user_nameiPlayerszNamecharsmaxszName ) );
        
num_to_striPlayerszDatacharsmaxszData ) );
        
        
menu_additemhMenuszNameszData );
    }
    
    
menu_displayidhMenu);
    
    return 
PLUGIN_HANDLED;
}

public 
ChangeMenu_HandleridhMenuiItem )
{
    if( 
iItem == MENU_EXIT )
    {
        
menu_destroyhMenu );
        return 
PLUGIN_HANDLED;
    }
    
    new 
iAccesshCallbackszData], szName32 ];
    
menu_item_getinfohMenuiItemiAccessszDatacharsmaxszData ), szNamecharsmaxszName ), hCallback );
    
    new 
iPlayer str_to_numszData );
    
    if( !
is_user_aliveiPlayer ) )
    {
        
ColorChatidNORMAL"%s Esse jogador nao esta mais disponivel para ser o ^03lider^01."g_szPrefix );
        return 
PLUGIN_HANDLED;
    }
    
    
g_iSimon iPlayer;
    
    
ColorChat0NORMAL"%s ^03%s ^01e o novo ^03lider^01."g_szPrefixszName );
    return 
PLUGIN_HANDLED;
}


public 
CmdSimonid )
{
    if( 
cs_get_user_teamid ) != CS_TEAM_CT )
    {
        
ColorChatidNORMAL"%s ^01Precissas de ser um ^03guarda^01 para usar este comando."g_szPrefix );
        return 
PLUGIN_HANDLED;
    }
    
    else if( 
g_iSimon == id )
    {
        
ColorChatidNORMAL"%s ^01Tu ja es o ^04Lider^01!"g_szPrefix );
        return 
PLUGIN_HANDLED;
    }
    
    else if( 
is_user_aliveg_iSimon ) )
    {
        
ColorChatidNORMAL"%s ^01Alguem ja e o Lider."g_szPrefix );
        return 
PLUGIN_HANDLED;
    }
    
    
g_iSimon id;
    
    new 
name[32];
    
get_user_nameidname31 );
    
    
ColorChat0NORMAL"%s ^03%s ^01 e agora Lider."g_szPrefixname );
    return 
PLUGIN_CONTINUE;
    
}

public 
client_disconnectid )
{
    if( 
g_iSimon == id )
    {
        
g_iSimon 0;
        
        
ColorChat0NORMAL"%s ^01Quem estava em Lider saiu do jogo."g_szPrefix );
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_HANDLED;
}

public 
Event_DeathMsg()
{
    new 
victim read_data);
    
    if( !
is_user_connectedvictim ) )
        return 
PLUGIN_HANDLED;
    
    if( 
victim == g_iSimon )
    {
        
ColorChat0NORMAL"%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);
JoaoVieira is offline