Quote:
Originally Posted by FroGeX
|
Thanks, that's a good resource to use.
I did get the code to work using this:
PHP Code:
#include <sourcemod>
public Plugin myinfo =
{
name = "Overtime Alert",
author = "reDrocket",
description = "Sets Overtime Alert in CSGO",
version = "1.0",
url = "http://foxholegaming.net/"
};
public OnPluginStart()
{
HookEvent("round_start", OnRoundStart, EventHookMode_PostNoCopy);
}
public OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
CreateTimer(240.0, otalert);
}
public Action otalert(Handle timer)
{
for (new i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && !IsFakeClient(i))
PrintCenterText(i, "%s", "OVERTIME! Live Check and Kill on Sus Allowed!");
}
}
However, it only shows the message once and quickly disappears. I'm using the SourceMod Timers wiki entry to try and figure out how to get a second timer to run after the first and continue to ping the command for a lot longer but while no error shows in SourceMod, no command is pushed out.
What exactly am I doing wrong here?
PHP Code:
#include <sourcemod>
public Plugin myinfo =
{
name = "Overtime Alert",
author = "reDrocket",
description = "Sets Overtime Alert in CSGO",
version = "1.0",
url = "http://foxholegaming.net/"
};
public OnPluginStart()
{
HookEvent("round_start", OnRoundStart, EventHookMode_PostNoCopy);
}
public OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
CreateTimer(50, alert);
}
public Action alert(Handle timer)
{
CreateTimer(3.0, repeater, _, TIMER_REPEAT);
}
public Action repeater(Handle timer)
{
// Create a global variable visible only in the local scope (this function).
static int numPrinted = 0;
if (numPrinted >= 15)
{
numPrinted = 0;
return Plugin_Stop;
}
for (new i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && !IsFakeClient(i))
PrintCenterText(i, "%s", "OVERTIME! Live Check and Kill on Sus Allowed!");
numPrinted++;
}
return Plugin_Continue;
}