Page 1 of 2

Plugins converts from Eventscripts to Source Python

Posted: Thu Oct 01, 2015 1:27 pm
by Killer0561
Hi Guys,

Is there a possibility of old plugins EventScripts for Source Python rewrite?

  • ✓ download - (done)
  • ✓ noblock - (done)
  • ?! s_sounds - (needed!)
  • ?! serverad - (needed!)
  • ✓ showdamage - (done)
  • ✓ willkommen - (done)


Here all Plugins in 1 zip Archiv - http://www.file-upload.net/download-10945362/Eventscripts-Plugins.zip.html

Thanks in advance for the help :)


Greeting Killer0561

Posted: Fri Oct 23, 2015 6:18 pm
by Ayuto

Posted: Fri Oct 23, 2015 6:19 pm
by Ayuto
A noblock plugin:

Syntax: Select all

from events import Event
from entities.constants import CollisionGroup
from players.entity import Player
from players.helpers import index_from_userid

@Event('player_spawn')
def on_player_spawn(event):
userid = event.get_int('userid')
index = index_from_userid(userid)
player = Player(index)
player.collision_group = CollisionGroup.DEBRIS_TRIGGER

Posted: Fri Oct 23, 2015 6:19 pm
by Ayuto
A download plugin (shouldn't this be done by each plugin itself?):

Syntax: Select all

from stringtables.downloads import Downloadables

DOWNLOADABLES = [
'sound/s_sounds/saysounds/egu-multigaming.de/aua.wav',
'sound/s_sounds/saysounds/egu-multigaming.de/axel.mp3',
'sound/s_sounds/saysounds/egu-multigaming.de/badboys.wav',
'sound/s_sounds/saysounds/egu-multigaming.de/benny.wav',
'sound/s_sounds/saysounds/egu-multigaming.de/blut.mp3',
'sound/s_sounds/saysounds/egu-multigaming.de/body.mp3',
'sound/s_sounds/saysounds/egu-multigaming.de/cry.mp3',
'sound/s_sounds/saysounds/egu-multigaming.de/feelgood.mp3',
'sound/s_sounds/saysounds/egu-multigaming.de/frage.mp3',
'sound/s_sounds/saysounds/egu-multigaming.de/fu.mp3',
'sound/s_sounds/saysounds/egu-multigaming.de/haha.mp3',
'sound/s_sounds/saysounds/egu-multigaming.de/hehe.wav',
'sound/s_sounds/saysounds/egu-multigaming.de/hi.mp3',
'sound/s_sounds/saysounds/egu-multigaming.de/impossible.mp3',
'sound/s_sounds/saysounds/egu-multigaming.de/komm.wav',
'sound/s_sounds/saysounds/egu-multigaming.de/leben.mp3',
'sound/s_sounds/saysounds/egu-multigaming.de/lol.mp3',
'sound/s_sounds/saysounds/egu-multigaming.de/lucker.mp3',
'sound/s_sounds/saysounds/egu-multigaming.de/oops.mp3',
'sound/s_sounds/saysounds/egu-multigaming.de/power.mp3',
'sound/s_sounds/saysounds/egu-multigaming.de/schnauze.mp3',
'sound/s_sounds/saysounds/egu-multigaming.de/silence.wav',
'sound/s_sounds/saysounds/egu-multigaming.de/sry.mp3',
'sound/s_sounds/saysounds/egu-multigaming.de/taliban.mp3',
'sound/s_sounds/saysounds/egu-multigaming.de/time.mp3',
'sound/s_sounds/saysounds/egu-multigaming.de/verbot.mp3',
'sound/s_sounds/saysounds/egu-multigaming.de/woohoo.wav',
'sound/s_sounds/saysounds/egu-multigaming.de/wtf.mp3',
'sound/s_sounds/saysounds/egu-multigaming.de/yeah.wav',
'sound/s_sounds/saysounds/egu-multigaming.de/zzz.wav',
]

dl = Downloadables()

for downloadable in DOWNLOADABLES:
dl.add(downloadable)

Posted: Fri Oct 23, 2015 11:08 pm
by Killer0561
Thank you for the first assisted! I will test it this afternoon and give feedback.

Posted: Sun Oct 25, 2015 12:49 am
by Killer0561
esc_ess, esc_team_color and iptocountry_example not longer needed.
download, noblock and welcome already finished.

s_sounds, serverad and showdamage now needed.

- Killer0561

Posted: Sun Oct 25, 2015 8:35 am
by Killer0561
Hello Jerome69, thank you for your showdamage plugin.

- Killer0561

Posted: Fri Oct 30, 2015 9:45 am
by Predz
For adverts use the code below:

You just call send_advert where ever you want it to loop through. e.g. round_start, etc

Syntax: Select all

from ....... import send_advert

send_advert()


Syntax: Select all

# ======================================================================
# >> IMPORTS
# ======================================================================

from messages import SayText2

# ======================================================================
# >> GLOBALS
# ======================================================================

wcs_advert_text = [
'>> \x03Warcraft Source\x01: Type \x03"wcs" \x01in chat or console to access the WCS main menu.',
'>> \x03Warcraft Source\x01: Type \x03"playerinfo" \x01in chat to see other players WCS info.',
'>> \x03Warcraft Source\x01: Bind a key to \x03"ultimate" \x01to use a races ultimate.',
'>> \x03Warcraft Source\x01: Bind keys to \x03"ability 1" \x01and \x03"ability 2" \x01to use races abilities.'
]

wcs_adverts = list(map(SayText2, wcs_advert_text))
wcs_advert_count = len(wcs_adverts)

global wcs_advert
wcs_advert = 0

# ======================================================================
# >> EVENTS
# ======================================================================

def send_advert():
global wcs_advert

wcs_adverts[wcs_advert].send()

wcs_advert += 1
if wcs_advert == wcs_advert_count:
wcs_advert = 0

Posted: Fri Oct 30, 2015 1:03 pm
by Ayuto
That could be even easier if you use itertools.cycle(). :)

Syntax: Select all

# ======================================================================
# >> IMPORTS
# ======================================================================
# Python
import itertools

# Source.Python
from messages import SayText2


# ======================================================================
# >> CONSTANTS
# ======================================================================
ADVERTS = [
'>> \x03Warcraft Source\x01: Type \x03"wcs" \x01in chat or console to access the WCS main menu.',
'>> \x03Warcraft Source\x01: Type \x03"playerinfo" \x01in chat to see other players WCS info.',
'>> \x03Warcraft Source\x01: Bind a key to \x03"ultimate" \x01to use a races ultimate.',
'>> \x03Warcraft Source\x01: Bind keys to \x03"ability 1" \x01and \x03"ability 2" \x01to use races abilities.'
]


# ======================================================================
# >> GLOBAL VARIABLES
# ======================================================================
adverts = itertools.cycle(map(SayText2, ADVERTS))


# ======================================================================
# >> FUNCTIONS
# ======================================================================
def send_advert():
next(adverts).send()
Though, you should have mentioend that it's not a port of the advert plugin he uploaded.

Btw. you don't need the "global wcs_advert" at the global scope, because it already global. You never need the "global" statement at the global scope.

Posted: Fri Oct 30, 2015 2:02 pm
by Predz
Thanks Ayuto, didn't know that existed :)

Seem to have misunderstood slightly the global function :o

Posted: Fri Oct 30, 2015 8:24 pm
by decompile
Hey, you already said you don't need iptocountry and esc, but I would actually like them ported to spe :p

Posted: Mon Nov 02, 2015 9:18 am
by Killer0561
Last 3 Plugins needed:

- Saysounds (write the filename in chat and play the file for all)
- Roundendsounds (play a sound at the end of the round)
- Serverad (server live status in chat with game menu to connect)

Thanks in advance

- Killer0561

Posted: Mon Nov 02, 2015 3:26 pm
by Predz
Both sound plugins are going to require a bit of work if you are planning to do them on csgo. If you have a look at my topic on sounds the .n that should give you a good idea of how to do it. :) I will be back tomorrow as have work til late. Will try to post an example tomorrow :D

Posted: Tue Nov 03, 2015 1:12 pm
by Killer0561
I have found this Plugin and write in > Saysounds:


Syntax: Select all

from engines.sound import SOUND_FROM_WORLD
from engines.sound import Sound
from events import Event
from messages import SayText2

_sounds = {
'test': Sound((), SOUND_FROM_WORLD, 'saysounds/test.mp3', download=True),
}

_duplicates = {
'test': 'test1',
}


@Event('player_say')
def player_say(game_event):
"""Play a sound if necessary."""
text = game_event.get_string('text')

if text in _duplicates:
text = _duplicates[text]

if text in _sounds:

_sounds[text].play()


Is there a way, there still to limit the number of played sounds and add a text where available, which is currently playing sound?

Can we avoid overlap of sounds? Add here a warning text?

- Killer0561

Posted: Mon Nov 16, 2015 8:35 pm
by Killer0561
Can me anyone help?

Need it :)

Posted: Mon Nov 16, 2015 8:45 pm
by satoon101
What limit are you looking for? A limit on the number of sounds played per map? Per round? Per player?

Avoiding overlap should be fairly easy. Also, you are using the _duplicates incorrectly. The idea is that you use it for aliases. So, instead of test equaling test1, since test is a key in your _sounds dictionary, you would want test1 to equal test.

Syntax: Select all

from engines.sound import SOUND_FROM_WORLD
from engines.sound import Sound
from events import Event
from listeners.tick import tick_delays
from messages import SayText2
from players.helpers import index_from_userid

_sounds = {
'test': Sound((), SOUND_FROM_WORLD, 'saysounds/test.mp3', download=True),
}

_duplicates = {
'test1': 'test',
}

_current_sound = None


@Event('player_say')
def player_say(game_event):
"""Play a sound if necessary."""
global _current_sound

text = game_event['text']

if text in _duplicates:
text = _duplicates[text]

if text not in _sounds:
return

if _current_sound is not None:

SayText2('A sound is already playing: {0}'.format(_current_sound)).send(index_from_userid(game_event['userid']))
return

sound = _sounds[text]

sound.play()

_current_sound = sound.sample

tick_delays.delay(sound.duration, _reset_sound)


def _reset_sound():
global _current_sound
_current_sound = None

Posted: Mon Nov 16, 2015 11:31 pm
by Killer0561
Hello satoon,

many thanks for the quick response.

What limit are you looking for? A limit on the number of sounds played per map? Per round? Per player?


If it is possible to limit per player. (Maximum 3 Sounds).


- Killer0561

Posted: Tue Nov 17, 2015 7:14 am
by Doldol
decompile wrote:Hey, you already said you don't need iptocountry and esc, but I would actually like them ported to spe :p


IP to Country? What do you want specifically? I could easily make a threaded library using some web service for this, but I'm guessing you need an actual plugin?

Edit: Actually the old library is not specific to ES, you could probably get away by just using that, if you know how to script a little, getting a working plugin should be not to hard.

Posted: Wed Nov 18, 2015 4:44 pm
by Killer0561
Overlapping is still working. I have test it.

How to fix?


- Killer0561

Posted: Thu Nov 26, 2015 8:50 am
by Killer0561
I desperately needed to fix, because playing multiple and overlapping of sounds is constantly abused.

- Killer0561