All I want is when a player dies, he would respawn in the same place he died and with the same weapon.
Everything is working fine except, he respawns in the same location he died, however, the weapon doesn't work.
Can someone help me with this code, thank you in advance!!!
Code: Select all
@TypedServerCommand('wcs_spawn_death')
def wcs_spawn_death_command(command_info, player:convert_userid_to_player, force:int=0):
if player is None:
return
weapon = player.last_weapon
location = player.origin
player.spawn(force)
player.teleport(location)
player.delay(10, player.give_named_item, (weapon,))
This command triggers after player's death (player_death)
The error that I get is:
Code: Select all
[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/packages/source-python/listeners/tick.py", line 80, in _tick
self.pop(0).execute()
File "../addons/source-python/packages/source-python/listeners/tick.py", line 161, in execute
return self.callback(*self.args, **self.kwargs)
File "../addons/source-python/packages/source-python/entities/_base.py", line 844, in _callback
callback(*args, **kwargs)
File "../addons/source-python/packages/source-python/entities/helpers.py", line 96, in __call__
*self.wrapper(self.wrapped_self, *args, **kwargs))
File "../addons/source-python/packages/source-python/memory/helpers.py", line 331, in __call__
return super().__call__(self._this, *args)
File "<string>", line 1, in <lambda>
TypeError: No registered converter was able to extract a C++ pointer to type char from this Python object of type int
If I do print(weapon) I get "-1"
Thank you guys in advance!!!