View Single Post
ShadowMarioBR
Member
Join Date: Feb 2018
Old 06-25-2018 , 13:25   Re: [TF2] Help with timer
Reply With Quote #3

Quote:
Originally Posted by eyal282 View Post
Just do this:

[code]
#include <sourcemod>

new hTimerAmmo = INVALID_HANDLE;

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

public OnMapStart()
{
hTimerAmmo = INVALID_HANDLE;
}

public Event_RoundStart(Handle:hEvent, const String:Name[], bool:dontBroadcast)
{
if(hTimerAmmo != INVALID_HANDLE)
{
CloseHandle(hTimerAmmo);
hTimerAmmo = INVALID_HANDLE;
}
hTimerAmmo = CreateTimer(1.5, GiveAllAmmo, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}

public Action:GiveAllAmmo(Handle:hTimer)
{
// Give ammo stuff here, will be executed every 1.5 seconds.
return Plugin_Continue;
}
I can't do this, it needs to detect if i'm pressing a specific button, and i don't want to it be executed when round start.
ShadowMarioBR is offline