View Single Post
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 01-28-2022 , 07:41   Re: Plugin request (For jb)
Reply With Quote #2

I created this code before a month but i didn't tested it so try it and tell me if it's work or not
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>

#if !defined client_disconnected
    #define client_disconnected client_disconnect
#endif

new iUserName33 ][ 32 ], bool:bRoundEnd

public plugin_init() 
{
    
register_plugin"Replace random player when the last player disconnect" "1.0" "Supremache" );
    
register_logevent("OnRoundEnd"2"1=Round_End")
    
register_event("HLTV""OnRoundStart""a""1=0""2=0")
}

public 
client_authorizedid )
{
    
get_user_nameid iUserNameid ] , charsmaxiUserName[ ] ) );
}

public 
client_disconnectedid )
{
    
GetLastPlayerid )
}

public 
OnRoundStart( )
{
    
bRoundEnd false;
}

public 
OnRoundEnd( )
{
    
bRoundEnd true;
}

public 
GetLastPlayer( const id )
{
    if( 
bRoundEnd )
    {
        return;
    }
    
    new 
iPlayersCsTeams ][ 32 ] , iTeamCountsCsTeams ] , iPlayer;
    
    for ( new 
CsTeams:iTeam CS_TEAM_T iTeam <= CS_TEAM_CT iTeam++ )
    {
        
get_playersiPlayersiTeam ] , iTeamCountsiTeam ] , "ae" , ( iTeam == CS_TEAM_T ) ? "TERRORIST" "CT" );
        
        
iPlayer iPlayersiTeam ][ randomiTeamCountsiTeam ] ) ]
        
        if( !
iTeamCountsiTeam ] )
        {
            
cs_set_user_teamiPlayercs_get_user_teamid ) )
            
set_peviPlayerpev_healthpevidpev_health ) )
            
ExecuteHamBHam_CS_RoundRespawniPlayer )
            
client_print0print_chat"The last player %s has left the game from team %s, %s is the new one."iUserNameid ], iTeamiUserNameiPlayer ] )    
        }
    }

__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 01-28-2022 at 14:29.
Supremache is offline