


If( m_pPlayer->m_rgAmmo SetAnimation( PLAYER_ATTACK1 ) ĮMIT_SOUND_DYN( ENT(m_pPlayer->pev), // Entity sound originates fromīLASTER_SOUND_VOLUME, // Volume (0.0 to 1.0)ĪTTN_NORM, // Attenuation, whatever the hell that is We can rename it whatever we want we just have to preserve the order. Since, for this example, we're using the glock models ("9mmhandgun"), we'll have to use its animation list. Note that when using existing models, you must use the animation list that corresponds to them you can't mix'n'match the order of animations in the code. The actual animations are stored in each model, so we only declare the constants that reference them. Othersise, I think that's pretty self-explanatory. The names of existing Half-Life world models begin with "w_", which of course means World. MODEL_WORLD is the model used of the gun lying on the ground, waiting to be picked up by someone. Existing Half-Life weapons use "p_weaponname" as the name of these. MODEL_3RDPERSON is the model everyone else sees you using. Existing Half-Life weapons use "v_weaponname" as the name for these models.

MODEL_1STPERSON is the model you see yourself holding. #define BLASTER_FIRE_DELAY 0.5 // For comparison, glock's is 0.2 #define BLASTER_SOUND_SHOOT "weapons/electro5.wav" #define BLASTER_MODEL_WORLD "models/w_9mmhandgun.mdl"

#define BLASTER_MODEL_3RDPERSON "models/p_9mmhandgun.mdl" #define BLASTER_MODEL_1STPERSON "models/v_9mmhandgun.mdl" Now let's define some other useful constants that we'll need shortly: For now, the new weapon won't appear in the HUD at all. The highest weight value for the existing Half-Life weapons is 20.Īlso remember that this information is useless until I can figure out the client.dll. Whatever weapon has the greatest weight, that you have ammo for, is automatically switched to. When you run out of ammo, what weapon should you switch to? That's determined by weight. We want the blaster just below it.īLASTER_WEIGHT is used for auto-switching. Slot 4 is where the other high-tech weapons reside: the RPG, gauss, egon, and hornet gun are in it.īLASTER_POSITION is the position of the weapon within the slot. Crowbar is in Slot 1, Glock and Magnum are in Slot 2, MP5 is in Slot 3, etc. The maximum number of weapons is basically unlimited (it's 2^31 I think).īLASTER_SLOT is the slot the blaster will be in. The highest index of current Half-Life weapons is 15, so for an additional weapon it should be 16. WEAPON_BLASTER is the index of the blaster.
