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

[STOCK] How to set Freezetime or Roundtime on the fly


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 01-08-2020 , 20:39   [STOCK] How to set Freezetime or Roundtime on the fly
Reply With Quote #1

Hi folks, here is a small stock that adjust freezetime or roundtime on the fly.
I'm tried some time to make this to my mod, i hope someone can re-use for something.

PHP Code:
stock SetRoundTime(iTime)
{
    static 
iMsgRoundTime;
    
    if(
iMsgRoundTime || (iMsgRoundTime get_user_msgid("RoundTime")))
    {
        if(
get_gamerules_int("CGameRules","m_bFreezePeriod"))
        {
            
set_gamerules_int("CHalfLifeMultiplay","m_iIntroRoundTime",iTime);
            
set_gamerules_float("CHalfLifeMultiplay","m_fIntroRoundCount",get_gametime());
        }
        else
        {
            
set_gamerules_int("CHalfLifeMultiplay","m_iRoundTimeSecs",iTime);
            
set_gamerules_float("CHalfLifeMultiplay","m_fRoundCount",get_gametime());
        }

        
message_begin(MSG_ALL,iMsgRoundTime);
        
write_short(iTime);
        
message_end();
    }

This use fakemeta.

Ps. The main idea comes from here:
https://forums.alliedmods.net/showpo...8&postcount=10

From Arkshine

__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 01-16-2020 , 21:55   Re: [STOCK] How to set Freezetime or Roundtime on the fly
Reply With Quote #2

Fakemeta only? And works on any AMXX version?
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-17-2020 , 06:07   Re: [STOCK] How to set Freezetime or Roundtime on the fly
Reply With Quote #3

Quote:
Originally Posted by georgik57 View Post
Fakemeta only? And works on any AMXX version?
Only 1.9+(because of the gamerules natives). For 1.8.2 orpheu/okapi are needed.
__________________
HamletEagle is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 01-17-2020 , 06:42   Re: [STOCK] How to set Freezetime or Roundtime on the fly
Reply With Quote #4

And not working with rehlds, i tried to open a issue on github.
But the best answer that i get was: use reapi shit.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
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 09:15.


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