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

Reset Round Without Resetting Timeleft ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dendodo1235
Member
Join Date: Feb 2015
Old 03-03-2015 , 07:59   Reset Round Without Resetting Timeleft ?
Reply With Quote #1

if i use cvar sv_restart command it also resets timeleft. Is there any plugin that does only resets everybody's frag and round ? Srry for my awesome english haha
dendodo1235 is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 03-03-2015 , 09:05   Re: Reset Round Without Resetting Timeleft ?
Reply With Quote #2

PHP Code:
/*    Formatright © 2010, ConnorMcLeod

    This plugin 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 this plugin; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>

#define VERSION "0.0.3"
#define PLUGIN "No Timelimit Reset on Game Commencing"

new bool:g_bRestarting
new mp_timelimit

new g_iAlreadyCountedMins

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")

    
register_event("TextMsg""Event_TextMsg_Restart""a""2&#Game_C""2&#Game_w");
    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")

    
mp_timelimit get_cvar_pointer("mp_timelimit")
}

public 
Event_TextMsg_Restart()
{
    
g_bRestarting true
}

public 
Event_HLTV_New_Round()
{
    if( 
g_bRestarting )
    {
        
g_bRestarting false

        
new iOldTimelimit get_pcvar_num(mp_timelimit)
        if( !
iOldTimelimit )
        {
            return
        }

        new 
Float:flTimeLimit 60.0 iOldTimelimit

        flTimeLimit 
-= get_gametime() - 60.0 g_iAlreadyCountedMins
        
if( flTimeLimit 60.0 )
        {
            
set_pcvar_num(mp_timelimit1)
            
g_iAlreadyCountedMins += iOldTimelimit 1
        
}
        else
        {
            new 
iRounded floatround(flTimeLimit 60.0)
            
set_pcvar_num(mp_timelimitiRounded)
            
g_iAlreadyCountedMins += iOldTimelimit iRounded
        
}
    }


Note: Money will be also reseted, if you need, i will make a modification later so it will not reset people's money.
__________________

Last edited by Jhob94; 03-03-2015 at 09:12.
Jhob94 is offline
dendodo1235
Member
Join Date: Feb 2015
Old 03-03-2015 , 09:22   Re: Reset Round Without Resetting Timeleft ?
Reply With Quote #3

Quote:
Originally Posted by Jhob94 View Post
PHP Code:
/*    Formatright © 2010, ConnorMcLeod

    This plugin 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 this plugin; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>

#define VERSION "0.0.3"
#define PLUGIN "No Timelimit Reset on Game Commencing"

new bool:g_bRestarting
new mp_timelimit

new g_iAlreadyCountedMins

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")

    
register_event("TextMsg""Event_TextMsg_Restart""a""2&#Game_C""2&#Game_w");
    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")

    
mp_timelimit get_cvar_pointer("mp_timelimit")
}

public 
Event_TextMsg_Restart()
{
    
g_bRestarting true
}

public 
Event_HLTV_New_Round()
{
    if( 
g_bRestarting )
    {
        
g_bRestarting false

        
new iOldTimelimit get_pcvar_num(mp_timelimit)
        if( !
iOldTimelimit )
        {
            return
        }

        new 
Float:flTimeLimit 60.0 iOldTimelimit

        flTimeLimit 
-= get_gametime() - 60.0 g_iAlreadyCountedMins
        
if( flTimeLimit 60.0 )
        {
            
set_pcvar_num(mp_timelimit1)
            
g_iAlreadyCountedMins += iOldTimelimit 1
        
}
        else
        {
            new 
iRounded floatround(flTimeLimit 60.0)
            
set_pcvar_num(mp_timelimitiRounded)
            
g_iAlreadyCountedMins += iOldTimelimit iRounded
        
}
    }


Note: Money will be also reseted, if you need, i will make a modification later so it will not reset people's money.
Thank you !! works like a monster i mean it helped so much
dendodo1235 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 05:20.


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