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

CreateTimer with no player on server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
stece
Junior Member
Join Date: May 2021
Old 05-25-2022 , 16:08   CreateTimer with no player on server
Reply With Quote #1

Hi all,

I'm attempting to create a function that should be triggered with a certain delay. However I notice that this doesn't work if there is no player on the server. From the moment a player joins the server then the timer works.


PHP Code:
public void OnMapStart() {

  
LogMessage("!!!SOME OUTPUT"); // => THIS IS OUTPUTTED

  
CreateTimer(3.0SomeFunction);
}

public 
Action SomeFunction(Handle timer)
{
    
LogMessage("!!! SOME MORE OUTPUT."); // => THIS IS NOT OUTPUTTED

So when the server boots, OnMapStart is triggered and the first message is outputted. The timer should be created but it never triggers.

When a player joins, the OnMapStart has triggered again (I don't really understand why), and then both messages are outputted.

Why is this? Can you create timers without players on a server somehow?
stece is offline
Maxximou5
AlliedModders Donor
Join Date: Feb 2013
Old 05-25-2022 , 18:02   Re: CreateTimer with no player on server
Reply With Quote #2

Please always specify which game.

As specifically for CS:GO and server hibernation is on (default), it will not trigger.
Maxximou5 is offline
stece
Junior Member
Join Date: May 2021
Old 05-26-2022 , 03:31   Re: CreateTimer with no player on server
Reply With Quote #3

Aah it's indeed for CSGO. Ok that explains the behavior and I've found a way to work around it. Thx!
stece 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 15:22.


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