View Single Post
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 05-28-2012 , 21:27   Re: [ANY|TF2] Advanced Advertisements
Reply With Quote #2

How do I add my own advertisements?
Pretty simple, actually. Open the extended_advertisements.txt file located in your configs directory. It should look something like this:
Code:
"Advertisements"
{
	"1"
	{
		"type"		"C"
		"text"		"www.domain.com"
	}
	"2"
	{
		"type"		"CH"
		"text"		"[email protected]"
	}
	"3"
	{
		"type"		"M"
		"text"		"Next map is {NEXTMAP} in {TIMELEFT} minutes."
		"flags"		"cft"
	}
	"4"
	{
		"type"		"S"
		"text"		"{GREEN}Current {LIGHTGREEN}Map: {DEFAULT}{CURRENTMAP}"
	}
	"5"
	{
		"type"		"T"
		"text"		"{ORANGE}friendly fire is {CONVAR_BOOL:mp_friendlyfire}."
	}
	"6"
	{
		"type"		"S"
		"text"		"{GREEN}Admins: Sourcemod version is {CONVAR:sourcemod_version} and advertisement plugin version is {CONVAR:sm_extended_advertisements_version}"
		"flags"		"z"
	}
}
You could probably get how this works by taking a look at that template. Let's say we wanted to add a new advertisement. We increment the advertisement number by 1, so we start out like this:
Code:
	"7"
	{
	
	}
We first have to tell the plugin where we wanted to show this text, let's say we want to show it in the "say" text-box only, we add the "S" type to our code so now it looks like this:
Code:
	"7"
	{
		"type"		"S"
	}
We can now add the "text" to our advertisement. Valid tags in the "text" area are color tags and the ones listed below.
Lets say we wanted to add one that tells the people what their name is and has the color green, let's do so! As you can see, we have a {CLIENT_NAME} tag in our tag list. So if we were to add it, it would look something like this:
Code:
	"7"
	{
		"type"		"S"
		"text"		"Your name is {CLIENT_NAME}!"
	}
Now let's add the color green. The color tag for green is {GREEN}, so it ends out looking like this:
Code:
	"7"
	{
		"type"		"S"
		"text"		"{GREEN}Your name is {CLIENT_NAME}!"
	}
And it's that easy, but let's say we wanted to only show this to the people with the reservation flag (a), we would add a "flags" parameter and add the "a" flag as its value, so it looks like this:
Code:
	"7"
	{
		"type"		"S"
		"text"		"{GREEN}Your name is {CLIENT_NAME}!"
		"flags"		"a"
	}
What are the valid tags inside of "text"?
Here's a list for you:
  • {IP} - The IP of the server
  • {FULL_IP} - The full ip (including the port) of the server.
  • {PORT} - The connect port of the server.
  • {CURRENTMAP} - The current map that the server is on.
  • {NEXTMAP} - The next map that the server will go to.
  • {TICKRATE} - The tickrate of the server.
  • {SERVER_TIME} - The server time.
  • {SERVER_TIME24} - The server time in 24-hour format
  • {SERVER_DATE} - The server date.
  • {TIMELEFT} - The time that is left until the next level change.
  • {CLIENT_NAME} - The name of the client that is viewing the advertisement.
  • {CLIENT_STEAMID} - The Steam ID of the client that is viewing the advertisement.
  • {CLIENT_IP} - The IP of the client that is viewing the advertisement.
What are the valid color tags inside of "text"?
This all depends on the type of text. For example, in a "T" type text, you can use these tags:
{white}, {red}, {green}, {blue}, {yellow}, {purple}, {cyan}, {orange}, {pink}, {olive}, {lime}, {violet}, {lightblue}

Last edited by minimoney1; 06-30-2012 at 19:58.
minimoney1 is offline