es_map_start not trihgerred in custom addon

Ask questions and share info about GunGame 5

es_map_start not trihgerred in custom addon

Postby Neka » Mon Sep 03, 2012 9:20 am

Hello!
Here the code
# ../scripts/custom/gg_knife_bonus/gg_knife_bonus.py

# ==================================================
# IMPORTS
# ==================================================
# Python Imports
import os
import random

# Eventscripts Imports
import es

# GunGame Imports
from gungame51.core.players.shortcuts import Player
from gungame51.core.addons.shortcuts import AddonInfo

# ==================================================
# ADDON REGISTRATION/INFORMATION
# ==================================================
info = AddonInfo()
info.name = 'gg_res'
info.title = 'GG Round End Sound'
info.author = 'Neka'
info.version = '1.0'

# =============================================================================
# >> LOAD & UNLOAD
# =============================================================================
def load():
    global randomResList

    randomResList = os.listdir('%s/cstrike/sound/gungame/gg_res/random' % (os.getcwd()))
    personalResList = os.listdir('%s/cstrike/sound/gungame/gg_res/personal' % (os.getcwd()))

def unload():
    pass


# ==================================================
# GAME EVENTS
# ==================================================
def es_map_start(event_var):
    print "KKhkjhkfjdshklHLKLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL"

#def es_map_start(event_var):
    #setDownload()
#    print "ES_MAP_START WORKED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"

def gg_win(event_var):
    ggPlayer = Player(event_var['userid'])
    player_weapon = ggPlayer.weapon

    if player_weapon == "knife":
        ggPlayer.give('smokegrenade', True, False)



# =================================================
# CUSTOM FUNCTION
# =================================================
def setDownload():
    for i in range(0, len(randomResList)):
        if randomResList[i].endswith('wav') or randomResList[i].endswith('mp3'):
            es.stringtable('downloadables', 'sound/gungame/gg_res/random/%s' %(randomResList[i]))


What's wrong with this event?
Neka

Private
Private
 
Posts: 40
Joined: Thu Sep 01, 2011 4:22 am

Postby satoon101 » Mon Sep 03, 2012 3:21 pm

I don't know if "print" works as intended, but I am not sure. es_map_start should definitely be working fine in custom addons. Maybe use, in place of print:
def es_map_start(event_var):
    es.msg('THIS IS A TEST FOR ES_MAP_START')
Satoon
satoon101

Site Admin
Site Admin
 
Posts: 1055
Joined: Thu Oct 09, 2008 4:27 pm

Postby Neka » Tue Sep 04, 2012 3:21 am

Still doesn't work
I need to place setDownload() function into es_map_start callback. It successful called from load(), but not from es_map_start.
Neka

Private
Private
 
Posts: 40
Joined: Thu Sep 01, 2011 4:22 am

Postby Neka » Tue Sep 04, 2012 3:46 am

Ok, it works, thanks.
Neka

Private
Private
 
Posts: 40
Joined: Thu Sep 01, 2011 4:22 am



Return to General Discussion

Who is online

Users browsing this forum: No registered users and 24 guests

cron