Page 1 of 1

Need some help for a mod.

PostPosted: Fri Dec 16, 05 1:46 pm
by MainMan
Ok for an RPG map i made, i made a creditcard. It reassigns the fire button, and everything works fine, apart from when i test it on a netgame and i press fire, it fires 2 credits instead of 1 (or displays the 'no credits' message twice.

Why is this hapenning? i'm guessing it might be something to do with roles or the clientfire function.

anyway, here is the relevant piece of code:

Code: Select all
function Fire(float value)
{
   if (CreditAmount == 0)
   {
      DeusExPlayer(Owner).ClientMessage("|p2No credits!");   
      return;
   }

   if (CreditAmount < 0)
   {
      DeusExPlayer(Owner).ClientMessage("|p2No credits!");
      CreditAmount = 0;   
      return;
   }

   CreditFire();


}



function CreditFire()
{
   local vector loc;
   local MMRPGCreditsProjectile SpawnObject;
   local MMRPGCreditsProjectileFive SpawnObject5;
   local MMRPGCreditsProjectileTen SpawnObject10;

   loc = Pawn(Owner).Location;
   loc.Z += Pawn(Owner).BaseEyeHeight;

   if(AmmoNames[0] == AmmoName)
   {
      if (CreditAmount > 0)
      {
         SpawnObject = Spawn(class'MMRPGCreditsProjectile',,, loc, Pawn(Owner).ViewRotation);
         DeusExPlayer(Owner).ClientMessage("|p3Paid 1 credit");
         CreditAmount-=1;
         SpawnObject.PawnOwner = Pawn(Owner);
      }
   }

   if(AmmoNames[1] == AmmoName)
   {
      if (CreditAmount >= 5)
      {
         SpawnObject5 = Spawn(class'MMRPGCreditsProjectileFive',,, loc, Pawn(Owner).ViewRotation);
         DeusExPlayer(Owner).ClientMessage("|p5Paid 5 credits");
         CreditAmount-=5;
         SpawnObject5.PawnOwner = Pawn(Owner);
      }
      else DeusExPlayer(Owner).ClientMessage("|p2Not enough money for a 5c. note!");
   }

   if(AmmoNames[2] == AmmoName)
   {
      if (CreditAmount >= 10)
      {
         SpawnObject10 = Spawn(class'MMRPGCreditsProjectileTen',,, loc, Pawn(Owner).ViewRotation);
         DeusExPlayer(Owner).ClientMessage("|p4Paid 10 credits");
         CreditAmount-=10;
         SpawnObject10.PawnOwner = Pawn(Owner);
      }
      else DeusExPlayer(Owner).ClientMessage("|p2Not enough money for a 10c. note!");
   }
}

PostPosted: Fri Dec 16, 05 6:25 pm
by Gishank
Set the ammo count ?
Ammount of bullets per shot ;)

PostPosted: Fri Dec 16, 05 6:42 pm
by MainMan
it doesn't use ammo. nor are there any bullets.

PostPosted: Fri Dec 16, 05 6:43 pm
by Gishank
Well ammount it shoots out per click.

E.g my klopfart from guns mod fires 4 gas grenades per shot just set your car thing to one shot. SHI.T i confused my self :S

PostPosted: Fri Dec 16, 05 6:46 pm
by MainMan
it doesnt shoot at all! can't you see it completely overrides the fire function. Im sorry klop but i dont think you're the one to help me with this.

PostPosted: Fri Dec 16, 05 6:48 pm
by Gishank
oops didn't look at the code properly, xD.

PostPosted: Sat Dec 17, 05 7:33 am
by MainMan
dont worry ive figured it out. instead of editing function fire, i changed state normal fire.

PostPosted: Sat Dec 17, 05 10:35 am
by Gishank
Good good can't wait to see it.