Page 1 of 1
PlayerEntity crashed csgo server
Posted: Thu Jan 16, 2014 7:52 pm
by mister-man
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

Posted: Thu Jan 16, 2014 8:08 pm
by satoon101
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
Posted: Fri Jan 17, 2014 8:27 am
by mister-man
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.
Posted: Fri Jan 17, 2014 5:12 pm
by satoon101
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
Posted: Fri Jan 17, 2014 5:44 pm
by mister-man
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

Posted: Fri Jan 17, 2014 5:48 pm
by satoon101
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
Posted: Fri Jan 17, 2014 7:34 pm
by satoon101
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/issuesSatoon
Posted: Sat Jan 18, 2014 1:20 am
by satoon101
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
Posted: Sun Jan 19, 2014 7:37 pm
by mister-man
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!")
Posted: Sun Jan 19, 2014 8:03 pm
by satoon101
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
Posted: Mon Jan 20, 2014 1:54 pm
by mister-man
Okay, thanks a lot!