How to check the difference?
#6

Quote:
Originally Posted by Weirdosport
Quote:
Originally Posted by IntrozeN
That didn't work...

It's supposed to kill the player if he looses more then 40 hp on the update...
Well it wouldn't. If the new health is less than the old health:

20-70 = -50
-50 is not > 40
what you mean?

EDIT:
pawn Code:
new Float:faPlayerHealth[MAX_PLAYERS];  // float-array storing all players health.

public OnPlayerUpdate(playerid)
{
    new Float:fHealth;

    GetPlayerHealth(playerid, fHealth);

    if(fHealth != faPlayerHealth[playerid])
    {
      // Player health has changed since last update from player -> server, so obviously thats the thing updated.
      // Lets do further checks see if he've lost or gain health, anti health cheat? ;-)

      if(fHealth > faPlayerHealth[playerid])
      {
        /* He've gained health! Cheating? Write your own scripts here to figure how a player
            gained health! */

      }
    else if((fHealth - faPlayerHealth[playerid]) > 40)
      {
        SetPlayerHealth(playerid,0);
      }

      faPlayerHealth[playerid] = fHealth;
    }
}
PLEASE... Change so it will work? (A)
Reply


Messages In This Thread
How to check the difference? - by introzen - 14.03.2009, 16:04
Re: How to check the difference? - by Marcel - 14.03.2009, 16:15
Re: How to check the difference? - by Weirdosport - 14.03.2009, 16:19
Re: How to check the difference? - by introzen - 14.03.2009, 16:21
Re: How to check the difference? - by Weirdosport - 14.03.2009, 16:23
Re: How to check the difference? - by introzen - 14.03.2009, 16:24
Re: How to check the difference? - by Ghett0 - 14.03.2009, 16:27
Re: How to check the difference? - by Weirdosport - 14.03.2009, 16:29
Re: How to check the difference? - by introzen - 14.03.2009, 16:32
Re: How to check the difference? - by Ghett0 - 14.03.2009, 16:34

Forum Jump:


Users browsing this thread: 1 Guest(s)