Quote:
Originally Posted by kapitana
Hello Alliedmodders,
I'm in a little need of scripting help creating a task ...
So .. what I'm trying to do is a task that gets the victim, attacker and the damage taken.
Here is an example:
set_task(0.2, "create_task", id+TASK_DAMAGE, attacker, damage, _, _, "b")
But I get an error every time I try to compile. If someone knows how to fix it .... please share
Thanks in advance
|
PHP Code:
native set_task(Float:time,const function[],id = 0,const parameter[]="",len = 0,const flags[]="", repeat = 0);
Because you can't send 2 arguments in this way , i mean attacker, damage. I tried myself once but it didn't work.You should use parameter[]="" instead, it's a string where you add your values .
So do this :
PHP Code:
new params[2]
param[0] = attacker
param[1] = damage
set_task(0.2, "create_task", id+TASK_DAMAGE, params, 2, _, _, "b")
But damage shall be the same type as attacker , if it's float then you convert it to number :
damage = floatround(damage)
And then if you need damage as float, you just convert it back to float :
new Float:dmg = float(param[1])