[HL2:DM] Advertisment

A place for requesting new Source.Python plugins to be made for your server.

Please request only one plugin per thread.
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

[HL2:DM] Advertisment

Postby Painkiller » Sun May 14, 2017 7:23 pm

Hello community,

Someone could make me a advertisment plugin?



-advertisment (https://forums.alliedmods.net/showthrea ... 5?t=155705)
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] Advertisment

Postby Painkiller » Fri May 26, 2017 5:48 pm

Wanted to ask again if now, someone can help?
existenz
Senior Member
Posts: 111
Joined: Thu Feb 09, 2017 3:33 pm
Location: France
Contact:

Re: [HL2:DM] Advertisment

Postby existenz » Fri May 26, 2017 6:40 pm

A really simple advert with random advert all rounds in chat. Maybe later i can make a more improve plugin.

Syntax: Select all

from random import choice

from events import Event
from messages import SayText2

## GLOBAL

ADVERTS = [
'Advert 1',
'Advert 2',
'Advert 3',
]

## EVENT

@Event('round_start')
def _on_round_start(event_data):
message = choice(ADVERTS)
SayText2(message).send()
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] Advertisment

Postby Painkiller » Fri May 26, 2017 8:48 pm

Not work in HL2DM
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: [HL2:DM] Advertisment

Postby satoon101 » Fri May 26, 2017 9:07 pm

There is no round_start in HL2:DM. You would have to use a Repeat.
Image
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: [HL2:DM] Advertisment

Postby satoon101 » Fri May 26, 2017 9:56 pm

From a simple standpoint, maybe something like this (untested):

Syntax: Select all

from itertools import cycle

from listeners.tick import Repeat
from messages import SayText2

# Set to the time (in minutes) between adverts
MINUTES_BETWEEN_ADVERTS = 3

# Add all adverts in the list below
ADVERTS = cycle([
'Advert 1',
'Advert 2',
'Advert 3',
])


@Repeat
def _send_advert():
SayText2(next(ADVERTS)).send()

_send_advert.start(MINUTES_BETWEEN_ADVERTS * 60)
Image
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] Advertisment

Postby Painkiller » Sat May 27, 2017 6:39 am

Yes works good.
existenz
Senior Member
Posts: 111
Joined: Thu Feb 09, 2017 3:33 pm
Location: France
Contact:

Re: [HL2:DM] Advertisment

Postby existenz » Sat May 27, 2017 7:48 am

Oh sorry ! I don't check if HL2:DM has this event ...
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: [HL2:DM] Advertisment

Postby Ayuto » Sat May 27, 2017 7:58 am

Well, it exists, but it doesn't get fired. :grin:
existenz
Senior Member
Posts: 111
Joined: Thu Feb 09, 2017 3:33 pm
Location: France
Contact:

Re: [HL2:DM] Advertisment

Postby existenz » Sat May 27, 2017 9:16 am

Lol ! It's weird ...

Return to “Plugin Requests”

Who is online

Users browsing this forum: No registered users and 1 guest