There you go.
It's from BRSSEB Weapon tut, && as your first addon I recommand you go trough it first. If you end-up using it, ask Brsseb first or at least give credit to it upon ditribution of the addon.
Copy && paste to TXT editor && save as "YourAddonName.cpp"
Note that I haven't asked him authorization to publish his work here, but as it's part of a tute I assume it's free to use.
And BRSSEB tutes are the best. They learn me all.
http://ofp.gamezone.cz/_hosted/brsseb/tutorials.htmStart Of Example:
// Stalker by BCS (original name, put your own & GIVE CREDIT)
// Basic def.
#define TEast 0
#define TWest 1
#define TGuerrila 2
#define TCivilian 3
#define TSideUnknown 4
#define TEnemy 5
#define TFriendly 6
#define TLogic 7
#define true 1
#define false 0
// type scope
#define private 0
#define protected 1
#define public 2
class CfgPatches
{
   class YourAddonName
   {
      units[]={YourAddonEquippedUnit};
      weapons[]={Your AddonName};
      requiredVersion=1.00000;
   };
};
class CfgModels
{
   class Default{};
   class Weapon: Default{};
   class YourAddonName : Weapon{};
};
class CfgAmmo
{
   class default {};
   class BulletSingle: default {};
   class YourAddonNameAmmor: BulletSingle {};
 };
class CfgWeapons
{
   class Default {};
   class MGun: Default {};
   class Riffle: MGun {};  Â
   class SniperRiffle: Riffle{};
   class M21 : SniperRiffle{};
  Â
   class YourAddonName: M21
   {
      model="\YourAddonFolder\YourAddonName.p3d";
      displayName="The Name Displayed";
      displayNameMagazine="Ammo Name to be Displayed";
      magazines[]={"YourAddonName"};
      ammo=BulletSniper;
      picture="\YourAddonFolder\APictureOfIt.pac";  Â
     Â
   };
};
// You may forget this, but so easy when the unit is displayed in the editor...
class CfgVehicles
{
   class All{};
   class AllVehicles:All{};
   class Land:AllVehicles{};
   class Man:Land{};
   class Soldier:Man{}
   class Civilian:Soldier{};
   class YourUnitName: Civilian
   {
      access=2
      displayName="Your Unit Name";
      weapons[]={"Throw","Put","YourAddonName"};
      magazines[]={"YourAddonName","YourAddonName","YourAddonName","YourAddonName"};
   };  Â
};
class CfgNonAIVehicles
{
   class ProxyWeapon {};
   class ProxyYourUnitName : ProxyWeapon {};
};
End of example. && ByeBye
Peacepunk.