SA-MP Forums Archive
Lower Health Evrey 5 minutes. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Lower Health Evrey 5 minutes. (/showthread.php?tid=369818)



Lower Health Evrey 5 minutes. - Stefand - 18.08.2012

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;
}



Re : Lower Health Evrey 5 minutes. - ricardo178 - 18.08.2012

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;
}



Re: Re : Lower Health Evrey 5 minutes. - R4VER - 18.08.2012

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 ^^


Re: Re : Lower Health Evrey 5 minutes. - Stefand - 18.08.2012

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.



Re: Lower Health Evrey 5 minutes. - R4VER - 18.08.2012

Код:
//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


Re : Re: Re : Lower Health Evrey 5 minutes. - ricardo178 - 18.08.2012

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;