Author |
Topic: Chambered round while reloading? |
Cnopicilin |
|
General Member Since: Dec 15, 2009 Posts: 94 Last: Jul 6, 2011 [view latest posts] |
|
|
|
|
Samuel033 |
General Member Since: Dec 10, 2009 Posts: 484 Last: Dec 25, 2015 [view latest posts] |
|
|
|
Cnopicilin |
|
General Member Since: Dec 15, 2009 Posts: 94 Last: Jul 6, 2011 [view latest posts] |
|
|
|
Category: CoD4 Scripting Posted: Thursday, Feb. 3, 2011 06:01 am |
|
Samuel033 writes...Quote: As far as I know the max is whatever the clip can hold. There is no 'one in the chamber' in addition to the clip possible. However if you want to write a script I suppose you can have a watcher that waits until weapon reload (waittill 'reload_weapon') I think or something like that, sets a 'full clip' flag of some sort, then waits until the weapon is fired the first time. Then add one to the current clip. ltSpeir has made it, too bad he is out of reach. |
|
|
|
IzNoGoD |
General Member Since: Nov 29, 2008 Posts: 694 Last: Nov 10, 2012 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Saturday, Mar. 5, 2011 01:43 pm |
|
Try using this: (its written with cod2 in mind, so you might have to change a few things):
Code:
watchreload()
{
self endon("disconnect");
self endon("spawned");
self endon("killed");
self endon("killed_player");
self.weapon["primary"]["name"]=self getweaponslotweapon("primary");
self.weapon["primary"]["ammo"]=self getweaponslotammo("primary");
self.weapon["primary"]["clip"]=self getweaponslotclipammo("primary");
self.weapon["primaryb"]["name"]=self getweaponslotweapon("primaryb");
self.weapon["primaryb"]["ammo"]=self getweaponslotammo("primaryb");
self.weapon["primaryb"]["clip"]=self getweaponslotclipammo("primaryb");
for(;;)
{
slot=self getcurrentweaponslot();
if(self.weapon[slot]["name"]==self getweaponslotweapon(slot)&&slot!="none")
{
//player hasnt picked up a new weapon
if(self.weapon[slot]["clip"]<self getweaponslotclipammo(slot));
{
//player has reloaded the weapon
if(self.weapon[slot]["clip"]==0)
{
//player has reloaded an empty weapon
self setweaponslotammo(slot,self getweaponslotammo(slot)+1); //add one bullet to the non-clip ammo
self setweaponslotclipammo(slot,self getweaponslotclipammo(slot)-1); //substract one from the clip ammo
}
}
}
else if(slot!="none")
{
//player picked up a new weapon
self.weapon[slot]["name"]=self getweaponslotweapon(slot);
}
self.weapon["primary"]["ammo"]=self getweaponslotammo("primary");
self.weapon["primary"]["clip"]=self getweaponslotclipammo("primary");
self.weapon["primaryb"]["ammo"]=self getweaponslotammo("primaryb");
self.weapon["primaryb"]["clip"]=self getweaponslotclipammo("primaryb");
wait 0.05;
}
}
getcurrentweaponslot()
{
if(!isdefined(self getcurrentweapon()))
return "none";
else if(self getcurrentweapon()=="none")
return "none";
else if(self getcurrentweapon()==self getweaponslotweapon("primary"))
return "primary";
else if(self getcurrentweapon()==self getweaponslotweapon("primaryb"))
return "primaryb";
else
return "none";
}
untested code, use @ own risk |
|
|
|
Cnopicilin |
|
General Member Since: Dec 15, 2009 Posts: 94 Last: Jul 6, 2011 [view latest posts] |
|
|
|
|
Zaphax |
|
General Member Since: Jun 17, 2008 Posts: 251 Last: Dec 29, 2013 [view latest posts] |
|
|
|
Samuel033 |
General Member Since: Dec 10, 2009 Posts: 484 Last: Dec 25, 2015 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Saturday, Mar. 5, 2011 07:02 pm |
|
Cnopicilin writes...Quote: I already figured it out, thanks anyways!
What did you end up doing? |
|
|
|
Cnopicilin |
|
General Member Since: Dec 15, 2009 Posts: 94 Last: Jul 6, 2011 [view latest posts] |
|
|
|
|