25.09.2013, 17:13
Hola a todos, como bien sabran algunos quiero saber para que sirve hacerle un gancho (hook) a una funciуn.
E_PLAYER_DATA
{
//...
Float:health,
//...
}
new pData[MAX_PLAYERS][E_PLAYER_DATA]
stock custom_SetPlayerHealth(playerid, Float:health)
{
pData[playerid][health] = health;
SetPlayerHealth(playerid, health);
}
#if defined SetPlayerHealth
#undef SetPlayerHealth
#endif
#define SetPlayerHealth custom_SetPlayerHealth
#if defined SetPlayerHealth
#undef SetPlayerHealth
#endif
#include <a_samp>
enum E_PLAYER_DATA
{
//...
Float:pHealth,
//...
}
new pData[MAX_PLAYERS][E_PLAYER_DATA];
stock custom_SetPlayerHealth(playerid, Float:health)
{
pData[playerid][pHealth] = health;
SetPlayerHealth(playerid, health);
}
#if defined ALS_SetPlayerHealth
#undef ALS_SetPlayerHealth
#endif
#define SetPlayerHealth custom_SetPlayerHealth
#define ALS_SetPlayerHealth
public OnPlayerSpawn(playerid)
{
SetPlayerHealth(playerid, 100);
return 0;
}