Health/timer problem
#1

Ok, I have this timer, it's supposed to take 0.1 away from my health every 500ms (note this isn't the only thing in the timer) but instead it takes 1 which is really frustrating.

pawn Код:
public SmallTimer(playerid)
{
    new Float:H,  Float:R;

    GetPlayerHealth(playerid, H);
    R = 0.1;
   
    if(Raped[playerid] == true) {
        SetPlayerHealth(playerid, H - R);
    }
    return 1;
}
I used this and i tried a different method with no luck
pawn Код:
public SmallTimer(playerid)
{
    new Float:H;

    GetPlayerHealth(playerid, H);
   
    if(Raped[playerid] == true) {
        SetPlayerHealth(playerid, H - 0.1);
    }
    return 1;
}
Reply
#2

im not sure about this. but give it a try

Code
pawn Код:
public SmallTimer(playerid)
{
    new H = GetPlayerHealth(playerid);
    if(Raped[playerid] == true) return SetPlayerHealth(playerid, H -0.1);
    return 1;
}
PS: i use this kind of method on my server
Reply
#3

Quote:
Originally Posted by pds2012
Посмотреть сообщение
im not sure about this. but give it a try

Code
pawn Код:
public SmallTimer(playerid)
{
    new H = GetPlayerHealth(playerid);
    if(Raped[playerid] == true) return SetPlayerHealth(playerid, H -0.1);
    return 1;
}
PS: i use this kind of method on my server
That would do the same thing, the only difference is your returning a value which really isn't needed.
Reply
#4

This should work, it's weird that is taking away one.

pawn Код:
public SmallTimer(playerid)
{
    new Float:H,  Float:R; // Not neccessary
    GetPlayerHealth(playerid, H);
    R = 0.1; // Not neccessary
   
    if(Raped[playerid] == true) {
        SetPlayerHealth(playerid, H - R); // or SetPlayerHealth(playerid, H - 0.1);
    }
    return 1;
}
Reply
#5

That's odd. I wonder if something else in that timer is causing an issue... Mind posting the full thing?

See if this works either way, though:

pawn Код:
public SmallTimer(playerid)
{
    if(Raped[playerid] == true)
    {
        new
            Float:H,
            Float:R = 0.1
        ;

        GetPlayerHealth(playerid, H);
        SetPlayerHealth(playerid, H-R);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)