View Single Post
Author Message
Certified_GSD
New Member
Join Date: Aug 2015
Location: Minnesota
Old 01-23-2021 , 00:40   [CS:GO] Help with Timer and CSay
Reply With Quote #1

Hello Folks,


I'm trying to get a simple plugin together that just runs a timer on round_start and as soon as the timer passes, it will push a center message to all players similar to the !csay function of SourceMod. Specifically because it's very visible, and because CS:GO broadcasts this with a big red "ALERT!" as this message will specifically be marking a time for players that rules are changing mid-round.

I'm kind of stumped though. I've been Google'ing how SourceMod interacts with the game and trying to read through the source code of other programs that utilize the center text box but I can't quite figure out how to do that here. This center message also goes away after a set amount of time, is there a way I can have it stay up in the player's HUD until the end of the round?


I'm also not sure how to tell the plugin to look for round_end but to stick around and keep listening for the next round_start and do it all over again. Thanks! I appreciate the help!


Code:
#include <sourcemod>

public Plugin myinfo =
{
	name = "Overtime Alert",
	author = "reDrocket",
	description = "Sets Overtime Alert in CS:GO",
	version = "1.0",
	url = "x"
};

public OnPluginStart()
{
    HookEvent("round_start", OnRoundStart, EventHookMode_PostNoCopy);
}

public OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    CreateTimer(210.0, otalert);
} 

public Action otalert(Handle timer)
{
	DisplayCenterTextToAll(
Certified_GSD is offline