Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <progress>
- #define HOLDING(%0) \
- ((newkeys & (%0)) == (%0))
- #define RELEASED(%0) \
- (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
- #define COLOR_RED 0xE81717AA
- forward OnPlayerHealing(playerid);
- enum hInfo
- {
- bool:Heal,
- bool:Give,
- bool:Get,
- Float:HPAdded,
- Bar:loading,
- hpl
- };
- new Text:loadt;
- new HealthInfo[MAX_PLAYERS][hInfo];
- stock GivePlayerHealPack(playerid)
- {
- HealthInfo[playerid][Heal] = true;
- HealthInfo[playerid][Get] = true;
- HealthInfo[playerid][Give] = false;
- HealthInfo[playerid][HPAdded] = 0.0;
- SetPlayerAttachedObject(playerid, 1, 1580, 1, 0.0, -0.06, 0.0, 88, 0.0, 0.0);
- TogglePlayerControllable(playerid, true);
- }
- public OnFilterScriptInit()
- {
- print("/Left 4 Dead Healing script by GangSteR], [FD] Clan's healing script!/");
- print("/L4D Healing: ON! /");
- loadt = TextDrawCreate(228,354, "Healing yourself...");
- TextDrawFont(loadt,1);
- TextDrawColor(loadt, 0xFF0303AA);
- TextDrawSetShadow(loadt, 1);
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("L4D Healing: OFF! /");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- HealthInfo[playerid][Heal] = false;
- HealthInfo[playerid][Give] = false;
- HealthInfo[playerid][Get] = false;
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- GivePlayerHealPack(playerid);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(HealthInfo[playerid][Heal] == true)
- {
- HealthInfo[playerid][Heal] = false;
- HealthInfo[playerid][Get] = false;
- HealthInfo[playerid][Give] = false;
- HealthInfo[playerid][HPAdded] = 0.0;
- HideProgressBarForPlayer(playerid, HealthInfo[playerid][loading]);
- TextDrawHideForPlayer(playerid, loadt);
- DestroyProgressBar(HealthInfo[playerid][loading]);
- KillTimer(HealthInfo[playerid][hpl]);
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(strcmp("/Health", cmdtext, true, 10) == 0)
- {
- if(HealthInfo[playerid][Get] == true) return 0;
- GivePlayerHealPack(playerid);
- return 1;
- }
- return 0;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(HOLDING(KEY_FIRE))
- {
- if(GetPlayerWeapon(playerid) == 0)
- {
- HealthInfo[playerid][loading] = CreateProgressBar(226.00, 370.00, 204.0, 14.9, 1687547306, 100.0);
- SetProgressBarColor(HealthInfo[playerid][loading], 0xFF0303AA);
- if(HealthInfo[playerid][Heal] == true)
- {
- new Float:a;
- ClearAnimations(playerid);
- GetPlayerFacingAngle(playerid, a);
- HealthInfo[playerid][Give] = true;
- HealthInfo[playerid][hpl] = SetTimerEx("OnPlayerHealing", 11, 1,"i", playerid);
- ShowProgressBarForPlayer(playerid, HealthInfo[playerid][loading]);
- TextDrawShowForPlayer(playerid, loadt);
- TogglePlayerControllable(playerid, 0);
- SetPlayerFacingAngle(playerid, a+180.0);
- ApplyAnimation(playerid, "MISC", "Idle_Chat_02", 4.1, 0, 1, 1, 1, 1);
- }
- }
- }
- if(RELEASED(KEY_FIRE))
- {
- if(GetPlayerWeapon(playerid) == 0)
- {
- if(HealthInfo[playerid][Heal] == true)
- {
- HealthInfo[playerid][Give] = false;
- HealthInfo[playerid][HPAdded] = 0.0;
- KillTimer(HealthInfo[playerid][hpl]);
- HideProgressBarForPlayer(playerid, HealthInfo[playerid][loading]);
- SetCameraBehindPlayer(playerid);
- TogglePlayerControllable(playerid, true);
- TextDrawHideForPlayer(playerid, loadt);
- ClearAnimations(playerid);
- DestroyProgressBar(HealthInfo[playerid][loading]);
- }
- }
- }
- return 1;
- }
- public OnPlayerHealing(playerid)
- {
- if(HealthInfo[playerid][Heal] == true)
- {
- if(HealthInfo[playerid][Give] == true)
- {
- if(HealthInfo[playerid][HPAdded] < 100.0)
- {
- HealthInfo[playerid][HPAdded] = HealthInfo[playerid][HPAdded]+0.15;
- SetProgressBarValue(HealthInfo[playerid][loading], HealthInfo[playerid][HPAdded]);
- UpdateProgressBar(HealthInfo[playerid][loading], playerid);
- ApplyAnimation(playerid, "MISC", "Idle_Chat_02", 4.1, 0, 1, 1, 1, 1);
- }
- else if(HealthInfo[playerid][HPAdded] > 100.0)
- {
- ClearAnimations(playerid);
- HealthInfo[playerid][HPAdded] = 0.0;
- HealthInfo[playerid][Heal] = false;
- HealthInfo[playerid][Give] = false;
- HealthInfo[playerid][Get] = false;
- HideProgressBarForPlayer(playerid, HealthInfo[playerid][loading]);
- SetCameraBehindPlayer(playerid);
- TextDrawHideForPlayer(playerid, loadt);
- RemovePlayerAttachedObject(playerid, 1);
- TogglePlayerControllable(playerid, true);
- SendClientMessage(playerid, COLOR_RED, "HEAL INFO: {FAF7F8}Charged your health successfully!");
- SetPlayerHealth(playerid, 100.0);
- DestroyProgressBar(HealthInfo[playerid][loading]);
- KillTimer(HealthInfo[playerid][hpl]);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment