I wanted to change the damage that it deals to be proportional to the distance of the shot.
I tried this change to the code, but it won't compile

/* //all new function new
sniper rifle
================
W_FireSniper
================
*/
void() W_FireSniper =
{
local vector dir;
local float damage;
damage = 300 + random()*50 + random()*50; //up to 400, never less than 300
- sniper damage
sound (self, CHAN_WEAPON, "weapons/rocket1i.wav", 1, ATTN_NORM);
self.punchangle_x = -2;
self.currentammo = self.ammo_shells = self.ammo_shells - 10; //set to whatever you want
dir = aim (self, 100000);
FireBullets (1, dir, '0 0 0', damage);
org = self.origin + '0 0 16';
traceline (org, org + v_forward*300, TRUE, self);
};
I added the lines in bold.
Am I on the right path of thinking?