Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change invalid weapon slot to -1 #862

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions SDK/include/player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,9 @@ struct WeaponSlotData
{
}

uint8_t slot()
int8_t slot()
{
static const uint8_t slots[] = {
static const int8_t slots[] = {
0, // 0 - Fist
0, // 1 - Brass Knuckles
1, // 2 - Golf Club
Expand Down
2 changes: 1 addition & 1 deletion SDK/include/values.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ constexpr int MAX_WEAPON_SLOTS = 13;
constexpr int MAX_VEHICLE_MODELS = 611 - 400 + 1;
constexpr int MAX_WEAPON_ID = 46;
constexpr int NUM_SKILL_LEVELS = 11;
constexpr uint8_t INVALID_WEAPON_SLOT = 0xFF;
constexpr int8_t INVALID_WEAPON_SLOT = -1;
constexpr int MIN_PLAYER_NAME = 3;
constexpr int MAX_PLAYER_NAME = 24;
constexpr int MAX_ANIMATIONS = 1813;
Expand Down
4 changes: 2 additions & 2 deletions Server/Source/player_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,7 @@ struct Player final : public IPlayer, public PoolIDProvider, public NoCopy

void giveWeapon(WeaponSlotData weapon) override
{
uint8_t slot = weapon.slot();
auto slot = weapon.slot();
if (slot == INVALID_WEAPON_SLOT)
{
// Fail.
Expand Down Expand Up @@ -1343,7 +1343,7 @@ struct Player final : public IPlayer, public PoolIDProvider, public NoCopy
void setWeaponAmmo(WeaponSlotData weapon) override
{
// Set from sync
uint8_t slot = weapon.slot();
auto slot = weapon.slot();
if (slot == INVALID_WEAPON_SLOT)
{
// Fail.
Expand Down
6 changes: 3 additions & 3 deletions Server/Source/player_pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ struct PlayerPool final : public IPlayerPool, public NetworkEventHandler, public

Player& player = static_cast<Player&>(peer);

uint8_t slot = WeaponSlotData(footSync.Weapon).slot();
auto slot = WeaponSlotData(footSync.Weapon).slot();
if (slot == INVALID_WEAPON_SLOT)
{
return false;
Expand Down Expand Up @@ -1112,7 +1112,7 @@ struct PlayerPool final : public IPlayerPool, public NetworkEventHandler, public
return false;
}

uint8_t slot = WeaponSlotData(vehicleSync.WeaponID).slot();
auto slot = WeaponSlotData(vehicleSync.WeaponID).slot();
if (slot == INVALID_WEAPON_SLOT)
{
return false;
Expand Down Expand Up @@ -1363,7 +1363,7 @@ struct PlayerPool final : public IPlayerPool, public NetworkEventHandler, public
return false;
}

uint8_t slot = WeaponSlotData(passengerSync.WeaponID).slot();
auto slot = WeaponSlotData(passengerSync.WeaponID).slot();
if (slot == INVALID_WEAPON_SLOT)
{
return false;
Expand Down
Loading