How do regenerating hp?
#1

Hi i need script that if you type command or what ever you can use it you get regenerating 5 hp for 3 seconds, if time over regenerating is stop.
Reply
#2

This is not the script requesting section, as far as I know.

You can make it yourself, get some errors and come back here asking for help on your errors. If you don't try you will never do it.

These following links can provide you all the help you need

https://sampwiki.blast.hk/wiki/Scripting_Basics
https://sampwiki.blast.hk/wiki/SetTimerEx
https://sampwiki.blast.hk/wiki/Control_Structures
Reply
#3

Ok i tried and this stuff is not working fine. Hes not keep regenerating my health its just give +1hp and its stop. And i can still use regenerating if my hp is over 100 so easily i can bug my hp. Look
Код:
#define REGENTILL 15000 // Time tell when will the REGEN stop
#define REGENSTART 1000 // Time the regeneration will start

new regentimer;
new regen2timer;
new isRegenerating[MAX_PLAYERS];

forward regenerating(playerid);
forward regen2(playerid);

public regenerating(playerid)
{
  new Float:health;
  GetPlayerHealth(playerid, health);
  SetPlayerHealth(playerid, health+1);
  isRegenerating[playerid] = 1;
  regen2timer = SetTimer("regen2",REGENTILL, false);
  return 1;
}

public regen2(playerid)
{
  KillTimer(regentimer);
  KillTimer(regen2timer);
  isRegenerating[playerid] = 0;
}

CMD:test(playerid)
{
 regentimer = SetTimer("regenerating", REGENSTART, false);
 SendClientMessage(playerid,-1,"You are now regenerating HP");
 return 1;
}
Reply
#4

Quote:
Originally Posted by Troydere
Посмотреть сообщение
This is not the script requesting section, as far as I know.

You can make it yourself, get some errors and come back here asking for help on your errors. If you don't try you will never do it.

These following links can provide you all the help you need

https://sampwiki.blast.hk/wiki/Scripting_Basics
https://sampwiki.blast.hk/wiki/SetTimerEx
https://sampwiki.blast.hk/wiki/Control_Structures
https://sampforum.blast.hk/showthread.php?tid=531009
Reply
#5

So how should i fix these problems? "Hes not keep regenerating my health its just give +1hp and its stop. And i can still use regenerating if my hp is over 100 so easily i can bug my hp."
Reply
#6

Do you want to learn or do you want a fully working script to copy and paste in your gamemode?
Reply
#7

Copy and paste.
Reply
#8

Quote:
Originally Posted by Pokemon64
Посмотреть сообщение
Copy and paste.
Gotcha. Sorry, I can't help you.
Reply
#9

How need end timer, i want make it work only for 5seconds if 5 seconds end, timer will killed and hp will not gained bat after couple second passed again i can use it
Код:
forward Regeneration(playerid, timess);
public Regeneration(playerid, timess)
{
		new Float: Health;
		if(GetPlayerHealth(playerid, Health))
		{
			if(100.0 < (Health += 2.0)) SetPlayerHealth(playerid, 100.0);
			else
			{
				SetPlayerHealth(playerid, Health);
				SetTimerEx("Regeneration", 2000, false, "dd", playerid, times - 1);
			}
			return true;
		}
	return false;
}
Reply
#10

Up up up
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)