PlayerEntity crashed csgo server

All other Source.Python topics and issues.
User avatar
mister-man
Member
Posts: 70
Joined: Wed Aug 29, 2012 7:09 pm
Location: Germany

PlayerEntity crashed csgo server

Postby mister-man » Thu Jan 16, 2014 7:52 pm

Hay,

if I try to use PlayerEntity, my csgo server crashed.

Code:

Code: Select all

    def __pInstance(self):
        index = index_from_userid(self.__userid)
        return PlayerEntity(index)      ## <--- Server Crash


Image
----------

Community of Gamers --> http://c-o-g.de
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Thu Jan 16, 2014 8:08 pm

I am waiting until all the internal changes have been made before I start fixing the Python API. That shouldn't take too much longer, but these issues will be resolved in due time. Out of curiosity, are you certain index_from_userid isn't the cause of the crash? I just need to make sure when I start fixing issues that I am looking in the right place.

Satoon
User avatar
mister-man
Member
Posts: 70
Joined: Wed Aug 29, 2012 7:09 pm
Location: Germany

Postby mister-man » Fri Jan 17, 2014 8:27 am

I used these code:

Code: Select all


class player(object):
    def __init__(self, userid):
        #log.log("New player %s" % userid)
        self.__userid = userid
        self.__playerInstance = self.__pInstance()
        #self.__steamid = self.getPlayerInstance().steamid()
        self.__steamid = "0"
       
    def __pInstance(self):
        # Get the players PlayerEntity instance
        index = index_from_userid(self.__userid)
        return PlayerEntity(index)      ## <--- Server Crash
       
    def getPlayerInstance(self):
        return self.__playerInstance
   
    def getSteamid(self):
        return self.__steamid
       
    def getUserid(self):
        return self.__userid
   
    def tell(self, msg):
        slib.tell(msg, self.__userid)


The code works fine, until the funktion " def __pInstance(self):" is called. After that the server crashed in these line "return PlayerEntity(index)". But I can't say for 100% that "index = index_from_userid(self.__userid)" work fine. But if I try to use "PlayerEntity" the server crashed.
----------



Community of Gamers --> http://c-o-g.de
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Fri Jan 17, 2014 5:12 pm

Are you using the most up-to-date version of everything from the repository or are you using the latest download version? I actually get an error on index_from_userid with the latest repo version, which would stop the code prior to even executing PlayerEntity.

Satoon
User avatar
mister-man
Member
Posts: 70
Joined: Wed Aug 29, 2012 7:09 pm
Location: Germany

Postby mister-man » Fri Jan 17, 2014 5:44 pm

I used a mixed version, because if I use the repo version the sp command is unknown. And the ob version stops with an error while compiling.
But if I use the download version, there is the same issue then my version. In the download and my version index_from_userid works fine ;)
----------



Community of Gamers --> http://c-o-g.de
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Fri Jan 17, 2014 5:48 pm

Well, unfortunately, using a "mixed" version is obviously going to have its issues. I don't think we can support a mixed version. If you are going to report errors or crashes, please use the repo version, as that is what we are working off of and would need to fix.

Having said that, you stated that the repo version says the sp command is unknown. That would mean that sometime during startup, there was an error prior to the sp command being created. Would you please look at your server's console and post that error here? You will need to turn logging on, in order to see this issue:
http://www.sourcepython.com/showwiki.php?title=Wiki:Administration+and+General+Usage#Configuring+Source+Python

We will do our best to get those OB build errors fixed in due time.

Satoon
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Fri Jan 17, 2014 7:34 pm

Actually, having thought more about my previous post, I should also state that if you are reporting crashes/bugs using the current repo version, you should post them on the issues list:
https://github.com/Source-Python-Dev-Team/Source.Python/issues

Satoon
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sat Jan 18, 2014 1:20 am

Ok, figured out what "might" have been your sp is an unknown command issue. If you do not upload the newest translations from ../resource/source-python/translations/, you will receive a KeyError, which we do not account for, and no error message will be shown. Please update your server's files and test again. I did have to update one of the translations that was missing an end quotation, so pull any changes to your local repo prior to updating those files on your server.

Satoon
User avatar
mister-man
Member
Posts: 70
Joined: Wed Aug 29, 2012 7:09 pm
Location: Germany

Postby mister-man » Sun Jan 19, 2014 7:37 pm

Oaky thanks.

Burt I tried it, now code that works fine doesn't work:

Code: Select all


[SP]  Caught an Exception:
Traceback (most recent call last):
  File '..\addons\source-python\packages\source-python\events\listener.py', line
 82, in fire_game_event
    callback(game_event)
  File '..\addons\source-python\plugins\premium\premium.py', line 94, in player_
connect
    playerD[userid] = player(userid)
  File '..\addons\source-python\plugins\premium\premium.py', line 64, in __init_
_
    self.__playerInstance = self.__pInstance()
  File '..\addons\source-python\plugins\premium\premium.py', line 69, in __pInst
ance
    index = index_from_userid(self.__userid)
  File '..\addons\source-python\packages\source-python\players\helpers.py', line
 29, in index_from_userid
    return index_from_playerinfo(playerinfo_from_userid(userid))
  File '..\addons\source-python\packages\source-python\players\helpers.py', line
 155, in playerinfo_from_userid
    return CPlayerInfo(userid)

RuntimeError: This class cannot be instantiated from Python


Code:

Code: Select all

class player(object):
    def __init__(self, userid):
        log.log("New player %s" % userid)
        self.__userid = userid
        self.__playerInstance = self.__pInstance()
        self.__steamid = self.getPlayerInstance().steamid()
 
    def __pInstance(self):
        # Get the players PlayerEntity instance
        index = index_from_userid(self.__userid)
        return PlayerEntity(index)      ## <--- Server Crash
       
    def getPlayerInstance(self):
        return self.__playerInstance
   
    def getSteamid(self):
        return self.__steamid

    def getUserid(self):
        return self.__userid
   
    def tell(self, msg):
        slib.tell(msg, self.__userid)

@Event
def player_connect(ev):
    userid = ev.get_int('userid')
    print(userid)
    playerD[userid] = player(userid)
    playerD[userid].tell("#redWillkommen auf unseren Server!")

----------



Community of Gamers --> http://c-o-g.de
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sun Jan 19, 2014 8:03 pm

Yes, I have noticed this as well. This is from the internal changes being made. Until all the changes have been made, some things will be broken. Give us time, and we will get all of these fixed.

Satoon
User avatar
mister-man
Member
Posts: 70
Joined: Wed Aug 29, 2012 7:09 pm
Location: Germany

Postby mister-man » Mon Jan 20, 2014 1:54 pm

Okay, thanks a lot!
----------



Community of Gamers --> http://c-o-g.de

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 48 guests