Raised This Month: $404 Target: $400
 101% 

Solved [CS] get/set_gamerules_* have no effect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
E1_531G
Senior Member
Join Date: Dec 2017
Old 10-12-2018 , 16:57   [CS] get/set_gamerules_* have no effect
Reply With Quote #1

Hello.

On my Windows server (6153) with AMXX 1.9.0 5229 i have next problem:
The code below doesn't work:
PHP Code:
    // iNewTime = 30
    
new Float:fRoundStartTime  get_gamerules_float("CHalfLifeMultiplay""m_fRoundCount")
    new 
Float:fCurrentGameTime get_gametime()

    
set_gamerules_int"CHalfLifeMultiplay""m_iRoundTimeSecs"floatround(iNewTime fCurrentGameTime fRoundStartTime) )

    
#if defined DEBUG
    
new iTime get_gamerules_int("CHalfLifeMultiplay""m_iRoundTimeSecs")
    
server_print"* iNewTime = %d | iTime = %d"iNewTimeiTime // output: 30 34 (because mp_freezetime = 4)
    #endif

    
if( message_begin(MSG_ALLg_Msg_RoundTime) )
    {
        
write_short(iNewTime)
        
message_end()
    } 
This code runs in register_logevent( "On_Round_Start", 2, "1=Round_Start" ) function.
In game i see 00;30 on timer, but when it reaches 00:00 the round doesn't end and continues for another 30 seconds (because mp_roundtime = 1.0).

Any suggestions?
__________________
My English is A0

Last edited by E1_531G; 10-15-2018 at 14:22.
E1_531G is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 10-14-2018 , 07:32   Re: [CS] get/set_gamerules_* have no effect
Reply With Quote #2

@Arkshine, @HamletEagle, #bug, #error?
__________________
My English is A0
E1_531G is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-14-2018 , 10:10   Re: [CS] get/set_gamerules_* have no effect
Reply With Quote #3

Round_Start is slightly too early, use a small delay(0.1).
Reason is: https://github.com/s1lentq/ReGameDLL...ules.cpp#L2655

m_iRoundTimeSecs is changed after Round_Start is sent.
__________________
HamletEagle is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 10-14-2018 , 14:39   Re: [CS] get/set_gamerules_* have no effect
Reply With Quote #4

OMG... how i was supposed to know that?? Advanced scripting for CS is so weird.

I will edit it later, if everything works fine.
Thank you.
__________________
My English is A0
E1_531G is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-14-2018 , 15:36   Re: [CS] get/set_gamerules_* have no effect
Reply With Quote #5

You were not supposed to know this, I did not know either. But that was the only obvious reason so I checked that and it made sense.

Only thing you need is to know where to search.
__________________

Last edited by HamletEagle; 10-14-2018 at 15:49.
HamletEagle is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 10-15-2018 , 14:22   Re: [CS] get/set_gamerules_* have no effect
Reply With Quote #6

Yes, you are right, but also for me it made sense: freezetime ends and i alter the timer.

However, it works. (with 0.1 task).

Thank you.
Solved.
__________________
My English is A0
E1_531G 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 17:33.


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