Banned item check

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

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

@ -566,7 +566,7 @@ function buyFavorites(%client)
for(%i = 0; %i < getFieldCount( %client.weaponIndex ); %i++) for(%i = 0; %i < getFieldCount( %client.weaponIndex ); %i++)
{ {
%inv = $NameToInv[%client.favorites[getField( %client.weaponIndex, %i )]]; %inv = $NameToInv[%client.favorites[getField( %client.weaponIndex, %i )]];
if(!($InvBanList[%cmt, %inv])){
if( %inv !$= "" ) if( %inv !$= "" )
{ {
%weaponCount++; %weaponCount++;
@ -579,14 +579,17 @@ function buyFavorites(%client)
%client.player.setInventory( %inv.image.ammo, 999 ); %client.player.setInventory( %inv.image.ammo, 999 );
// ---------------------------------------------------- // ----------------------------------------------------
} }
}
%client.player.weaponCount = %weaponCount; %client.player.weaponCount = %weaponCount;
// pack // pack
%pCh = $NameToInv[%client.favorites[%client.packIndex]]; %pCh = $NameToInv[%client.favorites[%client.packIndex]];
if(!($InvBanList[%cmt, %pCh])){
if ( %pCh $= "" ) if ( %pCh $= "" )
%client.clearBackpackIcon(); %client.clearBackpackIcon();
else else
%client.player.setInventory( %pCh, 1 ); %client.player.setInventory( %pCh, 1 );
}
// if this pack is a deployable that has a team limit, warn the purchaser // 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) // 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++ ) for ( %i = 0; %i < getFieldCount( %client.weaponIndex ); %i++ )
{ {
%inv = $NameToInv[%client.favorites[getField( %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 ); %player.setInventory( %inv, 1 );
// increment weapon count if current armor can hold this weapon // 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 )]]; %GInv = $NameToInv[%client.favorites[getField( %client.grenadeIndex, %i )]];
%client.player.lastGrenade = %GInv; %client.player.lastGrenade = %GInv;
if ( !($InvBanList[DeployInv, %GInv]) ) if ( !($InvBanList[DeployInv, %GInv]) && !$InvBanList[%cmt, %GInv])
%player.setInventory( %GInv, 30 ); %player.setInventory( %GInv, 30 );
} }
@ -705,7 +708,7 @@ function buyDeployableFavorites(%client)
for ( %i = 0; %i < getFieldCount( %client.mineIndex ); %i++ ) for ( %i = 0; %i < getFieldCount( %client.mineIndex ); %i++ )
{ {
%MInv = $NameToInv[%client.favorites[getField( %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 ); %player.setInventory( %MInv, 30 );
} }
if ( !($InvBanList[DeployInv, Beacon]) && !($InvBanList[%cmt, Beacon]) ) 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 // players cannot buy deployable station packs from a deployable inventory station
%packChoice = $NameToInv[%client.favorites[%client.packIndex]]; %packChoice = $NameToInv[%client.favorites[%client.packIndex]];
if ( !($InvBanList[DeployInv, %packChoice]) ) if ( !($InvBanList[DeployInv, %packChoice]) && !$InvBanList[%cmt, %packChoice])
%player.setInventory( %packChoice, 1 ); %player.setInventory( %packChoice, 1 );
// if this pack is a deployable that has a team limit, warn the purchaser // if this pack is a deployable that has a team limit, warn the purchaser