SA-MP Forums Archive
[FilterScript] Simple Regenerating System | Editable - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Simple Regenerating System | Editable (/showthread.php?tid=531009)



Simple Regenerating System | Editable - ZombieNest - 10.08.2014

Hello guys, Today I will release one Regenerating System by me, It is good for Freeroam/DM servers
Well Commands(There are only 2 ):
Code:
/forcestopregen - If something went wrong, It will reset the timers and the isRegenerating value to 0
/regen - Will start the regeneration timers, If the player is already regenerating it will return with error message
Well I cant give any screenshot due to my GTA SA is deleted, It had virus in it so I am reinstalling, I had tested it long ago some time and now I edited it today, You can edit the hp regen timer and stop timer from the defines I have explained it in the script
Here is the code:
Code:
#include <a_samp>
#include <zcmd>
// Number of Time the HP will Regen If you want to set it to other like 60, It has one 0 so do 60(000), Add three 0 at back
// If it is up to 100 use like 250(000), 150 then 000, No SPACE!
#define REGENTILL 100000 // Time in Miliseconds to tell when will the REGEN stop, 100 seconds is default, 100 Seconds = 100 hp +
#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);
  PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  isRegenerating[playerid] = 1;
  regen2timer = SetTimer("regen2",REGENTILL, false);
  return 1;
}

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

CMD:forcestopregen(playerid)
{
 KillTimer(regentimer);
 KillTimer(regen2timer);
 isRegenerating[playerid] = 0;
 return 1;
}

CMD:regen(playerid)
{
 if(isRegenerating[playerid] = 1) return SendClientMessage(playerid,-1,"You are already regenerating");
 regentimer = SetTimer("regenerating", REGENSTART, false);
 SendClientMessage(playerid,-1,"You are now regenerating HP");
 return 1;
}
No pastebin cause it is blocked by my country
Feel free to add mirrors, You can edit this script but you are not allowed to remove credits unless permitted by me.