Raised This Month: $ Target: $400
 0% 

Solved Block round end, method to pick the last team standing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-26-2018 , 02:19   Re: Block round end, method to pick the last team standing
Reply With Quote #1

You need to block CHalfLifeMultiplay::CheckWinConditions with orpheu or okapi(if you don't want extra files) based on your conditions. Note that okapi is kinda buggy and it may crash under linux. There are many examples about that, see if you can get it to work.(not that I want to advertise my plugins but Objective Reset hooks that function, you may take the signature and code from here).
__________________

Last edited by HamletEagle; 06-26-2018 at 02:21.
HamletEagle is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 06-26-2018 , 09:56   Re: Block round end, method to pick the last team standing
Reply With Quote #2

Quote:
Originally Posted by HamletEagle View Post
You need to block CHalfLifeMultiplay::CheckWinConditions with orpheu or okapi(if you don't want extra files) based on your conditions. Note that okapi is kinda buggy and it may crash under linux. There are many examples about that, see if you can get it to work.(not that I want to advertise my plugins but Objective Reset hooks that function, you may take the signature and code from here).
There's already plugins that do the job (Round Terminator by Arkshine) so I don't have to bother doing that, thanks anyway

Quote:
Originally Posted by CrAzY MaN View Post
Previously, I had a GunGame Server.
And, I was using this to Block Round End.

Maybe this can help you a little bit.
Where did you get this plugin from?
__________________
edon1337 is offline
CrAzY MaN
Senior Member
Join Date: Mar 2017
Location: India
Old 06-26-2018 , 03:21   Re: Block round end, method to pick the last team standing
Reply With Quote #3

Previously, I had a GunGame Server.
And, I was using this to Block Round End.

Maybe this can help you a little bit.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>

#pragma semicolon 1
#pragma ctrlchar '\'

// Some constants you may want to change

const BOT_NUM 2;    // If you, for some reason, want more bots.
                    // Change this and don't forget to add reb_name3, reb_name4 etc. in your config

// These are just the default botnames, they are only used if the cvar is not set! You don't need to change them!
// You do, however, have to add more to this list if you change BOT_NUM
new const DefaultNames[BOT_NUM][ ] = 
{
    
"Free ADMINs/VIPs to TOP 3",
    
"Join Whtsapp Group?-8530088698"
};

//----------------------------------------------------------------------------------------
// Do not change anything below this line if you don't know exactly what you are doing!
//----------------------------------------------------------------------------------------

new const PLUGIN[]    = "Roundend Blocker";
new const 
VERSION[]    = "1.1.100";
new const 
AUTHOR[]    = "Nextra";

new 
p_BlockEndp_BlockPlrMinp_BlockPlrMaxp_FakeFullp_FullKickp_BlockName[BOT_NUM], p_BlockTeam;

const 
TASK_BOTS 666;

new 
g_BotID[BOT_NUM], bool:g_IsConnected[33], bool:g_bFirstRound true;

new 
g_iMaxPlayers;

#define IsValidPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )
#define is_connected(%1) g_IsConnected[%1]

const LINUXDIFF 5;

#if cellbits == 32
    
const OFFSET_TEAM 114;
#else
    
const OFFSET_TEAM 139;
#endif

public plugin_init( )
{
    
register_pluginPLUGINVERSIONAUTHOR );
    
register_cvar"reb_version"VERSIONFCVAR_SERVER|FCVAR_SPONLY );

    
register_logevent"on_RoundEnd"    2"1=Round_End"            );
    
register_logevent"on_RoundStart"    2"1=Round_Start"        );

    
register_messageget_user_msgid"TeamInfo" ), "msg_TeamInfo"     );

    
RegisterHamHam_Spawn"player""BOT_hide");
    
    
p_BlockEnd        register_cvar"reb_enable"    "1"            ),
    
p_BlockPlrMax    register_cvar"reb_plrmax"    "14"            ),
    
p_BlockPlrMin    register_cvar"reb_plrmin"    "12"            ),
    
p_FakeFull        register_cvar"reb_fakefull"    "1"            ),
    
p_FullKick        register_cvar"reb_fullkick" "1"            ),
    
p_BlockTeam        register_cvar"reb_team"        "0"            );
    
    new 
szTmp[16];
    
    for( new 
0BOT_NUMi++ )
    {
        
formatexszTmpcharsmax(szTmp), "reb_name%i");
        
        
p_BlockName[i] = register_cvarszTmp"" );
    }

    
g_iMaxPlayers get_maxplayers( );
}


public 
msg_TeamInfo( )
{    
    if( 
is_user_fakebotget_msg_arg_int) ) )
        
set_msg_arg_string2"SPECTATOR" );
}


public 
on_RoundEnd( )
    
BOT_start( );


public 
on_RoundStart( )
{
    if( 
g_bFirstRound )
    {
        
g_bFirstRound false;
        
        if( 
get_pcvar_nump_FakeFull ) && get_pcvar_nump_BlockEnd ) )
        {
            if( !
get_playersnum) )
                
set_task1.0"BOT_create"TASK_BOTS );
        }
    }
    else if( 
BOT_num( ) )
    {
        for( new 
id 1id <= g_iMaxPlayersid++ )
        {
            if( 
is_connectedid ) )
                
BOT_hideid );
        }
    }
}


public 
BOT_create( )
{
    new 
BotName[32], BotIDfirstNotValid = -1i;
    
    for( 
0BOT_NUMi++ )
    {
        if( !
IsValidPlayerg_BotID[i] ) )
        {
            
firstNotValid i;
            break;
        }
    }
    
    if( 
firstNotValid == -)
        return;

    
get_pcvar_stringp_BlockName[firstNotValid], BotNamecharsmax(BotName) );
    
trimBotName );
    
    if( 
equaliBotName"" ) )
        
copyBotNamecharsmax(BotName), DefaultNames[firstNotValid] );
    
    
trimBotName );
    
    if( 
equaliBotName"" ) )
        return;

    new 
szName[32], szTmp[32], bool:bContinue truebool:bFoundiFound;
    
    
copyszTmpcharsmax(szTmp), BotName );
    
    while( 
bContinue )
    {
        for( 
1<= g_iMaxPlayersi++ )
        {
            if( 
is_connected) )
            {
                
get_user_nameiszNamecharsmax(szName) );
                
                if( 
equaliszTmpszName ) )
                {
                    
formatexszTmpcharsmax(szTmp), "%s(%d)"BotName, ++iFound );
                    
                    
bFound true;
                    
                    break;
                }
            }
        }
        
        if( !
bFound )
            
bContinue false;
        
        
bFound false;
    }
    
    if( 
iFound )
        
copyBotNamecharsmax(BotName), szTmp );
    
    
BotID engfuncEngFunc_CreateFakeClientBotName );
    
    if( !
IsValidPlayerBotID ) )
        return;

    
g_BotID[firstNotValid] = BotID;
    
    new 
ptr[128];
    
engfuncEngFunc_FreeEntPrivateDataBotID );
    
dllfuncDLLFunc_ClientConnectBotIDBotName"127.0.0.1"ptr );
    
    if( !
is_user_connectedBotID ) )
    {
        
g_BotID[firstNotValid] = 0;
        return;
    }

    
dllfuncDLLFunc_ClientPutInServerBotID );
    
set_pevBotIDpev_spawnflagspevBotIDpev_spawnflags ) | FL_FAKECLIENT );
    
set_pevBotIDpev_flagspevBotIDpev_flags ) | FL_FAKECLIENT );
    
    switch( 
clampget_pcvar_nump_BlockTeam ), 0) )
    {
        case 
0:    cs_set_user_teamBotIDBOT_num( ) % CS_TEAM_T CS_TEAM_CT );
        case 
1:    cs_set_user_teamBotIDCS_TEAM_T );
        case 
2:    cs_set_user_teamBotIDCS_TEAM_CT );
    }
    
    if( !
is_user_aliveBotID ) )
        
ExecuteHamBHam_CS_RoundRespawnBotID );
    
    if( 
BOT_num( ) < BOT_NUM )
    {
        
remove_taskTASK_BOTS );
        
set_task0.1"BOT_start"TASK_BOTS );
    }
    
    
BOT_hideBotID );
}


BOT_check_teams( )
{
    static 
bool:bFirstCallDoneoldTeam;
    new 
iTeam clampget_pcvar_nump_BlockTeam ), 0); 
    
    if( !
bFirstCallDone )
    {
        
oldTeam iTeam;
        
bFirstCallDone true;
    }
    else if( 
iTeam != oldTeam )
    {
        
oldTeam iTeam;
        
        new 
BotID;
        if( 
iTeam )
        {
            for( new 
0BOT_NUMi++ )
            {
                
BotID g_BotID[i];
                
                if( 
IsValidPlayerBotID ) )
                    
set_pdata_intBotIDOFFSET_TEAMiTeamLINUXDIFF );
            }
        }
        else
        {
            for( new 
BOT_num( ) - 1>= 0i-- )
            {            
                
BotID g_BotID[i];
                
                if( 
IsValidPlayerBotID ) )
                    
set_pdata_intBotIDOFFSET_TEAM_:( CS_TEAM_T CS_TEAM_CT ), LINUXDIFF );
            }
        }
    }
}


public 
BOT_hide( const id )
{
    if( 
is_user_fakebotid ) )
    {
        
set_pevidpev_effectspevidpev_effects ) | EF_NODRAW );
        
set_pevidpev_solidSOLID_NOT );
        
set_pevidpev_takedamageDAMAGE_NO );
        
set_pevidpev_health1000000.0 );
        
set_pevidpev_originFloat:{ 9999.09999.09999.0 } );
    }
}


BOT_kickiAmt BOT_NUM )
{
    if( !
BOT_num( ) )
        return;
    
    new 
BotIDiKicked;
    
    for( new 
BOT_NUM 1>= 0i-- )
    {
        if( 
g_iMaxPlayers )
            continue;
        
        
BotID g_BotID[i];
        
        if( 
IsValidPlayerBotID ) )
        {
            
server_cmd"kick #%d"get_user_useridBotID ) );
            
server_exec( );
            
            if( ++
iKicked >= iAmt )
                break;
        }
    }
}


public 
BOT_start( )
{
    new 
iBotNum BOT_num( );
    
    if( !
get_pcvar_nump_BlockEnd ) )
    {
        if( 
iBotNum )
            
BOT_kick( );
        
        return;
    }
    
    new 
iPlayers get_playersnum);

    if( 
iBotNum )
    {
        
BOT_check_teams( );
        
        if( 
iPlayers == g_iMaxPlayers )
        {
            if( 
get_pcvar_nump_FullKick ) )
                return;
        }
        else if( 
iPlayers >= g_iMaxPlayers )
        {
            if( 
get_pcvar_nump_FullKick ) )
                
BOT_kick);
            
            return;
        }
        else if( 
iPlayers iBotNum == )
        {
            if( !
get_pcvar_nump_FakeFull ) )
            {
                
BOT_kick( );
                return;
            }
        }
    }
    else if( !
iPlayers )
        return;
        
    new 
iPlayerNum;
    
    for( new 
1<= g_iMaxPlayersi++ )
    {
        if( !
is_connected) || is_user_fakebot) )
            continue;
        
        switch( 
cs_get_user_team) )
        {
            case 
CS_TEAM_TCS_TEAM_CT:    iPlayerNum++;
        }
    }
    
    
    if( 
iBotNum && iPlayerNum >= get_pcvar_nump_BlockPlrMax ) )
        
BOT_kick( );
    else if( 
iBotNum BOT_NUM && iPlayerNum get_pcvar_nump_BlockPlrMin ) )
        
BOT_create( );
}


BOT_num( )
{
    new 
iNum;
    
    for( new 
0BOT_NUMi++ )
    {
        if( 
IsValidPlayerg_BotID[i] ) )
            
iNum++;
    }
    
    return 
iNum;
}


public 
client_putinserverid )
{
    
is_connectedid ) = true;
    
    
set_task1.0"BOT_start"TASK_BOTS );
}


public 
client_disconnectid )
{
    
is_connectedid ) = false;
    
    for( new 
0BOT_NUMi++ )
    {
        if( 
is_user_fakebotid) )
        {
            
g_BotID[i] = 0;
            
            break;
        }
    }
    
    
set_task1.0"BOT_start"TASK_BOTS );
}


bool:is_user_fakebot( const idwhich BOT_NUM )
{
    switch( 
which )
    {
        case 
BOT_NUM:
        {
            for( new 
0BOT_NUMi++ )
            {
                if( 
id == g_BotID[i] )
                    return 
true;
            }
        }
        default: return ( 
id == g_BotID[which] ) ? true false;
    }
    
    return 
false;

__________________
CrAzY MaN is offline
CrAzY MaN
Senior Member
Join Date: Mar 2017
Location: India
Old 06-26-2018 , 12:31   Re: Block round end, method to pick the last team standing
Reply With Quote #4

Didn't remembered.
__________________
CrAzY MaN is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-26-2018 , 13:56   Re: Block round end, method to pick the last team standing
Reply With Quote #5

Don't use it.
__________________
HamletEagle is offline
Reply



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 12:35.


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