AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   more than 1 terr in deathrun (https://forums.alliedmods.net/showthread.php?t=341880)

Nutu_ 02-17-2023 13:57

more than 1 terr in deathrun
 
hey there, is there any plugin (cuz i haven;t found) that if there are more than lets say, 20 players on server, on a new start round it choose 2 terr, not 1? it would be wonderful if it works like >10 players (1 terr), >20 players (2 terr), >30 players (3 terr)
thank you!

JusTGo 02-18-2023 11:05

Re: more than 1 terr in deathrun
 
which deathrun plugin are you using to transfer 1 terr

JocAnis 02-19-2023 07:45

Re: more than 1 terr in deathrun
 
hello, can you test this? meaning you dont need to edit your current deathrun manager:

Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

public plugin_init()
{
    register_plugin( "Balance TR-CT", "1.0", "test" )
    register_event( "HLTV", "event_new_round", "a", "1=0", "2=0" )
}
public event_new_round()
    set_task( 0.2, "check_balance" ) //idk why set task, maybe to not have issue with your original transfer/dr plugin

public check_balance()
{
    new CTplayers[ 32 ], CTnum, random_player, name[ 32 ]
    get_players( CTplayers, CTnum, "ceh", "CT" )
    if( CTnum >= 19 )
    {
        random_player = CTplayers[ random( CTnum ) ]
        get_user_name( random_player, name, charsmax( name ) )
        client_print( 0, print_chat, "[Info] Second Terrorist is randomly added: %s", name )
        cs_set_user_team( random_player, CS_TEAM_T )
        if( CTnum >= 29 )
        {
            random_player = CTplayers[ random( CTnum ) ]
            get_user_name( random_player, name, charsmax( name ) )
            client_print( 0, print_chat, "[Info] Third Terrorist is randomly added: %s", name )
            cs_set_user_team( random_player, CS_TEAM_T )
        }
    }

}

if ct players are 19 (meaning and 1 terror from your current plugin), it will add second TR. if there are 29 CTs and + 1 your TR, then it will add 2 more players in TR team

tom . 03-14-2023 02:46

Re: more than 1 terr in deathrun
 
Code:

/*    Copyright © 2009, SkubiDu

    DeathRun Team- Ration is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with DeathRun Team Ratio; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "DeathRun Team-ration"
#define AUTHOR "SkubiDu"
#define VERSION "0.1.0"

#define MAX_PLAYERS 32

#define TEAM_T        1
#define TEAM_CT    2
#define CS_OFFSET_TEAM 114
#define cs_get_user_team(%1)            get_pdata_int(%1, CS_OFFSET_TEAM)
#define cs_set_user_team_fast(%1,%2)    set_pdata_int(%1, CS_OFFSET_TEAM, %2)

new g_iMaxPlayers
new g_pCvarRatio
new sv_restart

new g_bIsConnected[MAX_PLAYERS+1]

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)

    register_event("HLTV", "Event_HLTV_New_Round", "a", "1=0", "2=0")

    g_pCvarRatio = register_cvar("dr_terrorists_ratio", "0.25")

    g_iMaxPlayers = get_maxplayers()
    sv_restart = get_cvar_pointer("sv_restart" "1")
}

public client_putinserver( id )
{
    g_bIsConnected[id] = true
}

public client_disconnect( id )
{
    g_bIsConnected[id] = false
}

public Event_HLTV_New_Round()
{
    new iPlayers[MAX_PLAYERS], iNum, id, iTeam
    for(id=1; id<=g_iMaxPlayers; id++)
    {
        if( g_bIsConnected[id] && ( TEAM_T <= cs_get_user_team(id) <= TEAM_CT ) )
        {
            iPlayers[iNum++] = id
        }
    }

    if( iNum < 2 )
    {
        return
    }

    new iTerroristsNum = max(1, floatround( get_pcvar_float(g_pCvarRatio) * iNum , floatround_floor ))
    new iRand
    new szName[32]

    while( iTerroristsNum )
    {
        iRand = random_num(0, iNum)
        if( (id = iPlayers[iRand]) )
        {
            cs_set_user_team_fast(id, TEAM_T)
            if( iNum-1 > iRand )
            {
                iPlayers[iRand] = iPlayers[iNum-1]
            }

            --iNum
            --iTerroristsNum

            get_user_name(id, szName, charsmax(szName))
            client_print(0, print_chat, "[Dr] %s has be choosen to be a terrorist.", szName)
        }
    }

    for(new i; i<iNum; i++)
    {
        if( (id = iPlayers[i]) )
        {
            cs_set_user_team_fast(id, TEAM_CT)
        }
    }
}



All times are GMT -4. The time now is 06:47.

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