Syntax: Select all
@ClientCommand('!polymorph')
def polymorph(command, index):
player = Player(index)
target = player.get_view_player()
if not target:
return
mdl = target.model
target.model = Model('models/chicken/chicken.mdl')
for weapon in target.weapons():
Delay(3, target.give_named_item, (weapon.weapon_name,))
weapon.remove()
Delay(3, resetModel, (target, mdl))
def resetModel(player, mdl):
player.model = mdl
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\memory\helpers.py", line 334, in __call__ return super().__call__(self._this, *args) File "<string>", line 1, in <lambda> ValueError: Number of passed arguments is not equal to the required number.
The exception is caused on the Delay that gives weapons (tested this in various ways to make sure). At first I thought it was an issue with giving someone a weapon if they didn't have the animations for one etc (i.e. being a chicken) but then when I increased the delay to 3.5 versus the 3 second delay for returning the model to its original state, it gave the same error as well.