10.03.2017, 09:43
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.
#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; }
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 |
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; }