Raised This Month: $ Target: $400
 0% 

[HELP] Creating a task


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 02-13-2016 , 13:10   Re: [HELP] Creating a task
Reply With Quote #5

Quote:
Originally Posted by siriusmd99 View Post
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])
You don't have to convert it, it's okay just to re-tag the variable to avoid the compiler warning. Doing it your way you are even truncating the fractional part of a float value, which is a data loss.

PHP Code:
public Player_TakeDamage(idinflictorattackerFloatdamagedamagetype) {
    new 
params[2];
    
params[0] = attacker;
    
params[1] = _:damage;

    
set_task(0.2"create_task"id TASK_DAMAGEparamssizeof(params), __"b");
}

public 
create_task(params[], taskid) {
    new 
attacker params[0];
    new 
Floatdamage Floatparams[1];

I know it seems unnatural, and that tags in Pawn can be confusing. That's why we all hate tags.
klippy 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