Lower Health Evrey 5 minutes.
#1

Hello,

I wanna make a system that your health lowers evrey 5 minutes.

But how ive made it right now it gives the player unlimited health....


pawn Код:
forward LowerHealth(playerid);
new stock LowerHealthTimer;

public OnGameModeInit()
{
   
    LowerHealthTimer = SetTimer("LowerHealth", 300000, true);
   
    return 1;
}

public LowerHealth(playerid)
{
    GetPlayerHealth(playerid, Player[playerid][Health]);
    Player[playerid][Health] -= 2;
    SetPlayerHealth(playerid, Player[playerid][Health]);
    return 1;
}
Reply
#2

Something like this should work...

pawn Код:
public LowerHealth(playerid)
{
    new hp = GetPlayerHealth(playerid, hp);
    Player[playerid][Health] = hp-2;
    SetPlayerHealth(playerid, hp-2);
    return 1;
}
Reply
#3

Quote:
Originally Posted by ricardo178
Посмотреть сообщение
Something like this should work...

pawn Код:
public LowerHealth(playerid)
{
    new hp = GetPlayerHealth(playerid, hp);
    Player[playerid][Health] = hp-2;
    SetPlayerHealth(playerid, hp-2);
    return 1;
}
he wants to use timer i think... which reduces health each 5 mins... not each 1 sec ^^
Reply
#4

Quote:
Originally Posted by ricardo178
Посмотреть сообщение
Something like this should work...

pawn Код:
public LowerHealth(playerid)
{
    new hp = GetPlayerHealth(playerid, hp);
    Player[playerid][Health] = hp-2;
    SetPlayerHealth(playerid, hp-2);
    return 1;
}
Warning:

pawn Код:
C:\Users\Stefan Dorst\Desktop\GTA SA\Abandoned Island RP\gamemodes\AIRP.pwn(281) : warning 213: tag mismatch
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
Reply
#5

Код:
//top of GM:
forward LH();

//public OnGameModeInIt:
SetTimer("LH", 300000, true);

//---------------------------------

public LowerHealth()
{
      new Float:health;
      new hp = GetPlayerHealth(playerid, health);
      if( health > 0.00)
      {
          SetPlayerHealth(playerid, hp-2); //2 is the amout of health which reduces each 5 min...you can change it 
       }
}
i think this one should work .... im at workplace so i cant test it ... not sure if it works :S but try it
edited... gonna test ifit works
Reply
#6

Quote:
Originally Posted by Stefand
Посмотреть сообщение
Warning:

pawn Код:
C:\Users\Stefan Dorst\Desktop\GTA SA\Abandoned Island RP\gamemodes\AIRP.pwn(281) : warning 213: tag mismatch
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
new Float:hp instead of new hp;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)