Implement default knife display logic in index.php to ensure a knife is always shown, enhancing user experience by providing a fallback option when no knife is selected. Update HTML comments for clarity.

This commit is contained in:
Bram Suurd
2025-06-30 00:04:58 +02:00
parent 4f7af6986d
commit b1d365ecb8

View File

@@ -234,9 +234,15 @@ if (isset($_SESSION['steamid'])) {
}
}
}
// If no knife selected at all, show default knife
if (!$displayKnifeSkin && !$displayKnife && isset($knifes[0])) {
$displayKnife = $knifes[0]; // Default knife
$knifeSource = 'default';
}
?>
<?php if ($displayKnifeSkin || $displayKnife): ?>
<!-- Always show a knife (either selected or default) -->
<div class="loadout-item" data-weapon-type="knife">
<div class="item-image-container">
<?php if ($knifeSource == 'skin'): ?>
@@ -259,7 +265,6 @@ if (isset($_SESSION['steamid'])) {
</div>
</div>
</div>
<?php endif; ?>
<!-- Show all weapons (exclude knives) - either with custom skin or default -->
<?php foreach ($weapons as $defindex => $weapon): ?>