Raised This Month: $ Target: $400
 0% 

[fw_TakeDamage] Incredible Numbers !


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MPKiller545
Junior Member
Join Date: Aug 2011
Old 06-24-2012 , 12:24   [fw_TakeDamage] Incredible Numbers !
Reply With Quote #1

Hi there !

I have a problem with my code. I wanted to make an ability that 50% of your damage absorbs to your health. (100 damage = 50 additional health)

PHP Code:
public fwTakeDamage(victiminflictorattackerFloat:damage)
{
        if(
siekiera[attacker] == 1)
    {
        
set_user_health(attacker, (get_user_health(attacker) + damage/2))
        
        if(
get_user_health(attacker) > 100)
        
set_user_health(attacker,100)
        
        
set_hudmessage(25500, -1.0, -1.006.012.0)
        
show_hudmessage(attacker"Wartosc leczenia: %i"damage/2)
        return 
HAM_HANDLED
    

The problem is, that message "Wartosc leczenia:" shows me the number like 12471329 when I shoot someone, and I heal with that value. But when I make an ability (for example: You have 30% that you will attack with double damage), It works fine!

Last edited by MPKiller545; 06-24-2012 at 12:24.
MPKiller545 is offline
Kidev
Veteran Member
Join Date: Jun 2010
Location: France
Old 06-24-2012 , 12:27   Re: [fw_TakeDamage] Incredible Numbers !
Reply With Quote #2

'damage' is a float, and not an integer.
__________________
Kidev is offline
MPKiller545
Junior Member
Join Date: Aug 2011
Old 06-24-2012 , 12:28   Re: [fw_TakeDamage] Incredible Numbers !
Reply With Quote #3

So, how can I transfer a float to an integer?

I have checked that deleting 'Float:' before damage nothing changes.

Last edited by MPKiller545; 06-24-2012 at 12:31.
MPKiller545 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-24-2012 , 13:07   Re: [fw_TakeDamage] Incredible Numbers !
Reply With Quote #4

Quote:
Originally Posted by MPKiller545 View Post
So, how can I transfer a float to an integer?

I have checked that deleting 'Float:' before damage nothing changes.
floatround()
__________________
Bugsy is offline
MPKiller545
Junior Member
Join Date: Aug 2011
Old 06-24-2012 , 13:43   Re: [fw_TakeDamage] Incredible Numbers !
Reply With Quote #5

Thank You ; ]
MPKiller545 is offline
Reply


Thread Tools
Display Modes

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 06:13.


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