SA-MP Forums Archive
Allways 1hp - 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: Allways 1hp (/showthread.php?tid=303409)



Allways 1hp - lukas567 - 13.12.2011

Hey!

What script makes player to have 1hp allways? Even if you get damaged you will have 1hp allways.


Re: Allways 1hp - Sascha - 13.12.2011

pawn Код:
public OnGameModeInit()
{
  SetTimer("HPT", 1, true);
  return 1;
}

forward HPT();
public HPT()
{
  for(new i=0; i<GetMaxPlayers(); i++)
  {
    if(IsPlayerConnected(i))
      SetPlayerHealth(i, 1.0);
  }
  return 1;
}
(yes I know, this causes lags and isn't a good way to code, although the standart of the code fits to the standart of the question ; -)


Re: Allways 1hp - TheArcher - 13.12.2011

@Sascha Why did you set 1ms to interval update? It's enough 1000 or less to update the timer.


Re: Allways 1hp - iTorran - 13.12.2011

Someone can get punched and die in less than a second


Re: Allways 1hp - Phanto90 - 13.12.2011

I think that the player would die anyway, no matter if you setplayerhealth each second.
Try jumping from a building or loose health


Re: Allways 1hp - TheArcher - 13.12.2011

Phanto is perfectly right. I would to say that 1000ms = 1second 1ms = 0.1 second why it could be checked in 1ms? It doesn't change anything in this case.


Re: Allways 1hp - DonWade - 13.12.2011

Why the hell do you need this lol


Re: Allways 1hp - Sascha - 13.12.2011

Quote:
Originally Posted by TheArcher
Посмотреть сообщение
Phanto is perfectly right. I would to say that 1000ms = 1second 1ms = 0.1 second why it could be checked in 1ms? It doesn't change anything in this case.
if you guys read my post you would know why....



Hint:
"(yes I know, this causes lags and isn't a good way to code, although the standart of the code fits to the standart of the question ; -)"