Raised This Month: $ Target: $400
 0% 

[REQ] Set random user automatically if player x leave


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
JoaoVieira
Senior Member
Join Date: May 2013
Location: Portugal
Old 02-08-2016 , 08:09   Re: [REQ] Set random user automatically if player x leave
Reply With Quote #3

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(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(Simonnick31 )
        
ColorChat(0NORMAL"^04[SMART TEAM PORTUGAL]^01 ^03%s^01 e o ^04lider!^01"nick);
    }
}


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 );
        
        new 
players[32], pnum
        
for(new i=1i<=g_max_playersi++)
        {    
            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_ctCS_TEAM_CT);
        
        
announce_t_change(new_ctid)
        
    }
}

public 
announce_t_change(newidoldid)
{
    new 
msg[160], otname[32], ntname[32]
    
get_user_name(oldidotname31)
    
get_user_name(newidntname31)
{
    
ColorChat(0GREEN"[SMART TEAM PORTUGAL] O ^04Lider^01 ^03%s^01 desconectou-se e o %s foi o escolhido para ser ^03Lider^01."otnamentname)
}
for(new 
i=1i<=g_max_playersi++){
    
ColorChat(0GREEN"[SMART TEAM PORTUGAL] O ^04Lider^01 ^03%s^01 desconectou-se e o ^03%s^01 foi o escolhido para ser ^03Lider^01."otnamentname)         
    
message_begin(MSG_ONEg_msg_saytext_i)
    
write_byte(oldid)
    
write_string(msg)
    
message_end()
}
}

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;


Last edited by JoaoVieira; 02-08-2016 at 08:11.
JoaoVieira is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:01.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode