• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code KF Weapon code change

oldschool

Grizzled Veteran
May 1, 2015
377
37
NYC
osghc.com
I was using this before update 1043...I'm trying to figure out what changes were made to KFGame.KFWeapon.uc that is causing it not to work in game?

Code:
class cmdRestoreAmmo extends cmdBase;

static function doCmd(PlayerController Sender, array<string> CmdList)
{
    local array<PlayerController> PC;
    local KFWeapon KFW;
    local int i;
    

    PC = FindPlayers(Sender,CmdList[0],true);

    if (PC[0] == none)
    {
        Sender.ReceiveLocalizedMessage(class'AdminMessages',201); //Player not found msg
        return;
    }

    for (i = 0; i < PC.Length; i++)
    {
           ForEach PC[i].Pawn.InvManager.InventoryActors(class'KFWeapon', KFW)
       {
               KFW.AmmoCount[0] = KFW.MagazineCapacity[0];
            KFW.AddAmmo(KFW.MaxSpareAmmo[0]);
            KFW.AddSecondaryAmmo(KFW.MagazineCapacity[1]);
           }

        if( KFInventoryManager(PC[i].Pawn.InvManager) != none )
            KFInventoryManager(PC[i].Pawn.InvManager).GrenadeCount = KFPawn(PC[i].Pawn).GetPerk().MaxGrenadeCount;
        
        PC[i].ClientMessage("**AMMO HAS BEEN RESTORED**");
    }

}

defaultproperties
{
    cmdName="RestoreAmmo"
    cmdHelp="RestoreAmmo <player> - Restores ammo to <player>"
}