Coding Pawn Framework
#1

Hi,
I searching for ppl coding in pawn to help with creating pawn framework / modules / custom callbacks.
I am advanced / professional coder and i require of code purity.

Why I cant use other gamemodes?

- Hard to find something in the code.
- Too many bugs.
- Inefficient code.

What I need?

- Useful modules
- Useful custom callbacks
- Security fixes
- Anticheats

Why?

Couse SA:MP needs to have own pawn framework so that you can to create your own gamemode very quickly.

Framework.pwn:

Code:
////////////////////////////////////////////////////////////////////////////////
// Includes
////////////////////////////////////////////////////////////////////////////////

#include                <a_samp>
#include                <a_sampdb>
#include                <a_players>
#include                <a_vehicles>
#include                <a_objects>
#include                <a_mysql>
#include                <a_http>

// -----------------------------------------------------------------------------

#include                <colors>
#include                <sscanf>

////////////////////////////////////////////////////////////////////////////////
// Modules
////////////////////////////////////////////////////////////////////////////////

//#include              <module1>
//#include              <module2>
//#include              <module3>
//#include              <module4>

////////////////////////////////////////////////////////////////////////////////
// Definitions
////////////////////////////////////////////////////////////////////////////////

#define CMD:%1(%2)      forward cmd_%1(%2);    public cmd_%1(%2)

////////////////////////////////////////////////////////////////////////////////
// AntiDeAmx
////////////////////////////////////////////////////////////////////////////////

WasteDeAMXersTime()
{
    ////////////////////////////////////////////////////////////////////////////
    // First Security
    ////////////////////////////////////////////////////////////////////////////
    new a[][] =
    {
        "Unarmed (Fist)",
        "Brass K"
    };
    #pragma unused a

    ////////////////////////////////////////////////////////////////////////////
    // Second Security
    ////////////////////////////////////////////////////////////////////////////
    new b;
    #emit load.pri b
    #emit stor.pri b
}

////////////////////////////////////////////////////////////////////////////////
// Player Varibles
////////////////////////////////////////////////////////////////////////////////

enum Player_Variables
{
	////////////////////////////////////////////////////////////////////////////
	// The basic parameters of the player
	////////////////////////////////////////////////////////////////////////////
	Float:Health,
	Float:Armour,
	Weapon,
}

new Player[MAX_PLAYERS][Player_Variables];

////////////////////////////////////////////////////////////////////////////////
// Callbacks
////////////////////////////////////////////////////////////////////////////////

public OnGameModeInit()
{
    ////////////////////////////////////////////////////////////////////////////
    // AntiDeAmx
    ////////////////////////////////////////////////////////////////////////////
    WasteDeAMXersTime();

    ////////////////////////////////////////////////////////////////////////////
    // Set the name of the game mode, which appears in the list of servers.
    ////////////////////////////////////////////////////////////////////////////
    SetGameModeText("Gamemode");

    ////////////////////////////////////////////////////////////////////////////
    // Set the gravity for all players.
    ////////////////////////////////////////////////////////////////////////////
    SetGravity(0.008);

    ////////////////////////////////////////////////////////////////////////////
    // Toggle whether the usage of weapons in interiors is allowed or not.
    ////////////////////////////////////////////////////////////////////////////
    AllowInteriorWeapons(1);

    ////////////////////////////////////////////////////////////////////////////
    // Disable all interiors entrances/exits in the game ( with yellow arrows).
    ////////////////////////////////////////////////////////////////////////////
    DisableInteriorEnterExits();

    ////////////////////////////////////////////////////////////////////////////
    // Enables or disables stunt bonuses for all players.
    ////////////////////////////////////////////////////////////////////////////
    EnableStuntBonusForAll(0);

    ////////////////////////////////////////////////////////////////////////////
    // Uses standard player walking animation (animation of CJ).
    ////////////////////////////////////////////////////////////////////////////
    UsePlayerPedAnims();

    ////////////////////////////////////////////////////////////////////////////
    // Modules load ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnGameModeExit()
{
    ////////////////////////////////////////////////////////////////////////////
    // Modules unload ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerConnect(playerid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Modules on player connect ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerDisconnect(playerid, reason)
{
    ////////////////////////////////////////////////////////////////////////////
    // Modules on player disconnect ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerSpawn(playerid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player spawn ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerDeath(playerid, killerid, reason)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Player Death Message
    ////////////////////////////////////////////////////////////////////////////
    SendDeathMessage(killerid, playerid, reason);

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player death ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnVehicleSpawn(vehicleid)
{
	////////////////////////////////////////////////////////////////////////////
	// Security
	////////////////////////////////////////////////////////////////////////////
	if(vehicleid == INVALID_VEHICLE_ID)
	{
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
	}

    ////////////////////////////////////////////////////////////////////////////
    // Modules on vehicle spawn ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnVehicleDeath(vehicleid, killerid)
{
	////////////////////////////////////////////////////////////////////////////
	// Security
	////////////////////////////////////////////////////////////////////////////
	if(vehicleid == INVALID_VEHICLE_ID)
	{
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
	}

    ////////////////////////////////////////////////////////////////////////////
    // Modules on vehicle destroy ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerText(playerid, text[])
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player message ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerCommandText(playerid, cmdtext[])
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Commands Variables
    ////////////////////////////////////////////////////////////////////////////
    new cmd[256], params[256], cmdname[256];

    ////////////////////////////////////////////////////////////////////////////
    // Scan for values
    ////////////////////////////////////////////////////////////////////////////
    sscanf(cmdtext, "ss", cmd, params);

    ////////////////////////////////////////////////////////////////////////////
    // Command name
    ////////////////////////////////////////////////////////////////////////////
    format(cmdname, sizeof(cmdname), "cmd_%s", cmd[1]);

    ////////////////////////////////////////////////////////////////////////////
    // Commands pre processor
    ////////////////////////////////////////////////////////////////////////////
    if(funcidx(cmdname) > -1)
    {
        ////////////////////////////////////////////////////////////////////////
        // Fix: empty params crashing server
        ////////////////////////////////////////////////////////////////////////
        if (!params[0])
        {
            ////////////////////////////////////////////////////////////////////
            // Set new params value
            ////////////////////////////////////////////////////////////////////
            params = "\1";
        }

        ////////////////////////////////////////////////////////////////////////
        // Execute command with params and returning what their returned...
        ////////////////////////////////////////////////////////////////////////
        return CallLocalFunction(cmdname, "is", playerid, params);
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player command ...
    ////////////////////////////////////////////////////////////////////////////
    return 0;
}

// -----------------------------------------------------------------------------

public OnPlayerRequestClass(playerid, classid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player requesting class ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }
	else if(vehicleid == INVALID_VEHICLE_ID)
	{
        ////////////////////////////////////////////////////////////////////////
        // Possible bug / lost
        ////////////////////////////////////////////////////////////////////////
        return 0;
	}

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player enter vehicle ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerExitVehicle(playerid, vehicleid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }
   	else if(vehicleid == INVALID_VEHICLE_ID)
	{
        ////////////////////////////////////////////////////////////////////////
        // Possible bug / lost
        ////////////////////////////////////////////////////////////////////////
        return 0;
	}
    ////////////////////////////////////////////////////////////////////////////
    // Modules on player exit vehicle ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }
    else if(newstate == oldstate)
    {
        ////////////////////////////////////////////////////////////////////////
        // Possible bug / lost
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player state change ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerEnterCheckpoint(playerid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player enter checkpoint ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerLeaveCheckpoint(playerid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player leave checkpoint ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerEnterRaceCheckpoint(playerid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player enter race checkpoint ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player leave race checkpoint ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnRconCommand(cmd[])
{
    ////////////////////////////////////////////////////////////////////////////
    // Modules on rcon command ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnRconLoginAttempt( ip[], password[], success )
{
    ////////////////////////////////////////////////////////////////////////////
    // Modules on rcon login attempt ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerRequestSpawn(playerid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player request spawn ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnObjectMoved(objectid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Modules on object moved ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerObjectMoved(playerid, objectid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player object moved ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerPickUpPickup(playerid, pickupid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player pick up pickup ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnVehicleMod(playerid, vehicleid, componentid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Anti cheat
    ////////////////////////////////////////////////////////////////////////////
    if(GetPlayerInterior(playerid) < 1 && GetPlayerInterior(playerid) > 3)
    {
        ////////////////////////////////////////////////////////////////////////
        // Variables
        ////////////////////////////////////////////////////////////////////////
        new name[MAX_PLAYER_NAME+1];

        ////////////////////////////////////////////////////////////////////////
        // Getting informations
        ////////////////////////////////////////////////////////////////////////
        GetPlayerName(playerid, name, sizeof(name));

        ////////////////////////////////////////////////////////////////////////
        // Print to logs
        ////////////////////////////////////////////////////////////////////////
        printf("[OnVehicleMod] %s - Possible tuning hacking.", name);

        ////////////////////////////////////////////////////////////////////////
        // Return 0 to desync the mod.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player vehicle mod ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnEnterExitModShop(playerid, enterexit, interiorid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player enter or exit mod shop ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }
    else if(vehicleid == INVALID_VEHICLE_ID)
	{
        ////////////////////////////////////////////////////////////////////////
        // Possible bug / lost
        ////////////////////////////////////////////////////////////////////////
        return 0;
	}

    ////////////////////////////////////////////////////////////////////////////
    // Anti cheat
    ////////////////////////////////////////////////////////////////////////////
    if(GetPlayerInterior(playerid) < 1 && GetPlayerInterior(playerid) > 3)
    {
        ////////////////////////////////////////////////////////////////////////
        // Variables
        ////////////////////////////////////////////////////////////////////////
        new name[MAX_PLAYER_NAME+1];

        ////////////////////////////////////////////////////////////////////////
        // Getting informations
        ////////////////////////////////////////////////////////////////////////
        GetPlayerName(playerid, name, sizeof(name));

        ////////////////////////////////////////////////////////////////////////
        // Print to logs
        ////////////////////////////////////////////////////////////////////////
        printf("[OnVehicleMod] %s - Possible paint job hacking.", name);

        ////////////////////////////////////////////////////////////////////////
        // Return 0 to desync the mod.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player vehicle paint job ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }
    else if(vehicleid == INVALID_VEHICLE_ID)
	{
        ////////////////////////////////////////////////////////////////////////
        // Possible bug / lost
        ////////////////////////////////////////////////////////////////////////
        return 0;
	}

    ////////////////////////////////////////////////////////////////////////////
    // Anti cheat
    ////////////////////////////////////////////////////////////////////////////
    if(GetPlayerInterior(playerid) < 1 && GetPlayerInterior(playerid) > 3)
    {
        ////////////////////////////////////////////////////////////////////////
        // Variables
        ////////////////////////////////////////////////////////////////////////
        new name[MAX_PLAYER_NAME+1];

        ////////////////////////////////////////////////////////////////////////
        // Getting informations
        ////////////////////////////////////////////////////////////////////////
        GetPlayerName(playerid, name, sizeof(name));

        ////////////////////////////////////////////////////////////////////////
        // Print to logs
        ////////////////////////////////////////////////////////////////////////
        printf("[OnVehicleMod] %s - Possible respray hacking.", name);

        ////////////////////////////////////////////////////////////////////////
        // Return 0 to desync the mod.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player vehicle respray ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }
	else if(vehicleid == INVALID_VEHICLE_ID)
	{
        ////////////////////////////////////////////////////////////////////////
        // Possible bug / lost
        ////////////////////////////////////////////////////////////////////////
        return 0;
	}

    ////////////////////////////////////////////////////////////////////////////
    // Modules on vehicle damage status update ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }
	else if(vehicleid == INVALID_VEHICLE_ID)
	{
        ////////////////////////////////////////////////////////////////////////
        // Possible bug / lost
        ////////////////////////////////////////////////////////////////////////
        return 0;
	}

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player reports unoccupied vehicle update ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerSelectedMenuRow(playerid, row)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player select menu row ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerExitedMenu(playerid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player exits a menu ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }
    else if(newinteriorid == oldinteriorid)
    {
        ////////////////////////////////////////////////////////////////////////
        // Possible bug / lost
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player changes interior ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Blocks gamemode and filterscripts from seeing pressed keys.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }
    else if(newkeys == oldkeys)
    {
        ////////////////////////////////////////////////////////////////////////
        // Possible bug / lost
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player state of any key except the movement keys ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerUpdate(playerid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Update from this player will not be replicated to other clients.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Player Variables
    ////////////////////////////////////////////////////////////////////////////
    new PlayerName[256];
	new Float:PlayerHealth;
	new Float:PlayerArmour;
	new PlayerSpecialAction;
	new CurrentPlayerWeapon;

    ////////////////////////////////////////////////////////////////////////////
    // Gets Player Name
    ////////////////////////////////////////////////////////////////////////////
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));

    ////////////////////////////////////////////////////////////////////////////
    // Gets Player Health
    ////////////////////////////////////////////////////////////////////////////
    GetPlayerHealth(playerid,PlayerHealth);

    ////////////////////////////////////////////////////////////////////////////
    // Gets Player Armour
    ////////////////////////////////////////////////////////////////////////////
    GetPlayerArmour(playerid,PlayerArmour);

    ////////////////////////////////////////////////////////////////////////////
    // Gets Player Special Action
    ////////////////////////////////////////////////////////////////////////////
    PlayerSpecialAction = GetPlayerSpecialAction(playerid);
    
    ////////////////////////////////////////////////////////////////////////////
    // Gets Current Player Weapon
    ////////////////////////////////////////////////////////////////////////////
    CurrentPlayerWeapon = GetPlayerWeapon(playerid);

    ////////////////////////////////////////////////////////////////////////////
    // Anti cheat
    ////////////////////////////////////////////////////////////////////////////
    switch (PlayerSpecialAction)
    {
        ////////////////////////////////////////////////////////////////////////
        // When player using jetpack
        ////////////////////////////////////////////////////////////////////////
		case SPECIAL_ACTION_USEJETPACK:
		{
	        ////////////////////////////////////////////////////////////////////
	        // Kick player
	        ////////////////////////////////////////////////////////////////////
	        Kick(playerid);

	        ////////////////////////////////////////////////////////////////////
	        // Outputs a formatted string on the console
	        ////////////////////////////////////////////////////////////////////
	        printf("[OnPlayerUpdate] %s - Jetpack kick.", PlayerName);

	        ////////////////////////////////////////////////////////////////////
	        // Update from this player will not be replicated to other clients.
	        ////////////////////////////////////////////////////////////////////
	        return 0;
		}
    }
    switch (CurrentPlayerWeapon)
    {
		////////////////////////////////////////////////////////////////////////
		// When player using rocket launcher
		////////////////////////////////////////////////////////////////////////
		case WEAPON_ROCKETLAUNCHER:
		{
	        ////////////////////////////////////////////////////////////////////
	        // Kick player
	        ////////////////////////////////////////////////////////////////////
	        Kick(playerid);

	        ////////////////////////////////////////////////////////////////////
	        // Outputs a formatted string on the console
	        ////////////////////////////////////////////////////////////////////
	        printf("[OnPlayerUpdate] %s - Rocket launcher kick.", PlayerName);

	        ////////////////////////////////////////////////////////////////////
	        // Update from this player will not be replicated to other clients.
	        ////////////////////////////////////////////////////////////////////
	        return 0;
		}
		
		////////////////////////////////////////////////////////////////////////
		// When player using heat seeker
		////////////////////////////////////////////////////////////////////////
		case WEAPON_HEATSEEKER:
		{
	        ////////////////////////////////////////////////////////////////////
	        // Kick player
	        ////////////////////////////////////////////////////////////////////
	        Kick(playerid);

	        ////////////////////////////////////////////////////////////////////
	        // Outputs a formatted string on the console
	        ////////////////////////////////////////////////////////////////////
	        printf("[OnPlayerUpdate] %s - Heat seeker kick.", PlayerName);

	        ////////////////////////////////////////////////////////////////////
	        // Update from this player will not be replicated to other clients.
	        ////////////////////////////////////////////////////////////////////
	        return 0;
		}
		
		////////////////////////////////////////////////////////////////////////
		// When player using flame thrower
		////////////////////////////////////////////////////////////////////////
		case WEAPON_FLAMETHROWER:
		{
	        ////////////////////////////////////////////////////////////////////
	        // Kick player
	        ////////////////////////////////////////////////////////////////////
	        Kick(playerid);
	        
	        ////////////////////////////////////////////////////////////////////
	        // Outputs a formatted string on the console
	        ////////////////////////////////////////////////////////////////////
	        printf("[OnPlayerUpdate] %s - Flame thrower kick.", PlayerName);

	        ////////////////////////////////////////////////////////////////////
	        // Update from this player will not be replicated to other clients.
	        ////////////////////////////////////////////////////////////////////
	        return 0;
		}
		
		////////////////////////////////////////////////////////////////////////
		// When player using minigun
		////////////////////////////////////////////////////////////////////////
		case WEAPON_MINIGUN:
		{
	        ////////////////////////////////////////////////////////////////////
	        // Kick player
	        ////////////////////////////////////////////////////////////////////
	        Kick(playerid);

	        ////////////////////////////////////////////////////////////////////
	        // Outputs a formatted string on the console
	        ////////////////////////////////////////////////////////////////////
	        printf("[OnPlayerUpdate] %s - Minigun kick.", PlayerName);

	        ////////////////////////////////////////////////////////////////////
	        // Update from this player will not be replicated to other clients.
	        ////////////////////////////////////////////////////////////////////
	        return 0;
		}
    }
    
    ////////////////////////////////////////////////////////////////////////////
    // Compare health values
    ////////////////////////////////////////////////////////////////////////////
    if(PlayerHealth != Player[playerid][Health])
    {
        ////////////////////////////////////////////////////////////////////////
        // Execute custom callback
        ////////////////////////////////////////////////////////////////////////
        OnPlayerHealthChange(playerid,PlayerHealth);
    }

    ////////////////////////////////////////////////////////////////////////////
    // Compare armour values
    ////////////////////////////////////////////////////////////////////////////
    if(PlayerArmour != Player[playerid][Armour])
    {
        ////////////////////////////////////////////////////////////////////////
        // Execute custom callback
        ////////////////////////////////////////////////////////////////////////
        OnPlayerArmourChange(playerid,PlayerArmour);
    }

    ////////////////////////////////////////////////////////////////////////////
    // Compare weapon values
    ////////////////////////////////////////////////////////////////////////////
    if(CurrentPlayerWeapon != Player[playerid][Weapon])
    {
        ////////////////////////////////////////////////////////////////////////
        // Execute custom callback
        ////////////////////////////////////////////////////////////////////////
        OnPlayerWeaponChange(playerid,CurrentPlayerWeapon);
    }


    ////////////////////////////////////////////////////////////////////////////
    // Modules on player update ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerStreamIn(playerid, forplayerid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid) || !IsPlayerConnected(forplayerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player is streamed by other player ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerStreamOut(playerid, forplayerid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid) || !IsPlayerConnected(forplayerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player is streamed out by other player ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnVehicleStreamIn(vehicleid, forplayerid)
{
	////////////////////////////////////////////////////////////////////////////
	// Security
	////////////////////////////////////////////////////////////////////////////
	if(vehicleid == INVALID_VEHICLE_ID)
	{
        ////////////////////////////////////////////////////////////////////////
        // Possible bug / lost
        ////////////////////////////////////////////////////////////////////////
        return 0;
	}

    ////////////////////////////////////////////////////////////////////////////
    // Modules on vehicle is streamed by other player ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	////////////////////////////////////////////////////////////////////////////
	// Security
	////////////////////////////////////////////////////////////////////////////
	if(vehicleid == INVALID_VEHICLE_ID)
	{
        ////////////////////////////////////////////////////////////////////////
        // Possible bug / lost
        ////////////////////////////////////////////////////////////////////////
        return 0;
	}

    ////////////////////////////////////////////////////////////////////////////
    // Modules on vehicle is streamed out by other player ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player responds to a dialog ...
    ////////////////////////////////////////////////////////////////////////////
    return 0;
}

// -----------------------------------------------------------------------------

public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid) || !IsPlayerConnected(damagedid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player gives damage to another player ...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player takes damage...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player click map...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

// -----------------------------------------------------------------------------

public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player click textdraw...
    ////////////////////////////////////////////////////////////////////////////
    return 0;
}

// -----------------------------------------------------------------------------

public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
    ////////////////////////////////////////////////////////////////////////////
    // Security
    ////////////////////////////////////////////////////////////////////////////
    if(!IsPlayerConnected(playerid))
    {
        ////////////////////////////////////////////////////////////////////////
        // Game mode cant handle this.
        ////////////////////////////////////////////////////////////////////////
        return 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Modules on player click player textdraw...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}

////////////////////////////////////////////////////////////////////////////////
// Custom Callbacks
////////////////////////////////////////////////////////////////////////////////

stock OnPlayerHealthChange(playerid, Float:newhealth)
{
	////////////////////////////////////////////////////////////////////////////
	// Something...
	////////////////////////////////////////////////////////////////////////////

    ////////////////////////////////////////////////////////////////////////////
    // Set old health value = new health value ...
    ////////////////////////////////////////////////////////////////////////////
    Player[playerid][Health] = newhealth;
}

stock OnPlayerArmourChange(playerid, Float:newarmour)
{
	////////////////////////////////////////////////////////////////////////////
	// Something...
	////////////////////////////////////////////////////////////////////////////

    ////////////////////////////////////////////////////////////////////////////
    // Set old health value = new health value ...
    ////////////////////////////////////////////////////////////////////////////
    Player[playerid][Armour] = newarmour;
}

stock OnPlayerWeaponChange(playerid, newgun)
{
	////////////////////////////////////////////////////////////////////////////
	// Something...
	////////////////////////////////////////////////////////////////////////////

    ////////////////////////////////////////////////////////////////////////////
    // Set old health value = new health value ...
    ////////////////////////////////////////////////////////////////////////////
    Player[playerid][Weapon] = newgun;
}

////////////////////////////////////////////////////////////////////////////////
// Commands
////////////////////////////////////////////////////////////////////////////////

CMD:help(playerid, params[])
{
    //////////////////////////////////////////////////////////////////////////
    // This is example
    //////////////////////////////////////////////////////////////////////////
    SendClientMessage(playerid, 0xFFFFFFFF, "This is help message!");
    return 1;
}

////////////////////////////////////////////////////////////////////////////////
// Main Function
////////////////////////////////////////////////////////////////////////////////

main()
{
    ////////////////////////////////////////////////////////////////////////////
    // Modules timers...
    ////////////////////////////////////////////////////////////////////////////
    return 1;
}
Used includes

colors.inc

pawn Code:
/*--------------------------------------------------
Script Name: Colors.inc
Created for: Samp Forum
Edit by: Oxside
--------------------------------------------------*/

#define COLOR_ACTIVEBORDER 0xB4B4B4FF
#define COLOR_ACTIVECAPTION 0x99B4D1FF
#define COLOR_ACTIVECAPTIONTEXT 0x000000FF
#define COLOR_APPWORKSPACE 0xABABABFF
#define COLOR_CONTROL 0xF0F0F0FF
#define COLOR_CONTROLDARK 0xA0A0A0FF
#define COLOR_CONTROLDARKDARK 0x696969FF
#define COLOR_CONTROLLIGHT 0xE3E3E3FF
#define COLOR_CONTROLLIGHTLIGHT 0xFFFFFFFF
#define COLOR_CONTROLTEXT 0x000000FF
#define COLOR_DESKTOP 0x000000FF
#define COLOR_GRAYTEXT 0x808080FF
#define COLOR_HIGHLIGHT 0x3399FFFF
#define COLOR_HIGHLIGHTTEXT 0xFFFFFFFF
#define COLOR_HOTTRACK 0x0066CCFF
#define COLOR_INACTIVEBORDER 0xF4F7FCFF
#define COLOR_INACTIVECAPTION 0xBFCDDBFF
#define COLOR_INACTIVECAPTIONTEXT 0x434E54FF
#define COLOR_INFO 0xFFFFE1FF
#define COLOR_INFOTEXT 0x000000FF
#define COLOR_MENU 0xF0F0F0FF
#define COLOR_MENUTEXT 0x000000FF
#define COLOR_SCROLLBAR 0xC8C8C8FF
#define COLOR_WINDOW 0xFFFFFFFF
#define COLOR_WINDOWFRAME 0x646464FF
#define COLOR_WINDOWTEXT 0x000000FF
#define COLOR_TRANSPARENT 0xFFFFFF00
#define COLOR_ALICEBLUE 0xF0F8FFFF
#define COLOR_ANTIQUEWHITE 0xFAEBD7FF
#define COLOR_AQUA 0x00FFFFFF
#define COLOR_AQUAMARINE 0x7FFFD4FF
#define COLOR_AZURE 0xF0FFFFFF
#define COLOR_BEIGE 0xF5F5DCFF
#define COLOR_BISQUE 0xFFE4C4FF
#define COLOR_BLACK 0x000000FF
#define COLOR_BLANCHEDALMOND 0xFFEBCDFF
#define COLOR_BLUE 0x0000FFFF
#define COLOR_BLUEVIOLET 0x8A2BE2FF
#define COLOR_BROWN 0xA52A2AFF
#define COLOR_BURLYWOOD 0xDEB887FF
#define COLOR_CADETBLUE 0x5F9EA0FF
#define COLOR_CHARTREUSE 0x7FFF00FF
#define COLOR_CHOCOLATE 0xD2691EFF
#define COLOR_CORAL 0xFF7F50FF
#define COLOR_CORNFLOWERBLUE 0x6495EDFF
#define COLOR_CORNSILK 0xFFF8DCFF
#define COLOR_CRIMSON 0xDC143CFF
#define COLOR_CYAN 0x00FFFFFF
#define COLOR_DARKBLUE 0x00008BFF
#define COLOR_DARKCYAN 0x008B8BFF
#define COLOR_DARKGOLDENROD 0xB8860BFF
#define COLOR_DARKGRAY 0xA9A9A9FF
#define COLOR_DARKGREEN 0x006400FF
#define COLOR_DARKKHAKI 0xBDB76BFF
#define COLOR_DARKMAGENTA 0x8B008BFF
#define COLOR_DARKOLIVEGREEN 0x556B2FFF
#define COLOR_DARKORANGE 0xFF8C00FF
#define COLOR_DARKORCHID 0x9932CCFF
#define COLOR_DARKRED 0x8B0000FF
#define COLOR_DARKSALMON 0xE9967AFF
#define COLOR_DARKSEAGREEN 0x8FBC8BFF
#define COLOR_DARKSLATEBLUE 0x483D8BFF
#define COLOR_DARKSLATEGRAY 0x2F4F4FFF
#define COLOR_DARKTURQUOISE 0x00CED1FF
#define COLOR_DARKVIOLET 0x9400D3FF
#define COLOR_DEEPPINK 0xFF1493FF
#define COLOR_DEEPSKYBLUE 0x00BFFFFF
#define COLOR_DIMGRAY 0x696969FF
#define COLOR_DODGERBLUE 0x1E90FFFF
#define COLOR_FIREBRICK 0xB22222FF
#define COLOR_FLORALWHITE 0xFFFAF0FF
#define COLOR_FORESTGREEN 0x228B22FF
#define COLOR_FUCHSIA 0xFF00FFFF
#define COLOR_GAINSBORO 0xDCDCDCFF
#define COLOR_GHOSTWHITE 0xF8F8FFFF
#define COLOR_GOLD 0xFFD700FF
#define COLOR_GOLDENROD 0xDAA520FF
#define COLOR_GRAY 0x808080FF
#define COLOR_GREEN 0x008000FF
#define COLOR_GREENYELLOW 0xADFF2FFF
#define COLOR_HONEYDEW 0xF0FFF0FF
#define COLOR_HOTPINK 0xFF69B4FF
#define COLOR_INDIANRED 0xCD5C5CFF
#define COLOR_INDIGO 0x4B0082FF
#define COLOR_IVORY 0xFFFFF0FF
#define COLOR_KHAKI 0xF0E68CFF
#define COLOR_LAVENDER 0xE6E6FAFF
#define COLOR_LAVENDERBLUSH 0xFFF0F5FF
#define COLOR_LAWNGREEN 0x7CFC00FF
#define COLOR_LEMONCHIFFON 0xFFFACDFF
#define COLOR_LIGHTBLUE 0xADD8E6FF
#define COLOR_LIGHTCORAL 0xF08080FF
#define COLOR_LIGHTCYAN 0xE0FFFFFF
#define COLOR_LIGHTGOLDENRODYELLOW 0xFAFAD2FF
#define COLOR_LIGHTGRAY 0xD3D3D3FF
#define COLOR_LIGHTGREEN 0x90EE90FF
#define COLOR_LIGHTPINK 0xFFB6C1FF
#define COLOR_LIGHTSALMON 0xFFA07AFF
#define COLOR_LIGHTSEAGREEN 0x20B2AAFF
#define COLOR_LIGHTSKYBLUE 0x87CEFAFF
#define COLOR_LIGHTSLATEGRAY 0x778899FF
#define COLOR_LIGHTSTEELBLUE 0xB0C4DEFF
#define COLOR_LIGHTYELLOW 0xFFFFE0FF
#define COLOR_LIME 0x00FF00FF
#define COLOR_LIMEGREEN 0x32CD32FF
#define COLOR_LINEN 0xFAF0E6FF
#define COLOR_MAGENTA 0xFF00FFFF
#define COLOR_MAROON 0x800000FF
#define COLOR_MEDIUMAQUAMARINE 0x66CDAAFF
#define COLOR_MEDIUMBLUE 0x0000CDFF
#define COLOR_MEDIUMORCHID 0xBA55D3FF
#define COLOR_MEDIUMPURPLE 0x9370DBFF
#define COLOR_MEDIUMSEAGREEN 0x3CB371FF
#define COLOR_MEDIUMSLATEBLUE 0x7B68EEFF
#define COLOR_MEDIUMSPRINGGREEN 0x00FA9AFF
#define COLOR_MEDIUMTURQUOISE 0x48D1CCFF
#define COLOR_MEDIUMVIOLETRED 0xC71585FF
#define COLOR_MIDNIGHTBLUE 0x191970FF
#define COLOR_MINTCREAM 0xF5FFFAFF
#define COLOR_MISTYROSE 0xFFE4E1FF
#define COLOR_MOCCASIN 0xFFE4B5FF
#define COLOR_NAVAJOWHITE 0xFFDEADFF
#define COLOR_NAVY 0x000080FF
#define COLOR_OLDLACE 0xFDF5E6FF
#define COLOR_OLIVE 0x808000FF
#define COLOR_OLIVEDRAB 0x6B8E23FF
#define COLOR_ORANGE 0xFFA500FF
#define COLOR_ORANGERED 0xFF4500FF
#define COLOR_ORCHID 0xDA70D6FF
#define COLOR_PALEGOLDENROD 0xEEE8AAFF
#define COLOR_PALEGREEN 0x98FB98FF
#define COLOR_PALETURQUOISE 0xAFEEEEFF
#define COLOR_PALEVIOLETRED 0xDB7093FF
#define COLOR_PAPAYAWHIP 0xFFEFD5FF
#define COLOR_PEACHPUFF 0xFFDAB9FF
#define COLOR_PERU 0xCD853FFF
#define COLOR_PINK 0xFFC0CBFF
#define COLOR_PLUM 0xDDA0DDFF
#define COLOR_POWDERBLUE 0xB0E0E6FF
#define COLOR_PURPLE 0x800080FF
#define COLOR_RED 0xFF0000FF
#define COLOR_ROSYBROWN 0xBC8F8FFF
#define COLOR_ROYALBLUE 0x4169E1FF
#define COLOR_SADDLEBROWN 0x8B4513FF
#define COLOR_SALMON 0xFA8072FF
#define COLOR_SANDYBROWN 0xF4A460FF
#define COLOR_SEAGREEN 0x2E8B57FF
#define COLOR_SEASHELL 0xFFF5EEFF
#define COLOR_SIENNA 0xA0522DFF
#define COLOR_SILVER 0xC0C0C0FF
#define COLOR_SKYBLUE 0x87CEEBFF
#define COLOR_SLATEBLUE 0x6A5ACDFF
#define COLOR_SLATEGRAY 0x708090FF
#define COLOR_SNOW 0xFFFAFAFF
#define COLOR_SPRINGGREEN 0x00FF7FFF
#define COLOR_STEELBLUE 0x4682B4FF
#define COLOR_TAN 0xD2B48CFF
#define COLOR_TEAL 0x008080FF
#define COLOR_THISTLE 0xD8BFD8FF
#define COLOR_TOMATO 0xFF6347FF
#define COLOR_TURQUOISE 0x40E0D0FF
#define COLOR_VIOLET 0xEE82EEFF
#define COLOR_WHEAT 0xF5DEB3FF
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_WHITESMOKE 0xF5F5F5FF
#define COLOR_YELLOW 0xFFFF00FF
#define COLOR_YELLOWGREEN 0x9ACD32FF
#define COLOR_BUTTONFACE 0xF0F0F0FF
#define COLOR_BUTTONHIGHLIGHT 0xFFFFFFFF
#define COLOR_BUTTONSHADOW 0xA0A0A0FF
#define COLOR_GRADIENTACTIVECAPTION 0xB9D1EAFF
#define COLOR_GRADIENTINACTIVECAPTION 0xD7E4F2FF
#define COLOR_MENUBAR 0xF0F0F0FF
#define COLOR_MENUHIGHLIGHT 0x3399FFFF

// (FF)TeddyBear
#define COLOR_TEDDY 0x8A946BFF

// System Defined Colors
#define COLOR_ACTIVEBORDER 0xB4B4B4FF
#define COLOR_ACTIVECAPTION 0x99B4D1FF
#define COLOR_ACTIVECAPTIONTEXT 0x000000FF
#define COLOR_ALICEBLUE 0xF0F8FFFF
#define COLOR_ANTIQUEWHITE 0xFAEBD7FF
#define COLOR_APPWORKSPACE 0xABABABFF
#define COLOR_AQUA 0x00FFFFFF
#define COLOR_AQUAMARINE 0x7FFFD4FF
#define COLOR_AZURE 0xF0FFFFFF
#define COLOR_BEIGE 0xF5F5DCFF
#define COLOR_BISQUE 0xFFE4C4FF
#define COLOR_BLACK 0x000000FF
#define COLOR_BLANCHEDALMOND 0xFFEBCDFF
#define COLOR_BLUE 0x0000FFFF
#define COLOR_BLUEVIOLET 0x8A2BE2FF
#define COLOR_BROWN 0xA52A2AFF
#define COLOR_BURLYWOOD 0xDEB887FF
#define COLOR_BUTTONFACE 0xF0F0F0FF
#define COLOR_BUTTONHIGHLIGHT 0xFFFFFFFF
#define COLOR_BUTTONSHADOW 0xA0A0A0FF
#define COLOR_CADETBLUE 0x5F9EA0FF
#define COLOR_CHARTREUSE 0x7FFF00FF
#define COLOR_CHOCOLATE 0xD2691EFF
#define COLOR_CONTROL 0xF0F0F0FF
#define COLOR_CONTROLDARK 0xA0A0A0FF
#define COLOR_CONTROLDARKDARK 0x696969FF
#define COLOR_CONTROLLIGHT 0xE3E3E3FF
#define COLOR_CONTROLLIGHTLIGHT 0xFFFFFFFF
#define COLOR_CONTROLTEXT 0x000000FF
#define COLOR_CORAL 0xFF7F50FF
#define COLOR_CORNFLOWERBLUE 0x6495EDFF
#define COLOR_CORNSILK 0xFFF8DCFF
#define COLOR_CRIMSON 0xDC143CFF
#define COLOR_CYAN 0x00FFFFFF
#define COLOR_DARKBLUE 0x00008BFF
#define COLOR_DARKCYAN 0x008B8BFF
#define COLOR_DARKGOLDENROD 0xB8860BFF
#define COLOR_DARKGRAY 0xA9A9A9FF
#define COLOR_DARKGREEN 0x006400FF
#define COLOR_DARKKHAKI 0xBDB76BFF
#define COLOR_DARKMAGENTA 0x8B008BFF
#define COLOR_DARKOLIVEGREEN 0x556B2FFF
#define COLOR_DARKORANGE 0xFF8C00FF
#define COLOR_DARKORCHID 0x9932CCFF
#define COLOR_DARKRED 0x8B0000FF
#define COLOR_DARKSALMON 0xE9967AFF
#define COLOR_DARKSEAGREEN 0x8FBC8BFF
#define COLOR_DARKSLATEBLUE 0x483D8BFF
#define COLOR_DARKSLATEGRAY 0x2F4F4FFF
#define COLOR_DARKTURQUOISE 0x00CED1FF
#define COLOR_DARKVIOLET 0x9400D3FF
#define COLOR_DEEPPINK 0xFF1493FF
#define COLOR_DEEPSKYBLUE 0x00BFFFFF
#define COLOR_DESKTOP 0x000000FF
#define COLOR_DIMGRAY 0x696969FF
#define COLOR_DODGERBLUE 0x1E90FFFF
#define COLOR_FIREBRICK 0xB22222FF
#define COLOR_FLORALWHITE 0xFFFAF0FF
#define COLOR_FORESTGREEN 0x228B22FF
#define COLOR_FUCHSIA 0xFF00FFFF
#define COLOR_GAINSBORO 0xDCDCDCFF
#define COLOR_GHOSTWHITE 0xF8F8FFFF
#define COLOR_GOLD 0xFFD700FF
#define COLOR_GOLDENROD 0xDAA520FF
#define COLOR_GRADIENTACTIVECAPTION 0xB9D1EAFF
#define COLOR_GRADIENTINACTIVECAPTION 0xD7E4F2FF
#define COLOR_GRAY 0x808080FF
#define COLOR_GRAYTEXT 0x808080FF
#define COLOR_GREEN 0x008000FF
#define COLOR_GREENYELLOW 0xADFF2FFF
#define COLOR_HIGHLIGHT 0x3399FFFF
#define COLOR_HIGHLIGHTTEXT 0xFFFFFFFF
#define COLOR_HONEYDEW 0xF0FFF0FF
#define COLOR_HOTPINK 0xFF69B4FF
#define COLOR_HOTTRACK 0x0066CCFF
#define COLOR_INACTIVEBORDER 0xF4F7FCFF
#define COLOR_INACTIVECAPTION 0xBFCDDBFF
#define COLOR_INACTIVECAPTIONTEXT 0x434E54FF
#define COLOR_INDIANRED 0xCD5C5CFF
#define COLOR_INDIGO 0x4B0082FF
#define COLOR_INFO 0xFFFFE1FF
#define COLOR_INFOTEXT 0x000000FF
#define COLOR_IVORY 0xFFFFF0FF
#define COLOR_KHAKI 0xF0E68CFF
#define COLOR_LAVENDER 0xE6E6FAFF
#define COLOR_LAVENDERBLUSH 0xFFF0F5FF
#define COLOR_LAWNGREEN 0x7CFC00FF
#define COLOR_LEMONCHIFFON 0xFFFACDFF
#define COLOR_LIGHTBLUE 0xADD8E6FF
#define COLOR_LIGHTCORAL 0xF08080FF
#define COLOR_LIGHTCYAN 0xE0FFFFFF
#define COLOR_LIGHTGOLDENRODYELLOW 0xFAFAD2FF
#define COLOR_LIGHTGRAY 0xD3D3D3FF
#define COLOR_LIGHTGREEN 0x90EE90FF
#define COLOR_LIGHTPINK 0xFFB6C1FF
#define COLOR_LIGHTSALMON 0xFFA07AFF
#define COLOR_LIGHTSEAGREEN 0x20B2AAFF
#define COLOR_LIGHTSKYBLUE 0x87CEFAFF
#define COLOR_LIGHTSLATEGRAY 0x778899FF
#define COLOR_LIGHTSTEELBLUE 0xB0C4DEFF
#define COLOR_LIGHTYELLOW 0xFFFFE0FF
#define COLOR_LIME 0x00FF00FF
#define COLOR_LIMEGREEN 0x32CD32FF
#define COLOR_LINEN 0xFAF0E6FF
#define COLOR_MAGENTA 0xFF00FFFF
#define COLOR_MAROON 0x800000FF
#define COLOR_MEDIUMAQUAMARINE 0x66CDAAFF
#define COLOR_MEDIUMBLUE 0x0000CDFF
#define COLOR_MEDIUMORCHID 0xBA55D3FF
#define COLOR_MEDIUMPURPLE 0x9370DBFF
#define COLOR_MEDIUMSEAGREEN 0x3CB371FF
#define COLOR_MEDIUMSLATEBLUE 0x7B68EEFF
#define COLOR_MEDIUMSPRINGGREEN 0x00FA9AFF
#define COLOR_MEDIUMTURQUOISE 0x48D1CCFF
#define COLOR_MEDIUMVIOLETRED 0xC71585FF
#define COLOR_MENU 0xF0F0F0FF
#define COLOR_MENUBAR 0xF0F0F0FF
#define COLOR_MENUHIGHLIGHT 0x3399FFFF
#define COLOR_MENUTEXT 0x000000FF
#define COLOR_MIDNIGHTBLUE 0x191970FF
#define COLOR_MINTCREAM 0xF5FFFAFF
#define COLOR_MISTYROSE 0xFFE4E1FF
#define COLOR_MOCCASIN 0xFFE4B5FF
#define COLOR_NAVAJOWHITE 0xFFDEADFF
#define COLOR_NAVY 0x000080FF
#define COLOR_OLDLACE 0xFDF5E6FF
#define COLOR_OLIVE 0x808000FF
#define COLOR_OLIVEDRAB 0x6B8E23FF
#define COLOR_ORANGE 0xFFA500FF
#define COLOR_ORANGERED 0xFF4500FF
#define COLOR_ORCHID 0xDA70D6FF
#define COLOR_PALEGOLDENROD 0xEEE8AAFF
#define COLOR_PALEGREEN 0x98FB98FF
#define COLOR_PALETURQUOISE 0xAFEEEEFF
#define COLOR_PALEVIOLETRED 0xDB7093FF
#define COLOR_PAPAYAWHIP 0xFFEFD5FF
#define COLOR_PEACHPUFF 0xFFDAB9FF
#define COLOR_PERU 0xCD853FFF
#define COLOR_PINK 0xFFC0CBFF
#define COLOR_PLUM 0xDDA0DDFF
#define COLOR_POWDERBLUE 0xB0E0E6FF
#define COLOR_PURPLE 0x800080FF
#define COLOR_RED 0xFF0000FF
#define COLOR_ROSYBROWN 0xBC8F8FFF
#define COLOR_ROYALBLUE 0x4169E1FF
#define COLOR_SADDLEBROWN 0x8B4513FF
#define COLOR_SALMON 0xFA8072FF
#define COLOR_SANDYBROWN 0xF4A460FF
#define COLOR_SCROLLBAR 0xC8C8C8FF
#define COLOR_SEAGREEN 0x2E8B57FF
#define COLOR_SEASHELL 0xFFF5EEFF
#define COLOR_SIENNA 0xA0522DFF
#define COLOR_SILVER 0xC0C0C0FF
#define COLOR_SKYBLUE 0x87CEEBFF
#define COLOR_SLATEBLUE 0x6A5ACDFF
#define COLOR_SLATEGRAY 0x708090FF
#define COLOR_SNOW 0xFFFAFAFF
#define COLOR_SPRINGGREEN 0x00FF7FFF
#define COLOR_STEELBLUE 0x4682B4FF
#define COLOR_TAN 0xD2B48CFF
#define COLOR_TEAL 0x008080FF
#define COLOR_THISTLE 0xD8BFD8FF
#define COLOR_TOMATO 0xFF6347FF
#define COLOR_TRANSPARENT 0xFFFFFF00
#define COLOR_TURQUOISE 0x40E0D0FF
#define COLOR_VIOLET 0xEE82EEFF
#define COLOR_WHEAT 0xF5DEB3FF
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_WHITESMOKE 0xF5F5F5FF
#define COLOR_WINDOW 0xFFFFFFFF
#define COLOR_WINDOWFRAME 0x646464FF
#define COLOR_WINDOWTEXT 0x000000FF
#define COLOR_YELLOW 0xFFFF00FF
#define COLOR_YELLOWGREEN 0x9ACD32FF
sscanf.inc

pawn Code:
/*----------------------------------------------------------------------------*-
Function:
    sscanf
Params:
    string[] - String to extract parameters from.
    format[] - Parameter types to get.
    {Float,_}:... - Data return variables.
Return:
    0 - Successful, not 0 - fail.
Notes:
    A fail is either insufficient variables to store the data or insufficient
    data for the format string - excess data is disgarded.

    A string in the middle of the input data is extracted as a single word, a
    string at the end of the data collects all remaining text.

    The format codes are:

    c - A character.
    d, i - An integer.
    h, x - A hex number (e.g. a colour).
    f - A float.
    s - A string.
    z - An optional string.
    pX - An additional delimiter where X is another character.
    '' - Encloses a litteral string to locate.
    u - User, takes a name, part of a name or an id and returns the id if they're connected.

    Now has IsNumeric integrated into the code.

    Added additional delimiters in the form of all whitespace and an
    optioanlly specified one in the format string.
-*----------------------------------------------------------------------------*/


stock sscanf(string[], format[], {Float,_}:...)
{
    #if defined isnull
        if (isnull(string))
    #else
        if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
    #endif
        {
            return format[0];
        }
    #pragma tabsize 4
    new
        formatPos = 0,
        stringPos = 0,
        paramPos = 2,
        paramCount = numargs(),
        delim = ' ';
    while (string[stringPos] && string[stringPos] <= ' ')
    {
        stringPos++;
    }
    while (paramPos < paramCount && string[stringPos])
    {
        switch (format[formatPos++])
        {
            case '\0':
            {
                return 0;
            }
            case 'i', 'd':
            {
                new
                    neg = 1,
                    num = 0,
                    ch = string[stringPos];
                if (ch == '-')
                {
                    neg = -1;
                    ch = string[++stringPos];
                }
                do
                {
                    stringPos++;
                    if ('0' <= ch <= '9')
                    {
                        num = (num * 10) + (ch - '0');
                    }
                    else
                    {
                        return -1;
                    }
                }
                while ((ch = string[stringPos]) > ' ' && ch != delim);
                setarg(paramPos, 0, num * neg);
            }
            case 'h', 'x':
            {
                new
                    num = 0,
                    ch = string[stringPos];
                do
                {
                    stringPos++;
                    switch (ch)
                    {
                        case 'x', 'X':
                        {
                            num = 0;
                            continue;
                        }
                        case '0' .. '9':
                        {
                            num = (num << 4) | (ch - '0');
                        }
                        case 'a' .. 'f':
                        {
                            num = (num << 4) | (ch - ('a' - 10));
                        }
                        case 'A' .. 'F':
                        {
                            num = (num << 4) | (ch - ('A' - 10));
                        }
                        default:
                        {
                            return -1;
                        }
                    }
                }
                while ((ch = string[stringPos]) > ' ' && ch != delim);
                setarg(paramPos, 0, num);
            }
            case 'c':
            {
                setarg(paramPos, 0, string[stringPos++]);
            }
            case 'f':
            {

                new changestr[16], changepos = 0, strpos = stringPos;
                while(changepos < 16 && string[strpos] && string[strpos] != delim)
                {
                    changestr[changepos++] = string[strpos++];
                    }
                changestr[changepos] = '\0';
                setarg(paramPos,0,_:floatstr(changestr));
            }
            case 'p':
            {
                delim = format[formatPos++];
                continue;
            }
            case '\'':
            {
                new
                    end = formatPos - 1,
                    ch;
                while ((ch = format[++end]) && ch != '\'') {}
                if (!ch)
                {
                    return -1;
                }
                format[end] = '\0';
                if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
                {
                    if (format[end + 1])
                    {
                        return -1;
                    }
                    return 0;
                }
                format[end] = '\'';
                stringPos = ch + (end - formatPos);
                formatPos = end + 1;
            }
            case 'u':
            {
                new
                    end = stringPos - 1,
                    id = 0,
                    bool:num = true,
                    ch;
                while ((ch = string[++end]) && ch != delim)
                {
                    if (num)
                    {
                        if ('0' <= ch <= '9')
                        {
                            id = (id * 10) + (ch - '0');
                        }
                        else
                        {
                            num = false;
                        }
                    }
                }
                if (num && IsPlayerConnected(id))
                {
                    setarg(paramPos, 0, id);
                }
                else
                {
                    #if !defined foreach
                        #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
                        #define __SSCANF_FOREACH__
                    #endif
                    string[end] = '\0';
                    num = false;
                    new
                        name[MAX_PLAYER_NAME];
                    id = end - stringPos;
                    foreach (Player, playerid)
                    {
                        GetPlayerName(playerid, name, sizeof (name));
                        if (!strcmp(name, string[stringPos], true, id))
                        {
                            setarg(paramPos, 0, playerid);
                            num = true;
                            break;
                        }
                    }
                    if (!num)
                    {
                        setarg(paramPos, 0, INVALID_PLAYER_ID);
                    }
                    string[end] = ch;
                    #if defined __SSCANF_FOREACH__
                        #undef foreach
                        #undef __SSCANF_FOREACH__
                    #endif
                }
                stringPos = end;
            }
            case 's', 'z':
            {
                new
                    i = 0,
                    ch;
                if (format[formatPos])
                {
                    while ((ch = string[stringPos++]) && ch != delim)
                    {
                        setarg(paramPos, i++, ch);
                    }
                    if (!i)
                    {
                        return -1;
                    }
                }
                else
                {
                    while ((ch = string[stringPos++]))
                    {
                        setarg(paramPos, i++, ch);
                    }
                }
                stringPos--;
                setarg(paramPos, i, '\0');
            }
            default:
            {
                continue;
            }
        }
        while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
        {
            stringPos++;
        }
        while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
        {
            stringPos++;
        }
        paramPos++;
    }
    do
    {
        if ((delim = format[formatPos++]) > ' ')
        {
            if (delim == '\'')
            {
                while ((delim = format[formatPos++]) && delim != '\'') {}
            }
            else if (delim != 'z')
            {
                return delim;
            }
        }
    }
    while (delim > ' ');
    return 0;
}
Note: This version is deprecated. Please use the plugin version.

How to create modules? [Example]

1. Create your module file and include it in gamemode.
pawn Code:
////////////////////////////////////////////////////////////////////////////////
// Modules
////////////////////////////////////////////////////////////////////////////////

#include "ModuleName" ...
2. Create your own functions usable in SA:MP Callbacks...

---

How to create custom callbacks? [Example]

1. Create variables for store values you checking.

pawn Code:
new Float:CustomCallback_Health[MAX_PLAYERS];
2. Compare old value with new value in existing callback or create timer.

pawn Code:
...
    ////////////////////////////////////////////////////////////////////////////
    // Variables
    ////////////////////////////////////////////////////////////////////////////
    new Float:PlayerHealth;

    ////////////////////////////////////////////////////////////////////////////
    // Get Player health
    ////////////////////////////////////////////////////////////////////////////
    GetPlayerHealth(playerid,PlayerHealth);

    ////////////////////////////////////////////////////////////////////////////
    // Compare values
    ////////////////////////////////////////////////////////////////////////////
    if(PlayerHealth != CustomCallback_Health[playerid])
    {
        OnPlayerHealthChange(playerid,PlayerHealth);
    }
...
3. Create custom callback

pawn Code:
////////////////////////////////////////////////////////////////////////////////
// Custom Callbacks
////////////////////////////////////////////////////////////////////////////////

stock OnPlayerHealthChange(playerid, Float:newhealth)
{
    ////////////////////////////////////////////////////////////////////////////
    // Do something...
    ////////////////////////////////////////////////////////////////////////////

    ////////////////////////////////////////////////////////////////////////////
    // Set old health value = new health value ...
    ////////////////////////////////////////////////////////////////////////////
    CustomCallback_Health[playerid] = newhealth;
    return 1;
}
Thanks to...

Oxside - colors.inc [included]
Zeex - zcmd.inc [optimized / customized]

Dont comment its good or bad thing to create framework...
Please give insights what can be added...

[some parts are translated by ****** couse my english is poor]...
Reply
#2

Well, I understand what you tried to do here but this isn't a framework.

https://en.wikipedia.org/wiki/Software_framework

What you did is just place tons of comments, which can be very handy too!
Reply
#3

Hi, Y_Lees...
I look at your code and it is too large to be functional for a normal SA:MP user.
The problem lies in the files layout and their names. I want to create it simply.
I dont want to "fix" all callbacks / functions like you. ( SA:MP Team will fix this problems in future )
I dont want to modify orginal functions... Dont need to hooks etc. etc.

I just checking functions couse sometimes in DoS Attacks using packets are returning same values many times...

Btw. i need my comments couse are verry useful to newbies in pawno which using my code.
Reply
#4

Health should be a float.
Reply
#5

Code:
How does extra code help that?
not continuing when still same values or player is not connected?...

Code:
that function name is entirely self-descriptive?
sure but i just starts work with my framework and must be commented
Reply
#6

Psst.. https://github.com/oscar-broman/PAWN-Boilerplate
Reply
#7

nice
Reply
#8

Quote:

I am advanced / professional coder and i require of code purity.

You are not. Also learn proper English.
Reply
#9

Its obvious that your not a professional coder. If you want "code purity" then why are you doing things such as:
pawn Code:
if(somecondition)
{
    Return 0;
}
You have just used 4 lines for a simple condition, when infact it could be done in one line.
pawn Code:
If(somecondition) return 0;
P.s sorry if its bad indentation, I'm on my phone
Reply
#10

"Short" is not the same as "Pure", in fact there are very good arguments for always using braces even when they aren't strictly required - it leads to less errors and mistakes overall.
Reply
#11

Quote:
Originally Posted by thefatshizms
View Post
Its obvious that your not a professional coder. If you want "code purity" then why are you doing things such as:
That way imo is neater and is more consistent of other if statements, just because you can shorten script, doesn't mean you should, for example I rarely use the ternary operator because it's harder for others to read.

pawn Code:
new a;
if(x)
{
    a = b;
}
else
{
    a = c;
}
pawn Code:
new a = (x) ? b : c;
Reply
#12

I guess noone noticed this one..

pawn Код:
if(vehicleid == INVALID_VEHICLE_ID)
You know this will never be true right? even though the INVALID_VEHICLE_ID define is there, no sa-mp function or callback actually returns INVALID_VEHICLE_ID ... they return 0 ;\
Reply
#13

Quote:
Originally Posted by thefatshizms
Посмотреть сообщение
Its obvious that your not a professional coder. If you want "code purity" then why are you doing things such as:
pawn Код:
if(somecondition)
{
    Return 0;
}
You have just used 4 lines for a simple condition, when infact it could be done in one line.
pawn Код:
If(somecondition) return 0;
P.s sorry if its bad indentation, I'm on my phone
And your point is?
Reply
#14

I still don't understand why EVERYONE keeps looking over YSI because it's "too hard"...
Reply
#15

Quote:
Originally Posted by cessil
Посмотреть сообщение
pawn Код:
new a = (x) ? b : c;
The ternary operator is one of the most handy things I can think of (and standard in many languages). Clearly the people who then read your code aren't very good programmers. As for the brackets, YAGNI.
Reply
#16

Quote:
Originally Posted by Sinner
Посмотреть сообщение
The ternary operator is one of the most handy things I can think of (and standard in many languages). Clearly the people who then read your code aren't very good programmers. As for the brackets, YAGNI.
That refers to huge features, not two little braces that in my experience you frequently DO need when debugging something - that one line you thought you needed turns in to seven.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)