Originally posted by Legend
View Post
Code:
if(self.weapon == IT_SUPER_SHOTGUN) { [COLOR="Lime"] local .float shots_fired; self.shots_fired = 12 - self.rcdrum; self.ammo_shells = self.ammo_shells - self.shots_fired; if (self.ammo_shells > 12); self.rcdrum = 12; [/COLOR] fl = IT_RSHOT; if (self.ammo_shells < 1) am = 1; }


EDIT: A better method is to place this is client.qc in PutClientinServer ()
Code:
self.classname = "player"; self.health = 100; self.takedamage = DAMAGE_AIM; self.solid = SOLID_SLIDEBOX; self.movetype = MOVETYPE_WALK; self.show_hostile = 0; self.max_health = 100; self.flags = FL_CLIENT; self.air_finished = time + 12; self.dmg = 2; // initial water damage self.super_damage_finished = 0; self.radsuit_finished = 0; self.invisible_finished = 0; self.invincible_finished = 0; self.effects = 0; self.invincible_time = 0; [COLOR="Lime"]self.rcdrum = 12;[/COLOR]
Now to make it auto reload after the clip is empty we can use a method you might remember from your last reload code.
Go down to W_WeaponFrame.
After this code:
Code:
SuperDamageSound (); W_Attack ();
Code:
// check for attack if (self.button0) { SuperDamageSound (); W_Attack (); [COLOR="Lime"]} else if (self.weapon == IT_RSHOT) { // autoload if (self.currentammo < 1 && self.currentammo < self.ammo_shells) { reloadrc (); } }[/COLOR] };

As far as wanting it to display what is in the clip, it already does this really. First it looks at the inventory (your total number of shells), determines the number of shells you currently have in your clip, then after you fire displays only what shell count your currently have in the clip, and then after you reload, it updates the display (HUD) with your current inventory of shells minus what you just used for the last clip and minus the now additional clip you have loaded and displays that number. Once you start firing it will begin to display the number of shells left in your clip until you run out again and the process starts over. I find this to be a more than optimal solution without trying to set up additional HUD features which requires quite a bit more coding.



Comment