Raised This Month: $12 Target: $400
 3% 

[css] auto restartgame after X rounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
konash
Junior Member
Join Date: Mar 2020
Old 03-28-2020 , 10:21   [css] auto restartgame after X rounds
Reply With Quote #1

hi guys
i'm looking for script or plugin that make auto restart game after x rounds ..
i know this command "mp_restartgame 3" but i want do it automatically after 15 rounds in server

Please help and thanks

Last edited by konash; 03-28-2020 at 10:23.
konash is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 03-28-2020 , 14:45   Re: [css] auto restartgame after X rounds
Reply With Quote #2

ok.

PHP Code:


/*
Server event "round_end", Tick 15041:
- "winner" = "1"
- "reason" = "9"
- "message" = "#Round_Draw"
*/

int maxrounds 15// max rounds

public void OnPluginStart()
{
    
HookEventEx("round_end"round_end);
}

public 
void round_end(Event event, const char[] namebool dontBroadcast)
{
    static 
int wins 0;

    if(
event.GetInt("winner") >= 2)
    {
        
wins++;

        
PrintToChatAll("[SM] Rounds played %i/%i"winsmaxrounds);

        if(
wins >= maxrounds)
        {
            
wins 0;

            
PrintToChatAll("[SM] Restart game");
            
ServerCommand("mp_restartgame 3");
        }
    }
    else
    {
        
wins 0;
    }

__________________
Do not Private Message @me

Last edited by Bacardi; 03-28-2020 at 14:48. Reason: added global variable maxrounds
Bacardi is offline
konash
Junior Member
Join Date: Mar 2020
Old 03-28-2020 , 15:50   Re: [css] auto restartgame after X rounds
Reply With Quote #3

Quote:
Originally Posted by Bacardi View Post
ok.

PHP Code:


/*
Server event "round_end", Tick 15041:
- "winner" = "1"
- "reason" = "9"
- "message" = "#Round_Draw"
*/

int maxrounds 15// max rounds

public void OnPluginStart()
{
    
HookEventEx("round_end"round_end);
}

public 
void round_end(Event event, const char[] namebool dontBroadcast)
{
    static 
int wins 0;

    if(
event.GetInt("winner") >= 2)
    {
        
wins++;

        
PrintToChatAll("[SM] Rounds played %i/%i"winsmaxrounds);

        if(
wins >= maxrounds)
        {
            
wins 0;

            
PrintToChatAll("[SM] Restart game");
            
ServerCommand("mp_restartgame 3");
        }
    }
    else
    {
        
wins 0;
    }


put it in wich folder ?
konash is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 03-28-2020 , 16:58   Re: [css] auto restartgame after X rounds
Reply With Quote #4

Because this code is simple, you can try Web Compiler.
https://www.sourcemod.net/compiler.php

Copy/paste code and compile. You get sm plugin (*.smx)
__________________
Do not Private Message @me
Bacardi is offline
konash
Junior Member
Join Date: Mar 2020
Old 03-28-2020 , 18:03   Re: [css] auto restartgame after X rounds
Reply With Quote #5

Quote:
Originally Posted by Bacardi View Post
Because this code is simple, you can try Web Compiler.
https://www.sourcemod.net/compiler.php

Copy/paste code and compile. You get sm plugin (*.smx)
its work //

there's some problem with auroswapteam not rest score from 0 . but its ok

thx mate

Last edited by konash; 03-28-2020 at 20:51.
konash is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 03-28-2020 , 21:07   Re: [css] auto restartgame after X rounds
Reply With Quote #6

Ok, what you say if we change map every 15 rounds ? To same map ofcourse.
__________________
Do not Private Message @me
Bacardi is offline
konash
Junior Member
Join Date: Mar 2020
Old 03-29-2020 , 08:35   Re: [css] auto restartgame after X rounds
Reply With Quote #7

Quote:
Originally Posted by Bacardi View Post
Ok, what you say if we change map every 15 rounds ? To same map ofcourse.
ok but how ?
konash is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 03-29-2020 , 11:53   Re: [css] auto restartgame after X rounds
Reply With Quote #8

First, unload and remove this plugin from server.


Make sure you not have ...cstrike/mapcycle.txt
In ...cstrike/cfg/mapcycle.txt file, add one map only:
Code:
de_dust2
in ...cfg/server.cfg file
Code:
mp_timelimit 0
mp_maxrounds 15
mp_fraglimit 0
mapcyclefile "cfg/mapcycle.txt" // Legacy cvar, for SourceMod maplist
__________________
Do not Private Message @me

Last edited by Bacardi; 03-29-2020 at 11:54.
Bacardi is offline
konash
Junior Member
Join Date: Mar 2020
Old 03-29-2020 , 13:00   Re: [css] auto restartgame after X rounds
Reply With Quote #9

Quote:
Originally Posted by Bacardi View Post
First, unload and remove this plugin from server.


Make sure you not have ...cstrike/mapcycle.txt
In ...cstrike/cfg/mapcycle.txt file, add one map only:
Code:
de_dust2
in ...cfg/server.cfg file
Code:
mp_timelimit 0
mp_maxrounds 15
mp_fraglimit 0
mapcyclefile "cfg/mapcycle.txt" // Legacy cvar, for SourceMod maplist
thx mate bro ..
konash is offline
Reply


Thread Tools
Display Modes

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 20:34.


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