Need some help for a mod.

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:
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!");
}
}