Raised This Month: $ Target: $400
 0% 

[HELP] Creating a task


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 02-13-2016 , 09:12   Re: [HELP] Creating a task
Reply With Quote #4

Quote:
Originally Posted by kapitana View Post
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_DAMAGEparams2__"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])
siriusmd99 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:26.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode