Raised This Month: $12 Target: $400
 3% 

Messages do not display


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
szogun
Senior Member
Join Date: Apr 2016
Old 01-23-2023 , 11:47   Messages do not display
Reply With Quote #1

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[] namebool dontBroadcast) {
    
int client GetClientOfUserId(GetEventInt(eEvent"userid"));
    
CreateTimer(10.0HintMessageclientTIMER_FLAG_NO_MAPCHANGE);
}

public 
Action HintMessage(Handle timerint 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.0cswinpanelclearclientTIMER_FLAG_NO_MAPCHANGE);
}

public 
Action cswinpanelclear(Handle timerint 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 >= && client <= MaxClients && IsClientInGame(client) && IsClientConnected(client) && !IsFakeClient(client) && !IsClientReplay(client) && !IsClientSourceTV(client))
        return 
true;
    return 
false;

szogun is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 01-23-2023 , 12:53   Re: Messages do not display
Reply With Quote #2

round_freeze_end does not have the "userid" parameter AFAIK,
do a for loop through all connected clients instead
__________________
Marttt is offline
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
szogun
Senior Member
Join Date: Apr 2016
Old 01-29-2023 , 08:56   Re: Messages do not display
Reply With Quote #4

Quote:
Originally Posted by Grey83 View Post
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();

PHP Code:
static const char ADVERTS[][] =
{
"<b><font color='#23f911' class='fontSize-xxl'>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 Link do discord pod komendą <b><font color='#ff0000' class='fontSize-l'>!dc</font></b> \n",
"<b><font color='#23f911' class='fontSize-xxl'>KONKURS</font></b> \n <b><font color='#ff0000' class='fontSize-l'>TOP3</font></b> osoby dostają VIPA \n Nagrodę odbieramy na <b><font color='#ff0000' class='fontSize-l'>Discord</font></b> \n Link do discord pod komendą <b><font color='#ff0000' class='fontSize-l'>!dc</font></b> \n",
"<b><font color='#23f911' class='fontSize-xxl'>֎</font></b> \n <font class='fontSize-l'>Z Vipem zawsze lepiej</font> \n <font color='#32ff00' class='fontSize-l'><b>TAB</b></font> -> <font color='#32ff00' class='fontSize-l'><b>Strona serwera</b></font> \n lub \n <font color='#32ff00' class='fontSize-l'><b>sklep.onefrag.pl</b></font> | <font color='#32ff00' class='fontSize-l'><b>!sklepsms</b></font> \n",
"<b><font color='#23f911' class='fontSize-xxl'>SKLEPSMS</font></b> \n <font class='fontSize-l'>Usługę VIP, kupisz w</font> <b><font color='#32ff00' class='fontSize-l'>!sklepsms</font></b> \n <font class='fontSize-l'>Dostępne metody płatności</font> <font color='#32ff00' class='fontSize-l'>SMS, PSC, Przelew, PayPal, Skiny</font> \n",
"<b><font color='#23f911' class='fontSize-xxl'>REKRUTACJA</font></b> \n <font class='fontSize-l'>Rekrutacja na Admina jest</font> <b><font color='#32ff00' class='fontSize-l'>OTWARTA!</font></b> \n <font class='fontSize-l'>Zachęcamy do składania podań, na <b></font> <font color='#32ff00' class='fontSize-l'>discord</font></b> \n Link do discord pod komendą <b><font color='#32ff00' class='fontSize-l'>!dc</font></b> \n",
"<b><font color='#23f911' class='fontSize-xxl'>ULUBIONE</font></b> \n <font class='fontSize-l'>Nie zapomnij dodać serwera do Ulubionych! \n </font> <b><font color='#ff0000' class='fontSize-l'>ESC</font></b> -> <b><font color='#ff0000' class='fontSize-l'>Wyszukiwarka serwerów społecznościowych</font></b> -> <b><font color='#ff0000' class='fontSize-l'>Ulubione</font></b> -> <b><font color='#ff0000' class='fontSize-l'>Dodaj ten serwer</font></b> \n"}; 
Hey, thank you for doing this, can you still tell me why it only displays the first three ads here and then no longer loops it to show them again

Last edited by szogun; 01-29-2023 at 08:58.
szogun is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 01-29-2023 , 10:10   Re: Messages do not display
Reply With Quote #5

Quote:
Originally Posted by szogun View Post
why it only displays the first three ads here and then no longer loops it to show them again
PHP Code:
#pragma newdecls required
#pragma semicolon 1

#define MAX_PLAYERS 32

static const char ADVERTS[][] =
{
    
"Reklama 1",
    
"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))
    {
        
SendWinPanel(iADVERTS[iAds[i]]);
        if(++
iAds[i] >= sizeof(ADVERTS)) iAds[i] = 0;
        
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)) SendWinPanel(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();

__________________
Grey83 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-30-2023 , 15:23   Re: Messages do not display
Reply With Quote #6

Quote:
Originally Posted by szogun View Post
Hey, thank you for doing this, can you still tell me why it only displays the first three ads here and then no longer loops it to show them again
Do you get any errors in sourcemod logs ?
__________________
Do not Private Message @me
Bacardi is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 01-30-2023 , 23:06   Re: Messages do not display
Reply With Quote #7

Quote:
Originally Posted by Bacardi View Post
Do you get any errors in sourcemod logs ?
Because I made it so that it shows all messages only once.
__________________
Grey83 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:11.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode