SA-MP Forums Archive
Problem... - 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: Problem... (/showthread.php?tid=328080)



Problem... - viddo - 23.03.2012

Okay i made this code with no errors..
Код:
public CheckHealth(playerid)
{
   new Float:Health;
    GetPlayerHealth(playerid,Health);
    if(Health < 20)
    {
        hptimer = SetTimer("losehp",1000,true);
    }
    return 1;
}

forward hptimer(playerid);
public hptimer(playerid)
{
   new Float:Health;
   GetPlayerHealth(playerid, Health);
   SetPlayerHealth(playerid, Health -5); 
   return 1;
}
For some reason the health wont drop down by 5 minutes if the hp is lower than 20 -_-


Re: Problem... - .FuneraL. - 23.03.2012

Quote:
Originally Posted by viddo
Посмотреть сообщение
Okay i made this code with no errors..
Код:
public CheckHealth(playerid)
{
   new Float:Health;
    GetPlayerHealth(playerid,Health);
    if(Health < 20)
    {
        hptimer = SetTimer("losehp",1000,true);
    }
    return 1;
}

forward hptimer(playerid);
public hptimer(playerid)
{
   new Float:Health;
   GetPlayerHealth(playerid, Health);
   SetPlayerHealth(playerid, Health -5); 
   return 1;
}
For some reason the health wont drop down by 5 minutes if the hp is lower than 20 -_-
You want every 5 Minutes Fall From Player to HP 20?


Re: Problem... - viddo - 23.03.2012

No every 1 minute the player loses 5 hp but it wont work


Re: Problem... - Allu - 23.03.2012

Just set the timer to the correct value. The timer should be like 300k ms or so


Re: Problem... - viddo - 23.03.2012

Quote:
Originally Posted by Allu
Посмотреть сообщение
Just set the timer to the correct value. The timer should be like 300k ms or so
Didnt work -_-

Код:
forward CheckHealth(playerid);
public CheckHealth(playerid)
{
   new Float:Health;
    GetPlayerHealth(playerid,Health);
    if(Health < 20)
    {
    	SetTimerEx("losehp",300000,true);
    }
    return 1;
}

forward losehp(playerid);
public losehp(playerid)
{
   new Float:Health;
   GetPlayerHealth(playerid, Health);
   SetPlayerHealth(playerid, Health -5);
   return 1;
}



Re: Problem... - Face9000 - 23.03.2012

pawn Код:
SetTimerEx("losehp",60000,true);



Re: Problem... - viddo - 23.03.2012

Quote:
Originally Posted by Logitech90
Посмотреть сообщение
pawn Код:
SetTimerEx("losehp",60000,true);
Код:
forward CheckHealth(playerid);
public CheckHealth(playerid)
{
   new Float:Health;
    GetPlayerHealth(playerid,Health);
    if(Health < 20)
    {
    	SetTimerEx("losehp",60000,true);
    }
    return 1;
}

forward losehp(playerid);
public losehp(playerid)
{
   new Float:Health;
   GetPlayerHealth(playerid, Health);
   SetPlayerHealth(playerid, Health-5);
   return 1;
}
Still didn't work....
is there something wrong that i made that prevents the hp to lose ?