Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********************************************
- * OnPlayerTakeDamage(Ex)! V1.1 *
- * Credits: wups *
- ********************************************/
- #include <a_samp>
- #tryinclude <foreach>
- #if !defined foreach
- #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
- #define __SSCANF_FOREACH__
- #endif
- static
- Float:Ex_PHealth[MAX_PLAYERS],
- Float:Ex_Armour[MAX_PLAYERS],
- Ex_Timer;
- forward Ex_SecTimer();
- public Ex_SecTimer()
- {
- foreach(Player, i)
- {
- GetPlayerHealth(i,Ex_PHealth[i]);
- GetPlayerArmour(i,Ex_Armour[i]);
- }
- return 1;
- }
- public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
- {
- new
- Float:Ex_HP,
- Float:Ex_AP,
- Float:Ret_HPLost,
- Float:Ret_APLost;
- GetPlayerHealth(playerid,Ex_HP);
- GetPlayerArmour(playerid,Ex_AP);
- if(Ex_AP != Ex_Armour[playerid]) Ret_APLost = (Ex_Armour[playerid]-Ex_AP);
- if(Ex_HP != Ex_PHealth[playerid]) Ret_HPLost = (Ex_PHealth[playerid]-Ex_HP);
- Ex_PHealth[playerid]=Ex_HP;
- Ex_Armour[playerid]=Ex_AP;
- return CallLocalFunction("Ex_OnPlayerTakeDamage","iiffi",playerid,issuerid,Ret_HPLost,Ret_APLost,weaponid);
- }
- #if defined _ALS_OnPlayerTakeDamage
- #undef OnPlayerTakeDamage
- #else
- #define _ALS_OnPlayerTakeDamage
- #endif
- #define OnPlayerTakeDamage Ex_OnPlayerTakeDamage
- forward Ex_OnPlayerTakeDamage(playerid, issuerid, Float:HealthLost,Float:ArmourLost, weaponid);
- #if !defined FILTERSCRIPT
- // OnGameModeInit
- public OnGameModeInit()
- {
- Ex_Timer = SetTimer("Ex_SecTimer",998,true);
- return (funcidx("Ex_OnGameModeInit") != -1)?CallLocalFunction("Ex_OnGameModeInit",""):1;
- }
- #if defined _ALS_OnGameModeInit
- #undef OnGameModeInit
- #else
- #define _ALS_OnGameModeInit
- #endif
- #define OnGameModeInit Ex_OnGameModeInit
- forward Ex_OnGameModeInit();
- public OnGameModeExit()
- {
- KillTimer(Ex_Timer);
- return (funcidx("Ex_OnGameModeExit") != -1)?CallLocalFunction("Ex_OnGameModeInit",""):1;
- }
- #else
- // OnFilterScriptInit
- public OnFilterScriptInit()
- {
- SetTimer("Ex_SecTimer",998,true);
- return (funcidx("Ex_OnFilterScriptInit") != -1)?CallLocalFunction("Ex_OnFilterScriptInit",""):1;
- }
- #if defined _ALS_OnFilterScriptInit
- #undef OnFilterScriptInit
- #else
- #define _ALS_OnFilterScriptInit
- #endif
- #define OnFilterScriptInit Ex_OnFilterScriptInit
- forward Ex_OnFilterScriptInit();
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement