19.02.2012, 17:04
Lй Introduction
Ah, seilб foda-se isso.
Lй Utiliser
No topo do GM, DE EXTREMA IMPORTВNCIA:
Sу.
E tem uma callback:
Lй Transfйrer
Apenas 0.3d+ e mantenham os crйditos, crianзas.
Ah, seilб foda-se isso.
Lй Utiliser
No topo do GM, DE EXTREMA IMPORTВNCIA:
pawn Code:
#include <a_samp>
#include <AMINHAINCLUDE>
E tem uma callback:
pawn Code:
forward OnPlayerHealthHacks(playerid, Float:serverhealth, Float:clienthealth, Float:serverarmour, Float:clientarmour);
pawn Code:
#if defined _server_health
#endinput
#else
#define _server_health
#endif
#define lazyfunction%0(%1) forward%0(%1); public%0(%1)
enum _SH_PINFO
{
Float:shPlayerHealth,
Float:shPlayerArmour
}
new _sg_PlayerInfo[MAX_PLAYERS][_SH_PINFO];
forward OnPlayerHealthHacks(playerid, Float:serverhealth, Float:clienthealth, Float:serverarmour, Float:clientarmour);
public OnPlayerSpawn(playerid)
{
_sg_PlayerInfo[playerid][shPlayerHealth] = 100.0;
_sg_PlayerInfo[playerid][shPlayerArmour] = 0.0;
if (funcidx("SH_OnPlayerSpawn") != -1)
{
return CallLocalFunction("SH_OnPlayerSpawn", "i", playerid);
}
return 1;
}
#if defined _ALS_OnPlayerSpawn
#undef OnPlayerSpawn
#else
#define _ALS_OnPlayerSpawn
#endif
#define OnPlayerSpawn SH_OnPlayerSpawn
forward SH_OnPlayerSpawn(playerid);
/* */
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
_sg_PlayerInfo[playerid][shPlayerArmour] -= amount;
if(_sg_PlayerInfo[playerid][shPlayerArmour] < 0)
{
_sg_PlayerInfo[playerid][shPlayerArmour] = 0.0;
_sg_PlayerInfo[playerid][shPlayerHealth] += _sg_PlayerInfo[playerid][shPlayerArmour];
}
SetPlayerHealth(playerid, _sg_PlayerInfo[playerid][shPlayerHealth]);
SetPlayerArmour(playerid, _sg_PlayerInfo[playerid][shPlayerArmour]);
new Float:client_Health; GetPlayerHealth(playerid, client_Health);
new Float:client_Armour; GetPlayerArmour(playerid, client_Armour);
if(_sg_PlayerInfo[playerid][shPlayerHealth] != client_Health || _sg_PlayerInfo[playerid][shPlayerArmour] != client_Armour)
{
if(funcidx("OnPlayerHealthHacks") != -1)
CallRemoteFunction("OnPlayerHealthHacks", "iffff", playerid, _sg_PlayerInfo[playerid][shPlayerHealth], client_Health, _sg_PlayerInfo[playerid][shPlayerArmour], client_Armour);
}
if (funcidx("SH_OnPlayerTakeDamage") != -1)
{
return CallLocalFunction("SH_OnPlayerTakeDamage", "iifi", playerid, issuerid, amount, weaponid);
}
return 1;
}
#if defined _ALS_OnPlayerTakeDamage
#undef OnPlayerTakeDamage
#else
#define _ALS_OnPlayerTakeDamage
#endif
#define OnPlayerTakeDamage SH_OnPlayerTakeDamage
forward SH_OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid);
/* */
lazyfunction SH_GetPlayerHealth(playerid, &Float:health)
{
health = _sg_PlayerInfo[playerid][shPlayerHealth];
return 1;
}
#define GetPlayerHealth SG_GetPlayerHealth
lazyfunction SH_SetPlayerHealth(playerid, Float:health)
{
_sg_PlayerInfo[playerid][shPlayerHealth] = health;
SetPlayerHealth(playerid, health);
return 1;
}
#define SetPlayerHealth SH_SetPlayerHealth
lazyfunction SH_GetPlayerArmour(playerid, &Float:armour)
{
armour = _sg_PlayerInfo[playerid][shPlayerArmour];
return 1;
}
#define GetPlayerArmour SH_GetPlayerArmour
lazyfunction SG_SetPlayerArmour(playerid, Float:armour)
{
_sg_PlayerInfo[playerid][shPlayerArmour] = armour;
SetPlayerArmour(playerid, armour);
return 1;
}
#define SetPlayerArmour SH_SetPlayerArmour
Apenas 0.3d+ e mantenham os crйditos, crianзas.