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

Solved [CSGO] How to tell if we are < 15 seconds into a round?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Austin
Senior Member
Join Date: Oct 2005
Old 05-12-2022 , 01:32   [CSGO] How to tell if we are < 15 seconds into a round?
Reply With Quote #1

[CSGO]
How to tell if we are < 15 seconds into a round?
I searched really I did.

Last edited by Austin; 05-15-2022 at 05:40.
Austin is offline
xerox8521
Senior Member
Join Date: Sep 2011
Old 05-12-2022 , 07:55   Re: [CSGO] How to tell if we are < 15 seconds into a round?
Reply With Quote #2

In round start you could save the value of GetGameTime and then when you need it later check if GetGameTime - savedStartTime < 15.

Last edited by xerox8521; 05-12-2022 at 07:55.
xerox8521 is offline
Austin
Senior Member
Join Date: Oct 2005
Old 05-13-2022 , 14:56   Re: [CSGO] How to tell if we are < 15 seconds into a round?
Reply With Quote #3

Quote:
Originally Posted by xerox8521 View Post
In round start you could save the value of GetGameTime and then when you need it later check if GetGameTime - savedStartTime < 15.
I did try that but it doesn't seem to be working.
Maybe some other logic error in a long if statment I have.

Does this look ok to you?


PHP Code:
public void OnMapStart()
{
    
g_MapStart GetGameTime();
}

if( (
GetGameTime()-g_MapStart)<15.0) )
{
   
//Still within  15 seconds from start of round 


Thanks for the answer....
Austin is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 05-13-2022 , 17:58   Re: [CSGO] How to tell if we are < 15 seconds into a round?
Reply With Quote #4

You could try using the Round Timer plugin by ReFlex Poison. Here's a link: https://forums.alliedmods.net/showthread.php?t=192601

Or.... you could try writing your own plugin. I don't know much about CSGO but it seems to me that you could simply hook the round start event and add a timer.

Like this...
PHP Code:
#pragma semicolon 1
#pragma newdecls required

public Plugin myinfo 
{
    
name "Round Start",
    
author "PC Gamer",
    
description "Do something at round start",
    
version "PLUGIN_VERSION 1.0",
}

public 
void OnPluginStart()

    
HookEvent("teamplay_round_start"OnRoundStart);
    
HookEvent("round_start"OnRoundStart);
}

public 
Action OnRoundStart(Handle hEvent, const char[] strNamebool bDontBroadcast)
{
    
CreateTimer(15.0timesup);
    
    return 
Plugin_Handled;
}

public 
Action timesup(Handle timer)
{
    
PrintToChatAll("It is now 15 seconds into the Round");
    
    return 
Plugin_Handled;


Last edited by PC Gamer; 05-13-2022 at 21:09.
PC Gamer is offline
Austin
Senior Member
Join Date: Oct 2005
Old 05-15-2022 , 05:11   Re: [CSGO] How to tell if we are < 15 seconds into a round?
Reply With Quote #5

The problem was I using MapStart to set the initial time.
Working now.
Thanks everyone and thanks for the timer suggestion, that would have worked too.

PHP Code:
public void OnPluginStart()
{
  
HookEvent("round_start",     OnRoundStart);
}


public 
Action OnRoundStart(Event event, const char[] namebool dontBroadcast)
{
    
g_RoundStart GetGameTime();


Last edited by Austin; 05-15-2022 at 05:41.
Austin 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 11:23.


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