hey , will you help me to make the plug-in correctly, I unfortunately no longer have the skills to make it work
PHP Code:
#include <sourcemod>
#pragma newdecls required
#pragma semicolon 1
#define MAX_PLAYERS 32
int ReklamaHint[MAX_PLAYERS+1];
g_sAdverts[][] = {
"<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"};
public void OnClientPutInServer(int client)
{
ReklamaHint[client] = 0;
}
public void OnPluginStart() {
HookEvent("round_freeze_end", Event_RoundStart);
}
public Action Event_RoundStart(Event eEvent, const char[] name, bool dontBroadcast) {
int client = GetClientOfUserId(GetEventInt(eEvent, "userid"));
CreateTimer(10.0, HintMessage, client, TIMER_FLAG_NO_MAPCHANGE);
}
public Action HintMessage(Handle timer, int client){
if(!IsValidClient(client)) return;
PrintToChat(client,"timer"); //debug
char sBuffer[1024];
Format(sBuffer,sizeof(sBuffer),"%s",g_sAdverts[ReklamaHint[client]]);
PrintToChat(client,"showwinpanel"); //debug
Event eEvent = CreateEvent("cs_win_panel_round", true);
eEvent.SetString("funfact_token", sBuffer);
eEvent.FireToClient(client);
eEvent.Cancel();
CreateTimer(10.0, cswinpanelclear, client, TIMER_FLAG_NO_MAPCHANGE);
}
public Action cswinpanelclear(Handle timer, int client){
PrintToChat(client,"clearwinpanel"); //debug
Event eEvent = CreateEvent("cs_win_panel_round", true);
eEvent.SetString("funfact_token", "");
eEvent.FireToClient(client);
eEvent.Cancel();
}
public bool IsValidClient(int client)
{
if(client >= 1 && client <= MaxClients && IsClientInGame(client) && IsClientConnected(client) && !IsFakeClient(client) && !IsClientReplay(client) && !IsClientSourceTV(client))
return true;
return false;
}