AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Request: Plugin that terminates round (excluding bots) (https://forums.alliedmods.net/showthread.php?t=340653)

SANDELS 12-01-2022 16:46

Request: Plugin that terminates round (excluding bots)
 
Hello,

Is there already existing this kind of plugin that terminates round when all players are dead? (excluding bots)

These are my requirements for the plugin:

- The round should end, when there are no human players on CT or T side. (ignore bots)
- I am planning to use mp_ignore_round_win_conditions 1, so the plugin should override it.
- Plugin should obey the mp_round_restart_delay time (or cvar to set the round end delay manually)

If anyone could help me out, I'd be super happy! :)

SANDELS 12-03-2022 23:31

Re: Request: Plugin that terminates round (excluding bots)
 
I can pay for the work! :)

Cruze 12-04-2022 07:30

Re: Request: Plugin that terminates round (excluding bots)
 
2 Attachment(s)
PHP Code:

#include <sourcemod>
#include <cstrike>

#define DEFAULT_ROUNDEND_DELAY 7.0

ConVar g_hRestartDelay;

public 
void OnPluginStart()
{
    
HookEvent("player_death"Event_PlayerDeath);
    
    
g_hRestartDelay FindConVar("mp_round_restart_delay");
}

public 
void Event_PlayerDeath(Event ev, const char[] namebool dbc)
{
    if(
GetAliveTeamPlayerCount(2) < && GetAliveTeamPlayerCount(3) < 1)
    {
        
CS_TerminateRound(g_hRestartDelay != null g_hRestartDelay.FloatValue DEFAULT_ROUNDEND_DELAYCSRoundEnd_Draw);
    }
}

int GetAliveTeamPlayerCount(int team)
{
    
int count;
    for(
int i 1<= MaxClientsi++)
    {
        if(
IsClientInGame(i) && !IsFakeClient(i) && IsPlayerAlive(i) && GetClientTeam(i) == team)
        {
            
count++;
        }
    }
    return 
count;



Bacardi 12-04-2022 12:09

Re: Request: Plugin that terminates round (excluding bots)
 
This can include in OnPluginStart, not need find convar on every map start. Can be done once when plugin load.
PHP Code:

 g_hRestartDelay FindConVar("mp_round_restart_delay"); 

*edit
also, you could add check, is ConVar g_hRestartDelay Null when fail to find that specific convar name.

Cruze 12-04-2022 12:14

Re: Request: Plugin that terminates round (excluding bots)
 
Quote:

Originally Posted by Bacardi (Post 2794395)
This can include in OnPluginStart, not need find convar on every map start. Can be done once when plugin load.
PHP Code:

 g_hRestartDelay FindConVar("mp_round_restart_delay"); 

*edit
also, you could add check, is ConVar g_hRestartDelay Null when fail to find that specific convar name.

Thanks for the heads up man! :up:

azalty 12-04-2022 16:53

Re: Request: Plugin that terminates round (excluding bots)
 
Quote:

Originally Posted by Bacardi (Post 2794395)
also, you could add check, is ConVar g_hRestartDelay Null when fail to find that specific convar name.

Why would it fail though? It's a base game cvar.

Bacardi 12-05-2022 07:39

Re: Request: Plugin that terminates round (excluding bots)
 
For example someone create MOD out of blue so called:
Counter-Strike: Battlefield 2077

-Title look similiar like CS games
-Maybe game modes look similiar
-But if mod is using totally different cvar names than original cs games. This "mp_round_restart_delay" not exist in this mod.

SM devs make update so it support this mod.

Users find this post, take a plugin in use, get errors.
Rather they post in this same topic, they create new topic "help".
"Plugin not work"

After 5 posts, asking bunch of basic info, you know what mod and you find this topic through google search.

This, imaginary scenario, you could add check, does plugin work in that game.

Not everything is cs:go


All times are GMT -4. The time now is 20:03.

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