AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved [CS] get/set_gamerules_* have no effect (https://forums.alliedmods.net/showthread.php?t=311308)

E1_531G 10-12-2018 16:57

[CS] get/set_gamerules_* have no effect
 
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?

E1_531G 10-14-2018 07:32

Re: [CS] get/set_gamerules_* have no effect
 
@Arkshine, @HamletEagle, #bug, #error?

HamletEagle 10-14-2018 10:10

Re: [CS] get/set_gamerules_* have no effect
 
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.

E1_531G 10-14-2018 14:39

Re: [CS] get/set_gamerules_* have no effect
 
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.

HamletEagle 10-14-2018 15:36

Re: [CS] get/set_gamerules_* have no effect
 
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.

E1_531G 10-15-2018 14:22

Re: [CS] get/set_gamerules_* have no effect
 
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.


All times are GMT -4. The time now is 09:33.

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