Quote:
Originally Posted by CoolJosh3k
I just noticed an issue with the adverts too. You made a mistake in the code.
You forgot to tell the plugin to read the state of the cvar controlling the advert state.
Code:
//Timer for adverts
public Action:Adverttimer(Handle:timer)
{
PrintToChatAll("\x03 Aim at someone and type !bp or !backpack [playername]");
return Plugin_Continue;
}
should be:
Code:
//Timer for adverts
public Action:Adverttimer(Handle:timer)
{
if (adsOn == 1)
{
PrintToChatAll("\x03 Aim at someone and type !bp or !backpack [playername]");
}
return Plugin_Continue;
}
I could be very wrong though, as I don't know how to write plugins yet.
|
You're pretty much there CoolJosh, but it's best to wrap the evaluation around StartTimer() in the OnPluginStart() function, so the timer never starts until it's needed:
Code:
if (GetConVarBool(g_Adverts))
StartTimer();
Also I added a line to remove the handle from a stopped timer in OnAdtimeChange() purely for cleanup:
Code:
if (g_Adtimer != INVALID_HANDLE)
{
KillTimer(g_Adtimer);
g_Adtimer = INVALID_HANDLE;
}
Also changed default time between adverts to 300 seconds.
Edit: See Post #46 for the latest edits.