[ANY] Advertisement plugins

Release your plugins here!
existenz
Senior Member
Posts: 111
Joined: Thu Feb 09, 2017 3:33 pm
Location: France
Contact:

[ANY] Advertisement plugins

Postby existenz » Sat May 27, 2017 5:08 pm

Heya !

I have made a simple Advertisement plugin, normally working for any games. But i have tested only on Csgo.



Advert interval
Time in minutes between adverts. (Must be an integer)

Advert order
Define the appearance order of advert.
0 - Follow order of advert in json file.
1 - Get random advert.

Example :

Code: Select all

{
  "Adverts": [
    {
      "type": "say",
      "message": "Welcome on {hostname} !",
      "translation": "say:1"
    },
    {
      "type": "say",
      "message": "The current map is {currentmap}",
      "translation": "say:2"
    },
    {
      "type": "hint",
      "message": "Kill them all ! [Friendlyfire : {mp_friendlyfire}]",
      "translation": "hint:1"
    },
    {
      "type": "hud",
      "message": "The time is {time}",
      "translation": "hud:1"
    }
  ]
}


The translation attribute must contains the key of advert translation and must refer to a key in 'advertissement_server.ini'. If "translation" attribute is defined you are not oblige to write something in "message" key.

Code: Select all

{
  "Adverts": [
    {
      "type": "say",
      "message": "",
      "translation": "say:1"
    }
  ]
}



In the message of advert you can also add color. Use the default color available in your game for example in Csgo if i want green i can add \x04.

Define template variables :

- {currentmap} : Show current map name
- {date} : Show current date
- {time} : Show current time


Other variables :
You can also show all cvar of your server, like mp_friendlyfire, mp_roundtime ...

Sincerly Existenz.

Ps : Thanks to Satoon for his advert system (viewtopic.php?f=37&p=10430#p10426)
Last edited by existenz on Sun May 28, 2017 12:06 pm, edited 1 time in total.
User avatar
Kill
Member
Posts: 88
Joined: Wed Aug 31, 2016 10:05 pm

Re: [ANY] Advertisement plugins

Postby Kill » Sat May 27, 2017 10:01 pm

Can You make the interval compatible with seconds? Thanks!


Edit:

I tried to color the message, but it fails to load

Syntax: Select all

#Error: ValueError: Json file incorrect.
# Msgs:
{
"Adverts": [
{
"type": "say",
"message": "Welcome on our server !"
},
{
"type": "say",
"message": "\x02The current map is \x03{currentmap}"
},
{
"type": "hint",
"message": "Kill them all ! [Friendlyfire : {mp_friendlyfire}]"
},
{
"type": "hud",
"message": "\x02The time is \x03{time}"
}
]
}



Game: CSS
Last edited by Kill on Sat May 27, 2017 10:46 pm, edited 1 time in total.
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Re: [ANY] Advertisement plugins

Postby iPlayer » Sat May 27, 2017 10:10 pm

Kill, try replacing all \x with \\x
Image /id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam

Hail, Companion. [...] Hands to yourself, sneak thief. Image
User avatar
Kill
Member
Posts: 88
Joined: Wed Aug 31, 2016 10:05 pm

Re: [ANY] Advertisement plugins

Postby Kill » Sat May 27, 2017 10:20 pm

iPlayer wrote:Kill, try replacing all \x with \\x



Tried that, doesn't work, they show as plain-text
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Re: [ANY] Advertisement plugins

Postby iPlayer » Sat May 27, 2017 10:31 pm

How about this

Syntax: Select all

{
"Adverts": [
{
"type": "say",
"message": "Welcome on our server !"
},
{
"type": "say",
"message": "\u0002The current map is\u0001 \u0003{currentmap}\u0001"
},
{
"type": "hint",
"message": "Kill them all ! [Friendlyfire : {mp_friendlyfire}]"
},
{
"type": "hud",
"message": "\u0002The time is\u0001 \u0003{time}\u0001"
}
]
}
Image /id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam

Hail, Companion. [...] Hands to yourself, sneak thief. Image
User avatar
Kill
Member
Posts: 88
Joined: Wed Aug 31, 2016 10:05 pm

Re: [ANY] Advertisement plugins

Postby Kill » Sat May 27, 2017 10:44 pm

It works now, thanks!
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Re: [ANY] Advertisement plugins

Postby iPlayer » Sat May 27, 2017 10:49 pm

Existenz,

I think that the message field should define the translation key. That'd allow the server owners to support multiple languages and define the actual strings in resource/source-python/translations/advertisement.server.ini
Image /id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam

Hail, Companion. [...] Hands to yourself, sneak thief. Image
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: [ANY] Advertisement plugins

Postby satoon101 » Sat May 27, 2017 11:06 pm

To add to that suggestion, maybe to help denote say vs hint (vs whatever else you might want to support), the strings in the advertisement_server.ini could utilize prefixes:

Syntax: Select all

[chat:1]
en = "Advert 1."

[chat:2]
en = "Advert 2."

[hint:1]
en = "Advert 3."

And maybe, instead of including the advertisement.ini itself, you could create it if it doesn't exist. So, something like the following:

Syntax: Select all

from configobj import ConfigObj

from paths import TRANSLATION_PATH

from .info import info

TRANSLATION_FILE = TRANSLATION_PATH / info.name + '.ini'


def _create_translation_file():
ini = ConfigObj(TRANSLATION_FILE)
ini['chat:1'] = {'en': 'Advert 1.'}
ini['chat:2'] = {'en': 'Advert 2.'}
ini['hint:1'] = {'en': 'Advert 3.'}

# The following creates a one line separation between items
for item in ini.items():
ini.comments[item] = ['']

ini.write()

if not TRANSLATION_FILE.isfile():
_create_translation_file()
Image
existenz
Senior Member
Posts: 111
Joined: Thu Feb 09, 2017 3:33 pm
Location: France
Contact:

Re: [ANY] Advertisement plugins

Postby existenz » Sun May 28, 2017 8:21 am

Heya ! Thanks for your answer.

@Kill : Yes i will modify minute to second.

@iPlayer : I think also it could be better to be multilingual.

@Satoon : I must have the advertisement.ini because i have one translation for my plugin (https://github.com/VenomzGaming/Sp-Adve ... ent.ini#L1).
But i will try something :)
existenz
Senior Member
Posts: 111
Joined: Thu Feb 09, 2017 3:33 pm
Location: France
Contact:

Re: [ANY] Advertisement plugins

Postby existenz » Sun May 28, 2017 12:06 pm

Plugin reworked !

- Modify time to seconds
- Add translation system support

Return to “Plugin Releases”

Who is online

Users browsing this forum: No registered users and 16 guests