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

Solved [CSGO] Best way to detect First Round?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Austin
Senior Member
Join Date: Oct 2005
Old 12-21-2022 , 14:18   [CSGO] Best way to detect First Round?
Reply With Quote #1

Edit:
Ahh, never mind.
Apparently this never worked or something changed in the last ten years with csgo.
The number for first round is 16 not 15.
Working!

I have the following code and I thought it was working at some point but it no longer is.
What is the best way to detect the start of the Frist Round in csgo?

PHP Code:
#pragma semicolon 1
#include <sourcemod>

new bool:g_firstround true;

public 
OnPluginStart()
{
    
HookEvent("round_end",        RoundEndEvent);
}

public 
Action:RoundEndEvent(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
reason GetEventInt(event"reason");
    
//#Game_Commencing, game begin
    
if( reason == 16// had 15 for some reason! and thought 15 used to work ten years ago
    

        
PrintToChatAll("First round found! %n",reason);
        
g_firstround true;
    }
    else
    {
        
PrintToChatAll("First round NOT found! %n",reason);
        
g_firstround false;
    }


Last edited by Austin; 12-21-2022 at 14:47.
Austin is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 12-21-2022 , 18:45   Re: [CSGO] Best way to detect First Round?
Reply With Quote #2

Don't know, what are you planning.


PHP Code:
public void OnPluginStart()
{
    
HookEvent("begin_new_match"match);                // trigger at round_start
    
HookEvent("round_announce_match_start"match);    // trigger at round_freeze_end
}

public 
void match(Event event, const char[] namebool dontBroadcast)
{
    
PrintToChatAll("%s - First round found!"name);

__________________
Do not Private Message @me
Bacardi is offline
FroGeX
Senior Member
Join Date: Aug 2020
Old 12-22-2022 , 20:42   Re: [CSGO] Best way to detect First Round?
Reply With Quote #3

Quote:
Originally Posted by Bacardi View Post
Don't know, what are you planning.


PHP Code:
public void OnPluginStart()
{
    
HookEvent("begin_new_match"match);                // trigger at round_start
    
HookEvent("round_announce_match_start"match);    // trigger at round_freeze_end
}

public 
void match(Event event, const char[] namebool dontBroadcast)
{
    
PrintToChatAll("%s - First round found!"name);

better
PHP Code:
public void OnPluginStart()
{
    
HookEvent("round_start"match);                // trigger at round_start
    
HookEvent("round_freeze_end"match);    // trigger at round_freeze_end
}

public 
void match(Event event, const char[] namebool dontBroadcast)
{
    
PrintToChatAll("%s - First round found!"name);

FroGeX is offline
Cruze
Veteran Member
Join Date: May 2017
Old 12-25-2022 , 04:01   Re: [CSGO] Best way to detect First Round?
Reply With Quote #4

Quote:
Originally Posted by FroGeX View Post
better
PHP Code:
public void OnPluginStart()
{
    
HookEvent("round_start"match);                // trigger at round_start
    
HookEvent("round_freeze_end"match);    // trigger at round_freeze_end
}

public 
void match(Event event, const char[] namebool dontBroadcast)
{
    
PrintToChatAll("%s - First round found!"name);

Your method will get called in every round_start & every freezetime end
__________________
Taking paid private requests! Contact me
Cruze is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 12-25-2022 , 05:10   Re: [CSGO] Best way to detect First Round?
Reply With Quote #5

not sure was it troll post
Bacardi 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 10:20.


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