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

Advertisements 2.1 (Updated 2021/02/06)


Post New Thread Reply   
 
Thread Tools Display Modes
Ryan2
Senior Member
Join Date: Jul 2020
Old 07-06-2023 , 13:07   Re: Advertisements 2.1 (Updated 2021/02/06)
Reply With Quote #2221

Quote:
Originally Posted by mayersdz View Post
why are you advertising your shit on my server ? talkiing abotu that 5 usd ad .
OP does not have control over what is posted in your server, you do.

Check your advertisements.txt
Ryan2 is offline
Britney
New Member
Join Date: Jul 2023
Old 07-16-2023 , 09:38   Re: Advertisements 2.1 (Updated 2021/02/06)
Reply With Quote #2222

Hello, i have installed this plugin and only message center work. But i just need a chat message.
do you think to look at my configuration to know if I have a problem in it?
In the chat line I put a big Bonjouuuuuur to perform my tests but nothing appears on my server. Only message center work. I have www.domain.com appear

// Advertisements 2.1
// by Tsunami
//
// Types
// -----
// center: Center message
// chat: Chat message
// hint: Hint message
// menu: Menu message
// top: Top message
//
// Flags (optional)
// -----
// Accepts flags of admins that will not see the advertisement.
// When omitted everyone will see the advertisement.
// When left empty only admins will see the advertisement.

"Advertisements"
{
"1"
{
"center" "www.domain.com"
}
"2"
{
"center" "[email protected]"
"hint" "[email protected]"
}
"3"
{
"menu" "Next map is {nextmap} in {timeleft} minutes."
"flags" "cft"
}
"4"
{
"chat" "Bonjouuuuuuuuuuuuuur"
"flags" "z"
}
"5"
{
"top" "{orange}Admins: friendly fire is {mp_friendlyfire}."
"flags" ""
}
}

My servercfg

sm_advertisements_enabled 1
sm_advertisements_file "advertisements.txt"
sm_advertisements_interval 10
sm_advertisements_reload

thx a lot.
Britney is offline
paulo_crash
AlliedModders Donor
Join Date: May 2016
Location: Brazil
Old 07-16-2023 , 10:28   Re: Advertisements 2.1 (Updated 2021/02/06)
Reply With Quote #2223

Quote:
Originally Posted by Britney View Post
Hello, i have installed this plugin and only message center work. But i just need a chat message.
do you think to look at my configuration to know if I have a problem in it?
In the chat line I put a big Bonjouuuuuur to perform my tests but nothing appears on my server. Only message center work. I have www.domain.com appear
Test this configuration:
Code:
// Advertisements 2.1
// by Tsunami
//
// Types
// -----
// center: Center message
// chat: Chat message
// hint: Hint message
// menu: Menu message
// top: Top message
//
// Flags (optional)
// -----
// Accepts flags of admins that will not see the advertisement.
// When omitted everyone will see the advertisement.
// When left empty only admins will see the advertisement.

"Advertisements"
{
	"1"
	{
		"center" "www.domain.com"
	}
	"2"
	{
		"center" " [email protected] "
	}
	"3"
	{
		"menu" "Next map is {nextmap} in {timeleft} minutes."
		"flags" "cft"
	}
	"4"
	{
		"chat" "Bonjouuuuuuuuuuuuuur"
		"flags" "z"
	}
	"5"
	{
		"top" "{orange}Admins: friendly fire is {mp_friendlyfire}."
		"flags" ""
	}
	"6"
	{
		"hint" " [email protected] "
	}
}
paulo_crash is offline
Markie84
New Member
Join Date: Jul 2023
Old 07-18-2023 , 05:11   Re: Advertisements 2.1 (Updated 2021/02/06)
Reply With Quote #2224

Is there a way to handle two different chat annoucments with two different intervals?

Last edited by Markie84; 07-18-2023 at 08:16.
Markie84 is offline
Paralhama
New Member
Join Date: Aug 2021
Old 02-19-2024 , 20:58   Re: Advertisements 2.1 (Updated 2021/02/06)
Reply With Quote #2225

Your plugin is incredible!
I'm using it on my Fistful of Frags servers
but when using "Super kick is {sm_super_kick}.""
the result is "Super Kick is 0" or "Super Kick is 0"

So I made this small change

Instead of displaying 1 it will display "ON"
Instead of displaying 0 it will display "OFF"
If the variable is not found it will go to the next advertisement

PHP Code:
void ProcessVariables(const char[] messagechar[] bufferint maxlength)
{
    
char name[64], value[256];
    
int buf_idxiname_len;
    
ConVar hConVar;

    while (
message[i] && buf_idx maxlength 1) {
        if (
message[i] != '{' || (name_len FindCharInString(message[1], '}')) == -1) {
            
buffer[buf_idx++] = message[i++];
            continue;
        }

        
strcopy(namename_len 1message[1]);

        
// Block responsible for replacing variables
        
if ((hConVar FindConVar(name))) {
            
hConVar.GetString(valuesizeof(value));
            
// I modified this part to specifically handle the cases of 0 and 1
            
if (StrEqual(value"1")) {
                
buf_idx += strcopy(buffer[buf_idx], maxlength buf_idx"ON");
            } else if (
StrEqual(value"0")) {
                
buf_idx += strcopy(buffer[buf_idx], maxlength buf_idx"OFF");
            } else {
                
buf_idx += strcopy(buffer[buf_idx], maxlength buf_idxvalue);
            }
        } else {
            
// If the variable is not found, clear the buffer and exit the loop
            
buf_idx 0;
            break;
        }

        
+= name_len 2;
    }

    
buffer[buf_idx] = '\0';

Paralhama is offline
Reply



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 13:09.


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