A question about ALS hooking.
#1

I've been using this server sided weapon giving function for a while and I thought about hooking it.

This is my first time using a hook so I was wondering if this way is correct or not.

PHP код:
// Give weapon function
GivePlayerWeaponEx(playeridweaponidammo)
{
    
g_PlayerData[playerid][p_Weapons][weaponid] = 1;
    
GivePlayerWeapon(playeridweaponidammo);
}
#if defined _ALS_GivePlayerWeapon
    #undef GivePlayerWeapon
#else
    #define _ALS_GivePlayerWeapon
#endif
#define GivePlayerWeapon GivePlayerWeaponEx
// Reset weapon function
ResetPlayerWeaponEx(playerid)
{
    for (new 
047j; ++i)
    {
        
g_PlayerData[playerid][p_Weapons][i] = 0;
    }
    return 
ResetPlayerWeapons(playerid);
}
#if defined _ALS_ResetPlayerWeapons
    #undef ResetPlayerWeapons
#else
    #define _ALS_ResetPlayerWeapons
#endif
#define ResetPlayerWeapons ResetPlayerWeaponEx 
My system auto bans a player upon spawning a weapon. After using this hook, I didn't get a ban so it probably is working. My question here right now is, is the way I have hooked it, is right or not?

Also, can anyone give me more information about ALS hooking? I've read about ALS 4 or something like that somewhere on this forum but I can't seems to find it anymore.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)