diff --git a/Server/Components/Pawn/Scripting/Core/Natives.cpp b/Server/Components/Pawn/Scripting/Core/Natives.cpp index 163057c9b..022f020b5 100644 --- a/Server/Components/Pawn/Scripting/Core/Natives.cpp +++ b/Server/Components/Pawn/Scripting/Core/Natives.cpp @@ -270,6 +270,10 @@ SCRIPT_API(BlockIpAddress, bool(std::string const& ipAddress, int timeMS)) SCRIPT_API(UnBlockIpAddress, bool(std::string const& ipAddress)) { + if (ipAddress.empty()) + { + return false; + } BanEntry entry(ipAddress); for (INetwork* network : PawnManager::Get()->core->getNetworks()) { @@ -698,6 +702,10 @@ SCRIPT_API(SendRconCommand, bool(cell const* format)) if (console) { AmxStringFormatter command(format, GetAMX(), GetParams(), 1); + if (command.empty()) + { + return false; + } console->send(command); } return true; @@ -709,6 +717,10 @@ SCRIPT_API(SendRconCommandf, bool(cell const* format)) if (console) { AmxStringFormatter command(format, GetAMX(), GetParams(), 1); + if (command.empty()) + { + return false; + } console->send(command); } return true; @@ -723,6 +735,10 @@ SCRIPT_API(SetDeathDropAmount, bool(int amount)) SCRIPT_API(SetGameModeText, bool(cell const* format)) { AmxStringFormatter string(format, GetAMX(), GetParams(), 1); + if (string.empty()) + { + return false; + } PawnManager::Get()->core->setData(SettableCoreDataType::ModeText, string); return true; } @@ -746,7 +762,8 @@ SCRIPT_API(SetNameTagDrawDistance, bool(float distance)) SCRIPT_API(SetTeamCount, bool(int count)) { - throw pawn_natives::NotImplemented(); + PawnManager::Get()->core->logLn(LogLevel::Warning, "SetTeamCount() function is removed."); + return true; } SCRIPT_API(SetWeather, bool(int weatherid)) diff --git a/Server/Source/player_impl.hpp b/Server/Source/player_impl.hpp index 3c618f992..c629b8f2c 100644 --- a/Server/Source/player_impl.hpp +++ b/Server/Source/player_impl.hpp @@ -1342,6 +1342,16 @@ struct Player final : public IPlayer, public PoolIDProvider, public NoCopy PacketHelper::send(givePlayerWeaponRPC, *this); } } + NetCode::RPC::SetPlayerArmedWeapon setPlayerArmedWeaponRPC; + if (weaponid != armedWeapon_) + { + setPlayerArmedWeaponRPC.Weapon = armedWeapon_; + } + else + { + setPlayerArmedWeaponRPC.Weapon = 0; + } + PacketHelper::send(setPlayerArmedWeaponRPC, *this); } void setWeaponAmmo(WeaponSlotData weapon) override @@ -1716,7 +1726,7 @@ struct Player final : public IPlayer, public PoolIDProvider, public NoCopy { if (!allowWeapons_) { - // Give the player all their weapons back. Don't worry about the armed weapon. + // Give the player all their weapons back. allowWeapons_ = true; NetCode::RPC::ResetPlayerWeapons resetWeaponsRPC; PacketHelper::send(resetWeaponsRPC, *this); @@ -1730,6 +1740,9 @@ struct Player final : public IPlayer, public PoolIDProvider, public NoCopy PacketHelper::send(givePlayerWeaponRPC, *this); } } + NetCode::RPC::SetPlayerArmedWeapon setPlayerArmedWeaponRPC; + setPlayerArmedWeaponRPC.Weapon = armedWeapon_; + PacketHelper::send(setPlayerArmedWeaponRPC, *this); } } else diff --git a/Server/Source/player_pool.hpp b/Server/Source/player_pool.hpp index 31d4af8c1..e727145b3 100644 --- a/Server/Source/player_pool.hpp +++ b/Server/Source/player_pool.hpp @@ -870,12 +870,15 @@ struct PlayerPool final : public IPlayerPool, public NetworkEventHandler, public player.aimingData_.aspectRatio = (aimSync.AspectRatio * 1.f / 255) + 1.f; // Check for invalid camera modes - if (aimSync.CamMode < 0u || aimSync.CamMode > 65u) - aimSync.CamMode = 4u; - - // Fix for camera shaking hack // https://gtag.sannybuilder.com/sanandreas/camera-modes/ - if (aimSync.CamMode == 5u || aimSync.CamMode == 34u || (aimSync.CamMode >= 39u && aimSync.CamMode <= 43u) || aimSync.CamMode == 45u || aimSync.CamMode == 49u || aimSync.CamMode == 52u) + if (aimSync.CamMode < 3u || aimSync.CamMode == 5u || aimSync.CamMode == 6u + || (aimSync.CamMode >= 9u && aimSync.CamMode <= 13u) || aimSync.CamMode == 17u + || (aimSync.CamMode >= 19u && aimSync.CamMode <= 21u) + || (aimSync.CamMode >= 23u && aimSync.CamMode <= 28u) + || (aimSync.CamMode >= 30u && aimSync.CamMode <= 45u) + || (aimSync.CamMode >= 48u && aimSync.CamMode <= 50u) + || aimSync.CamMode == 52u || aimSync.CamMode == 54u + || aimSync.CamMode == 60u || aimSync.CamMode == 61u || aimSync.CamMode > 64u) aimSync.CamMode = 4u; aimSync.PlayerID = player.poolID;