khalidahmedshalabi/SAMPBulletproof

Changes in code layout

Opened this issue · 0 comments

The current layout is:
gamemodes\bulletproof.pwn - this is for all SA-MP callbacks and global code
pawno\modules\src - this contains libraries implementation code
pawno\modules\header - this has all header files which consists of variables, constants and etc.

What I'd like to change is make each library (in modules\src) independent by the use of y_hook. Hooking callbacks for each library and having bulletproof.pwn almost empty and clean. Tell your opinion!

Little example
Gonna make an anti-minigun script.

This is modules\src\antiminigun.inc

AddMinigunBan(playerid)
{
    BanEx(playerid, "Banned by anti-minigun");
}

hook OnPlayerUpdate(playerid)
{
    if(GetPlayerWeapon(playerid) == WEAPON_MINIGUN)
    {
        AddMinigunBan(playerid);
        return 0;
    }
    return 1;
}

then I simply just add this single line in gamemode\bulletproof.pwn

#include "modules\src\antiminigun.inc"