PHP Code:
#pragma newdecls required
#pragma semicolon 1
#define MAX_PLAYERS 32
static const char ADVERTS[][] =
{
"<b><font color='#23f911' class='fontSize-xl'>BONUS</font></b> \n <font class='fontSize-l'>Chcesz co rundę otrzymywać bonusy? \n Dołącz do naszego <b><font color='#ff0000' class='fontSize-l'>Discorda</font></b> \n",
"Reklama 2",
"Reklama 3"
};
Handle
hTimer[2];
int
iAds[MAX_PLAYERS+1];
public void OnClientDisconnect(int client)
{
iAds[client] = 0;
}
public void OnPluginStart()
{
HookEvent("round_freeze_end", Event_RoundStart, EventHookMode_PostNoCopy);
}
public void OnMapStart()
{
if(hTimer[0]) delete hTimer[0];
if(hTimer[1]) delete hTimer[1];
}
public void OnMapEnd()
{
OnMapStart();
}
public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast)
{
OnMapStart();
hTimer[0] = CreateTimer(10.0, HintMessage);
}
public Action HintMessage(Handle timer)
{
if(hTimer[1]) delete hTimer[1];
bool show;
for(int i = 1; i <= MaxClients; i++) if(IsClientInGame(i) && !IsFakeClient(i) && iAds[i] < sizeof(ADVERTS))
{
SendWinPanel(i, ADVERTS[iAds[i]]);
iAds[i]++;
show = true;
}
if(show) hTimer[1] = CreateTimer(10.0, cswinpanelclear);
hTimer[0] = null;
return Plugin_Stop;
}
public Action cswinpanelclear(Handle timer)
{
for(int i = 1; i <= MaxClients; i++) if(IsClientInGame(i) && !IsFakeClient(i) && iAds[i] <= sizeof(ADVERTS))
{
SendWinPanel(i);
iAds[i]++;
}
hTimer[1] = null;
return Plugin_Stop;
}
void SendWinPanel(int client, char[] txt = "")
{
Event event = CreateEvent("cs_win_panel_round", true);
event.SetString("funfact_token", txt);
event.FireToClient(client);
event.Cancel();
}
__________________