Events

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
mister-man
Member
Posts: 70
Joined: Wed Aug 29, 2012 7:09 pm
Location: Germany

Events

Postby mister-man » Fri Aug 16, 2013 12:15 pm

Hay,

today I tried some basic things about Events.

My Code:

Code: Select all

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

from events import Event
from AoD._libs import saylib

# =============================================================================
# >> FUNCTION
# =============================================================================

@Event
def player_spawn(GE):
    userid = GE.get_int('userid')
    psay = saylib.saylib()
    psay.tell('#greenYour userid is ' + str(userid) ,userid)


Error:

Code: Select all

[SP]  Caught an Exception:
Traceback (most recent call last):
  File '..\addons\source-python\_libs\addons\manager.py', line 48, in __missing_
_
    instance = _LoadedAddon(addon_name)
  File '..\addons\source-python\_libs\addons\manager.py', line 237, in __init__

    self._addon = __import__(addon_name + '.' + addon_name)
  File '..\addons\source-python\AoD\AoD.py', line 16, in <module>
    from AoD._plugins import player
  File '..\addons\source-python\AoD\_plugins\player.py', line 11, in <module>
    from events import Event
  File '..\addons\source-python\_libs\events\__init__.py', line 11, in <module>

    from events.manager import EventRegistry
  File '..\addons\source-python\_libs\events\manager.py', line 10, in <module>
    from events import EventsLogger

ImportError: cannot import name EventsLogger
----------

Community of Gamers --> http://c-o-g.de
User avatar
mister-man
Member
Posts: 70
Joined: Wed Aug 29, 2012 7:09 pm
Location: Germany

Postby mister-man » Sun Aug 18, 2013 3:20 pm

I won't push, but no one with an idea?
----------



Community of Gamers --> http://c-o-g.de
User avatar
mister-man
Member
Posts: 70
Joined: Wed Aug 29, 2012 7:09 pm
Location: Germany

Postby mister-man » Mon Aug 19, 2013 3:28 pm

I found these exampe, but it seems, there is the same bug as in my script

Code: Select all

@Event
def player_say(event):
    # Get the userid from the event
    userid = event.get_int('userid')
    # Get the CPlayerInfo instance from the userid
    playerinfo = playerinfo_from_userid(userid)
    # And finally get the player's name
    name = playerinfo.get_name()
----------



Community of Gamers --> http://c-o-g.de
Omega_K2
Senior Member
Posts: 227
Joined: Sat Jul 07, 2012 3:05 am
Location: Europe
Contact:

Postby Omega_K2 » Mon Aug 19, 2013 3:31 pm

You gotta fix it urself in that file, or update to a newer revision.
Libraries: k2tools
Plugins (any): GSRPG (soon) | Pretty Status List | MySQLAds (soon)
Plugins (game-specific): None atm

If you happen to find a bug or need help, either post in the release threads or contact me in IRC gamesurge.net:6667 / #sourcepython
User avatar
mister-man
Member
Posts: 70
Joined: Wed Aug 29, 2012 7:09 pm
Location: Germany

Postby mister-man » Mon Aug 19, 2013 4:23 pm

I updated today and compiled all new.
Same error.

Sry my experience with sp is not so big, but Im learning ;)


Edit1:
Okay I found the rev....

Thanks


Edit2:
Okay I tried a new reversion (11011a987fea)), but it seems there is the same error!

Code: Select all

[SP]  Caught an Exception:
Traceback (most recent call last):
  File '..\addons\source-python\_libs\addons\manager.py', line 48, in __missing_
_
    instance = _LoadedAddon(addon_name)
  File '..\addons\source-python\_libs\addons\manager.py', line 237, in __init__

    self._addon = __import__(addon_name + '.' + addon_name)
  File '..\addons\source-python\AoD\AoD.py', line 20, in <module>
    from events import Event
  File '..\addons\source-python\_libs\events\__init__.py', line 11, in <module>

    from events.manager import EventRegistry
  File '..\addons\source-python\_libs\events\manager.py', line 11, in <module>
    from events.listener import _EventListener
  File '..\addons\source-python\_libs\events\listener.py', line 10, in <module>

    from events import EventsLogger

ImportError: cannot import name EventsLogger
----------



Community of Gamers --> http://c-o-g.de
Omega_K2
Senior Member
Posts: 227
Joined: Sat Jul 07, 2012 3:05 am
Location: Europe
Contact:

Postby Omega_K2 » Tue Aug 20, 2013 11:32 am

Fix that manually for the time being.
Libraries: k2tools

Plugins (any): GSRPG (soon) | Pretty Status List | MySQLAds (soon)

Plugins (game-specific): None atm



If you happen to find a bug or need help, either post in the release threads or contact me in IRC gamesurge.net:6667 / #sourcepython

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 34 guests