View Single Post
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 01-25-2023 , 10:47   Re: Messages do not display
Reply With Quote #3

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_RoundStartEventHookMode_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[] namebool dontBroadcast)
{
    
OnMapStart();
    
hTimer[0] = CreateTimer(10.0HintMessage);
}

public 
Action HintMessage(Handle timer)
{
    if(
hTimer[1]) delete hTimer[1];

    
bool show;
    for(
int i 1<= MaxClientsi++) if(IsClientInGame(i) && !IsFakeClient(i) && iAds[i] < sizeof(ADVERTS))
    {
        
SendWinPanel(iADVERTS[iAds[i]]);
        
iAds[i]++;
        
show true;
    }
    if(
showhTimer[1] = CreateTimer(10.0cswinpanelclear);

    
hTimer[0] = null;
    return 
Plugin_Stop;
}

public 
Action cswinpanelclear(Handle timer)
{
    for(
int i 1<= MaxClientsi++) if(IsClientInGame(i) && !IsFakeClient(i) && iAds[i] <= sizeof(ADVERTS))
    {
        
SendWinPanel(i);
        
iAds[i]++;
    }

    
hTimer[1] = null;
    return 
Plugin_Stop;
}

void SendWinPanel(int clientchar[] txt "")
{
    
Event event CreateEvent("cs_win_panel_round"true);
    
event.SetString("funfact_token"txt);
    
event.FireToClient(client);
    
event.Cancel();

__________________

Last edited by Grey83; 01-25-2023 at 10:52.
Grey83 is offline