Removing points from only the guy purchasing

Posts 1–5 of 5 · Page 1 of 1
Removing points from only the guy purchasing
Yeeeeeeeeeah.
When using this code, when someone purchase Ammo, it doesnt take away 200 points, it takes away.. pretty much alot more since its foreach player.
Is there any fix to make it only take the points away from the guy purchasing? This has really been annoying me >.<

Code:
AmmOMatic(pos, angle)
{
	block = spawn("script_model", pos );
	block setModel("com_plasticcase_friendly");
	block.angles = angle;
	block Solid();
	block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
      self thread AmmoThink(pos);
      wait 0.01;
}

AmmoThink(pos)
{
        self endon("disconnect");
        for(;;)
        {
                foreach(player in level.players)
                {
                if(distance(pos, player.origin) <75 && player.cash >= 200)
                Player SetLowerMessage(1, "Press ^3[{+activate}] ^7to purchase Ammo", undefined, 25);
                else if(distance(pos, player.origin) <75 && player.cash < 200)
                Player SetLowerMessage(1, "You do not have enough ^1Cash!", undefined, 50);
                if(distance(pos, player.origin) <75 && player.cash >= 200 && Player UseButtonPressed())
                {
                        player thread refillAmmo();
                }
                if(distance(pos, player.origin) >75) Player ClearLowerMessage(1);
                }
                wait 0.05;
       }
}

refillAmmo()
{
	weaponList = self GetWeaponsListAll();

	foreach ( weaponName in weaponList )
	{
		if ( isSubStr( weaponName, "grenade" ) )
		{
			if ( self getAmmoCount( weaponName ) >= 1 )
				continue;
		} 
		self.cash -= 200;
		self giveMaxAmmo( weaponName );
	}
}
I think that I know what are you trying...., a ammo box for a zombie mod or something similar.

Try to reduce the price and see if works.
...
You do realize that would still make it cost more than its supposed to?
Code:
   else if(distance(pos, player.origin) <75 && player.cash < 200)
In this line of the code, you putted <200, try to put =200
Alright, to clear two things:
That means less than, so it wouldnt matter <-- forget that, I saw now what you meant, but I dont think it'd do anything
It only takes 200 when nobody is in the match
Posts 1–5 of 5 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us