I figured out that giving a player a weapon with a gamethread (even if I just proof he is in the team CT or T) the server instantly crashes. Is it a bug on your side or is a gamethread not designed to work with giving named items?
Below is an example that let my server crash everytime I spawn together with some bots. If I spawn alone all is fine. It seems that I can't create multiple instances of the GameThread class for the same function, even if I try to use "name" to give them unique names at all. I don't know if it's a error related to python or sourcepython. As far as I know It should be possible to start the same function multiple times at nearly the same time without any problems (see http://www.saltycrane.com/blog/2008/09/ ... d-example/).
I also managed to get some more information for you: as far as I have tested this error only occurs if I give a player any kind of weapons / named items. All other functions related to the player entity seem to work (however I do not use many different functions of the player entity).
Syntax: Select all
from events import Event
from players.entity import Player
from listeners.tick import GameThread
## working
@Event('player_spawn')
def player_spawn(event):
test(event['userid'])
## not working
#@Event('player_spawn')
#def player_spawn(event):
# t = GameThread(target=test, args=(event['userid'], ))
# t.start()
def test(playerID):
player = Player.from_userid(playerID)
player.give_named_item('weapon_awp', 0, None, True)
Any help would be great. Idea behind using GameThread is that I don't want that stuff to happen directly in the server.ontick process. Because if something in my functions needs some time it will kill the server stability.