Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <foreach>
- static ac_hp_timer = 0;
- public OnPlayerConnect(playerid)
- {
- SetPVarFloat(playerid, "ac_hp", 100.0);
- SetPVarFloat(playerid, "ac_armour", 0.0);
- #if defined achp_OnPlayerConnect
- achp_OnPlayerConnect(playerid);
- #endif
- return 1;
- }
- #if defined _ALS_OnPlayerConnect
- #undef OnPlayerConnect
- #else
- #define _ALS_OnPlayerConnect
- #endif
- #define OnPlayerConnect achp_OnPlayerConnect
- #if defined achp_OnPlayerConnect
- forward achp_OnPlayerConnect(playerid);
- #endif
- public OnPlayerSpawn(playerid)
- {
- SetPVarFloat(playerid, "ac_hp", 100.0);
- SetPVarFloat(playerid, "ac_armour", 0.0);
- #if defined achp_OnPlayerSpawn
- achp_OnPlayerSpawn(playerid);
- #endif
- return 1;
- }
- #if defined _ALS_OnPlayerSpawn
- #undef OnPlayerSpawn
- #else
- #define _ALS_OnPlayerSpawn
- #endif
- #define OnPlayerSpawn achp_OnPlayerSpawn
- #if defined achp_OnPlayerSpawn
- forward achp_OnPlayerSpawn(playerid);
- #endif
- public OnPlayerDeath(playerid, killerid, reason)
- {
- SetPVarFloat(playerid, "ac_hp", 100.0);
- SetPVarFloat(playerid, "ac_armour", 0.0);
- #if defined achp_OnPlayerDeath
- achp_OnPlayerDeath(playerid, killerid, reason);
- #endif
- return 1;
- }
- #if defined _ALS_OnPlayerDeath
- #undef OnPlayerDeath
- #else
- #define _ALS_OnPlayerDeath
- #endif
- #define OnPlayerDeath achp_OnPlayerDeath
- #if defined achp_OnPlayerDeath
- forward achp_OnPlayerDeath(playerid, killerid, reason);
- #endif
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- new Float:hp, Float:armour;
- ac_hp_timer = SetTimer("AC_HP", 100, true);
- foreach(new i : Player)
- {
- GetPlayerHealth(i, hp);
- GetPlayerArmour(i, armour);
- SetPVarFloat(i, "ac_hp", hp);
- SetPVarFloat(i, "ac_armour", armour);
- }
- #if defined achp_OnFilterScriptInit
- achp_OnFilterScriptInit();
- #endif
- return 1;
- }
- #if defined _ALS_OnFilterScriptInit
- #undef OnFilterScriptInit
- #else
- #define _ALS_OnFilterScriptInit
- #endif
- #define OnFilterScriptInit achp_OnFilterScriptInit
- #if defined achp_OnFilterScriptInit
- forward achp_OnFilterScriptInit();
- #endif
- public OnFilterScriptExit()
- {
- KillTimer(ac_hp_timer);
- #if defined achp_OnFilterScriptExit
- achp_OnFilterScriptExit();
- #endif
- return 1;
- }
- #if defined _ALS_OnFilterScriptExit
- #undef OnFilterScriptExit
- #else
- #define _ALS_OnFilterScriptExit
- #endif
- #define OnFilterScriptExit achp_OnFilterScriptExit
- #if defined achp_OnFilterScriptExit
- forward achp_OnFilterScriptExit();
- #endif
- #else
- public OnGameModeInit()
- {
- new Float:hp, Float:armour;
- ac_hp_timer = SetTimer("AC_HP", 100, true);
- foreach(new i : Player)
- {
- GetPlayerHealth(i, hp);
- GetPlayerArmour(i, armour);
- SetPVarFloat(i, "ac_hp", hp);
- SetPVarFloat(i, "ac_armour", armour);
- }
- #if defined achp_OnGameModeInit
- achp_OnGameModeInit();
- #endif
- return 1;
- }
- #if defined _ALS_OnGameModeInit
- #undef OnGameModeInit
- #else
- #define _ALS_OnGameModeInit
- #endif
- #define OnGameModeInit achp_OnGameModeInit
- #if defined achp_OnGameModeInit
- forward achp_OnGameModeInit();
- #endif
- public OnGameModeExit()
- {
- KillTimer(ac_hp_timer);
- #if defined achp_OnGameModeExit
- achp_OnGameModeExit();
- #endif
- return 1;
- }
- #if defined _ALS_OnGameModeExit
- #undef OnGameModeExit
- #else
- #define _ALS_OnGameModeExit
- #endif
- #define OnGameModeExit achp_OnGameModeExit
- #if defined achp_OnGameModeExit
- forward achp_OnGameModeExit();
- #endif
- #endif
- stock SetPlayerHealthEx(playerid, Float:health)
- {
- SetPVarFloat(playerid, "ac_hp", health);
- SetPlayerHealth(playerid, health);
- return 1;
- }
- stock SetPlayerArmourEx(playerid, Float:armour)
- {
- SetPVarFloat(playerid, "ac_armour", armour);
- SetPlayerArmour(playerid, armour);
- return 1;
- }
- stock GetPlayerHealthEx(playerid, &Float:health)
- {
- health = GetPVarFloat(playerid, "ac_hp");
- return 1;
- }
- stock GetPlayerArmourEx(playerid, &Float:armour)
- {
- armour = GetPVarFloat(playerid, "ac_armour");
- return 1;
- }
- forward AC_HP();
- public AC_HP()
- {
- new Float:hp, Float:armour;
- foreach(new i : Player)
- {
- GetPlayerHealth(i, hp);
- GetPlayerArmour(i, armour);
- if(hp != GetPVarFloat(i, "ac_hp"))
- {
- SetPlayerHealth(i, GetPVarFloat(i, "ac_hp"));
- }
- if(armour != GetPVarFloat(i, "ac_armour"))
- {
- SetPlayerArmour(i, GetPVarFloat(i, "ac_armour"));
- }
- }
- return 1;
- }
- #if defined AC_HPAR_OPTD
- public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
- {
- new Float:hp, Float:armour;
- GetPlayerArmour(playerid, armour);
- GetPlayerHealth(playerid, hp);
- if(weaponid > 51)
- {
- SetPVarFloat(playerid, "ac_hp", GetPVarFloat(playerid, "ac_hp")-amount);
- }
- else
- {
- if(armour > 0.0)
- {
- if(armour >= amount)
- {
- SetPVarFloat(playerid, "ac_armour", GetPVarFloat(playerid, "ac_armour")-floatabs(amount));
- }
- else
- {
- amount = amount-GetPVarFloat(playerid, "ac_armour");
- SetPVarFloat(playerid, "ac_hp", GetPVarFloat(playerid, "ac_hp")-floatabs(amount));
- }
- }
- else
- {
- SetPVarFloat(playerid, "ac_hp", GetPVarFloat(playerid, "ac_hp")-floatabs(amount));
- }
- }
- #if defined achp_OnPlayerTakeDamage
- achp_OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart);
- #endif
- return 0;
- }
- #if defined _ALS_OnPlayerTakeDamage
- #undef OnPlayerTakeDamage
- #else
- #define _ALS_OnPlayerTakeDamage
- #endif
- #define OnPlayerTakeDamage achp_OnPlayerTakeDamage
- #if defined achp_OnPlayerTakeDamage
- forward achp_OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart);
- #endif
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement