How to check the difference?
#4

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;
    }
}
That didn't work...

It's supposed to kill the player if he looses more then 40 hp on the update...
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)