Results 1 to 4 of 4

Thread: Get grenade ammo

  1. #1
    Private First Class Earliboy's Avatar
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    130
    Thanks
    5
    Thanked 88 Times in 61 Posts

    Get grenade ammo

    Hello,
    i found a error message from my shop about the grenades:

    Unknown weaponslot name frag_grenade_american_mp. Valid weaponslots are "primary" and "primaryb": (file 'maps/mp/gametypes/_shopping.gsc', line 781)
    nades = self getWeaponSlotClipAmmo(grenadetype);

    Currently it can't work cause i dind't changed the grenades max ammo to unlimited. But still i need to get the ammo of grenades.

    Code:
    giveGrenades(count)
    {
    	self takeweapon("frag_grenade_american_mp");
    	self takeweapon("frag_grenade_german_mp");
    	
    	if(self.pers["team"] == "allies")
    		grenadetype = "frag_grenade_american_mp";
    	else
    		grenadetype = "frag_grenade_german_mp";
    	
    	nades = self getWeaponSlotClipAmmo(grenadetype);
    	count = count + nades;
    	
    	self giveWeapon(grenadetype);
    	self setWeaponClipAmmo(grenadetype, count);
    }
    Any idea?
    No ... No ... this is not possible .......

  2. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    [player] getammocount("frag_grenade_german_mp");

  3. The Following User Says Thank You to IzNoGoD For This Useful Post:

    kung foo man (8th February 2013)

  4. #3
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    You can't use the getWeaponSlotClipAmmo() function to find grenade ammo. It only works on the "primary" and "primaryb" weapon slots. Hence why you are getting the error that it must be one of those slots to check. The only way to check ammo for grenades in COD2 is via the getAmmoCount() function.

    However, the setWeaponClipAmmo() function DOES work with grenades, and so you set your grenade items using this function.

    It's a bit confusing, but once you know what function works with which weapon, it's relatively easy to set all types of ammo for any weapon.

  5. The Following User Says Thank You to Tally For This Useful Post:

    kung foo man (8th February 2013)

  6. #4
    Private First Class Earliboy's Avatar
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    130
    Thanks
    5
    Thanked 88 Times in 61 Posts
    Ye, thats why i forgot about the getAmmoCount ^^
    Thx
    No ... No ... this is not possible .......

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •