Skip to content

Fixes for a couple of issues #999

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

Merged
merged 13 commits into from
Mar 29, 2025
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
3 changes: 2 additions & 1 deletion Server/Components/Pawn/PluginManager/PluginManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct BrokenPluginMessageData
StringView message;
};

static const StaticArray<BrokenPluginMessageData, 23> BrokenPlugins = {
static const StaticArray<BrokenPluginMessageData, 24> BrokenPlugins = {
{
{ "YSF", "It requires memory hacking to run and is therefore broken on open.mp, we already added many built-in features from YSF to open.mp and the rest are coming" },
{ "YSF_DL", "It requires memory hacking to run and is therefore broken on open.mp, we already added many built-in features from YSF to open.mp and the rest are coming" },
Expand All @@ -38,6 +38,7 @@ static const StaticArray<BrokenPluginMessageData, 23> BrokenPlugins = {
{ "pawncmd", "There is an open.mp compatible version you can find here: https://github.com/katursis/Pawn.CMD/releases , make sure to download x.x.x-omp version." },
{ "sampvoice", "There is an open.mp compatible version you can find here: https://github.com/AmyrAhmady/sampvoice/releases , make sure to download x.x.x-omp version." },

{ "fmt", "It is not needed anymore since open.mp has support for formatted strings in various natives" },
{ "nativechecker", "It is not needed anymore since open.mp has built in native checking mechanism when a script is being loaded" },
{ "samp-compat", "It is not needed anymore since open.mp has built in compat mechanism between 0.3.7 and 0.3DL versions" },
{ "LFN", "It is not needed anymore since open.mp has support for longer function names, just compile your scripts with our compiler" },
Expand Down
19 changes: 18 additions & 1 deletion Server/Components/Pawn/Scripting/Core/Natives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
}
Expand All @@ -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))
Expand Down
15 changes: 14 additions & 1 deletion Server/Source/player_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,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
Expand Down Expand Up @@ -1691,7 +1701,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);
Expand All @@ -1705,6 +1715,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
Expand Down
13 changes: 8 additions & 5 deletions Server/Source/player_pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -871,12 +871,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;
Expand Down
Loading