GetPlayerHealth - pawno bug?
#1

Hi, i'm not reporting on this here because i'm not sure it is a bug this is my code:
pawn Код:
public hThisPlayerMainTimer(playerid)
{
    new Float:health;
    GetPlayerHealth(playerid, health);
    if(health == 90)
    {
    SetPlayerDrunkLevel(playerid, 1000);
    } else if(health == 80)
    {
    SetPlayerDrunkLevel(playerid, 10000);
    } else if(health == 30)
    {
    SetPlayerDrunkLevel(playerid, 50000);
    SetPlayerChatBubble(playerid, "\"i need backup!\"", 0xFF0000FF, 100.0, 4000);
    }
    return 1;
}
it has no problems, it's pawno i'm asking,
it saying "GetPlayerHealth(playerid, health);" is not needed (health is not needed)
look at the image:



but when

pawn Код:
public hThisPlayerMainTimer(playerid)
{
    new Float:health = GetPlayerHealth(playerid);
    if(health == 90)
    {
    SetPlayerDrunkLevel(playerid, 1000);
    } else if(health == 80)
    {
    SetPlayerDrunkLevel(playerid, 10000);
    } else if(health == 30)
    {
    SetPlayerDrunkLevel(playerid, 50000);
    SetPlayerChatBubble(playerid, "\"i need backup!\"", 0xFF0000FF, 100.0, 4000);
    }
    return 1;
}
it gives me warning
(233) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Warning.

version of something: RC1-2
why it doesn't tell me "playerid, Float:health" or something, in that "CheckToolTip"?
Reply
#2

https://sampwiki.blast.hk/wiki/SetPlayerHealth

Important note: Health must be an integer not a float, you can get the integer from a float using floatround. useful when using GetPlayerHealth, which returns a float
Reply
#3

Who care about that actually ...
Reply
#4

Quote:
Originally Posted by $ЂЯĢ
Pawno tells you which parameter you need to input at that time. When you will fill 'playerid' it will show you 'health'
it's not
look:

see?
Quote:
Originally Posted by Calgon
https://sampwiki.blast.hk/wiki/SetPlayerHealth

Important note: Health must be an integer not a float, you can get the integer from a float using floatround. useful when using GetPlayerHealth, which returns a float
i said GetPlayerHealth not SetPlayerHealth


but...
can it run without any problems in-game cause i can't test it
Reply
#5

Native function is GetPlayerHealth(playerid, &Float:health), so unfortunately you need ot fill up both parameters to get it work.

Same thing happens for GetPlayerArmour.
Reply
#6

You're using it as an integer, not a float. Surely you'd also want to use health >= 30 && health < 40 or something.
Reply
#7

what do you mean?
Reply
#8

Quote:
Originally Posted by Daem.
what do you mean?
You're only checking if their health is exactly 30, 40, etc. But as SERG (with the weird characters) said, the native function includes the health parameter.
Reply
#9

Quote:
Originally Posted by Seif_ [adream-rp.com
]
You guys aren't seeing his issue. And by the way, you can use integer in checks with floats.
As you know, GetPlayerHealth needs 2 params: playerid and health float to fill in. In pawn, while typing in the function, this bubble pops and tells you the missing fields left to fill in. However only "playerid" is showing up in the bubble whilst it should also have "&health" in the bubble shown without being bold.
I know that, I'm pointing out that he's not going to actually be able to verify if the health is in between. Yup, pawno bug.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)