Banned item check

This commit is contained in:
ChocoTaco 2023-01-16 20:55:05 -05:00
parent 29be92e322
commit e9d0be4551

39
Classic/scripts/inventoryHud.cs Executable file → Normal file
View file

@ -566,27 +566,30 @@ function buyFavorites(%client)
for(%i = 0; %i < getFieldCount( %client.weaponIndex ); %i++)
{
%inv = $NameToInv[%client.favorites[getField( %client.weaponIndex, %i )]];
if(!($InvBanList[%cmt, %inv])){
if( %inv !$= "" )
{
%weaponCount++;
%client.player.setInventory( %inv, 1 );
}
if( %inv !$= "" )
{
%weaponCount++;
%client.player.setInventory( %inv, 1 );
// ----------------------------------------------------
// z0dd - ZOD, 4/24/02. Code optimization.
if ( %inv.image.ammo !$= "" )
%client.player.setInventory( %inv.image.ammo, 999 );
// ----------------------------------------------------
}
// ----------------------------------------------------
// z0dd - ZOD, 4/24/02. Code optimization.
if ( %inv.image.ammo !$= "" )
%client.player.setInventory( %inv.image.ammo, 999 );
// ----------------------------------------------------
}
%client.player.weaponCount = %weaponCount;
// pack
%pCh = $NameToInv[%client.favorites[%client.packIndex]];
if ( %pCh $= "" )
%client.clearBackpackIcon();
else
%client.player.setInventory( %pCh, 1 );
if(!($InvBanList[%cmt, %pCh])){
if ( %pCh $= "" )
%client.clearBackpackIcon();
else
%client.player.setInventory( %pCh, 1 );
}
// if this pack is a deployable that has a team limit, warn the purchaser
// if it's a deployable turret, the limit depends on the number of players (deployables.cs)
@ -665,7 +668,7 @@ function buyDeployableFavorites(%client)
for ( %i = 0; %i < getFieldCount( %client.weaponIndex ); %i++ )
{
%inv = $NameToInv[%client.favorites[getField( %client.weaponIndex, %i )]];
if ( !($InvBanList[DeployInv, %inv]) )
if ( !($InvBanList[DeployInv, %inv]) && !$InvBanList[%cmt, %inv])
{
%player.setInventory( %inv, 1 );
// increment weapon count if current armor can hold this weapon
@ -686,7 +689,7 @@ function buyDeployableFavorites(%client)
{
%GInv = $NameToInv[%client.favorites[getField( %client.grenadeIndex, %i )]];
%client.player.lastGrenade = %GInv;
if ( !($InvBanList[DeployInv, %GInv]) )
if ( !($InvBanList[DeployInv, %GInv]) && !$InvBanList[%cmt, %GInv])
%player.setInventory( %GInv, 30 );
}
@ -705,7 +708,7 @@ function buyDeployableFavorites(%client)
for ( %i = 0; %i < getFieldCount( %client.mineIndex ); %i++ )
{
%MInv = $NameToInv[%client.favorites[getField( %client.mineIndex, %i )]];
if ( !($InvBanList[DeployInv, %MInv]) )
if ( !($InvBanList[DeployInv, %MInv]) && !$InvBanList[%cmt, %MInv])
%player.setInventory( %MInv, 30 );
}
if ( !($InvBanList[DeployInv, Beacon]) && !($InvBanList[%cmt, Beacon]) )
@ -717,7 +720,7 @@ function buyDeployableFavorites(%client)
// players cannot buy deployable station packs from a deployable inventory station
%packChoice = $NameToInv[%client.favorites[%client.packIndex]];
if ( !($InvBanList[DeployInv, %packChoice]) )
if ( !($InvBanList[DeployInv, %packChoice]) && !$InvBanList[%cmt, %packChoice])
%player.setInventory( %packChoice, 1 );
// if this pack is a deployable that has a team limit, warn the purchaser