samp.directory
← Scripts e bibliotecas

pawn-lang/sa-mp-fixes

Includes and plugins to fix various issues in the SA:MP server that can be fixed externally, leaving the devs time for other things.

Biblioteca★ 149atualizado mar. de 2024Sem licençaPawnsampctl
Abrir no GitHub

Este repositório não tem arquivo de licença. Ele é público para leitura, mas isso sozinho não dá permissão para reutilizar.

Instalar com o sampctl

sampctl package install pawn-lang/sa-mp-fixes

Execute na pasta do seu projeto. O sampctl baixa o pacote e as dependências dele.

Depende de 1 pacote

README.md

fixes.inc

Community patches for buggy SA:MP functions.

Introduction

SA:MP is beta software written by a small team in their spare time, thus it has bugs (as does all software). Some of these have been known for a long time but are low priority due to their minor effects, others go undiscovered for a long time. Many of these bugs have solutions which can be implemented in PAWN (and this may be simpler than implementing them in the SA:MP source code). This include aims to collect fixes for as many of these bugs as possible from the community (i.e. anyone who has a fix) together in to one easy to use place for everyone's benefit.

Use

This library is a single-file include. The only required part is:

https://raw.githubusercontent.com/pawn-lang/sa-mp-fixes/master/fixes.inc

Save this file as pawno/include/fixes.inc then include it after the default SA:MP functions, but before third party includes:

#include <a_samp>
// Any default re-definitions should go here.
//#undef MAX_PLAYERS
//#define MAX_PLAYERS 10
#include <fixes>

#include <other>

To disable any fix for whatever reason simply do:

#define FIX_<name> 0

For example, to disable all the file.inc fixes if you always correctly check the file handle, do:

#include <a_samp>
#define FIX_file_inc 0
#include <fixes>
#include <other>

All the names of the fixes are single words, and are all listed with their fix descriptions below.

If you only have one script running on your server (i.e. no FilterScripts), you can use this define to improve the fixes.inc code:

#include <a_samp>
#define FIXES_Single 1
#include <fixes>
#include <other>

See below for more configuration settings.

If you use sampctl the inclusion path to go under dependencies is:

"pawn-lang/sa-mp-fixes"

You can also download the entire repo using git, and will get a more complete experience, including better warnings and this documentation.

Fix Options

NameProblemSolutionAuthor(s)Post(s)Notes
GetPlayerColorReturns "0" if "SetPlayerColor" has never been called.Call "SetPlayerColor" in "OnPlayerConnect".KoczkaHUN
FILTERSCRIPTDespite the fact that is in every new script, many people dont' define "FILTERSCRIPT" where appropriate.Provide an "IS_FILTERSCRIPT" variable (note the naming to match the original macro).Y_Less
SpawnPlayerKills the player if they are in a vehicle.Remove player from the vehicle.Y_Less
SetPlayerNameUsing "SetPlayerName" when the new name only differs from the old name in case does not alter the name at all.Change their name twice - once to "_FIXES TEMP NAME" and then to the actual required name.Y_Less Slice simonepri
GetPlayerSkinReturns the new skin after "SetSpawnInfo" is called but before the player actually respawns to get the new skin.Record the skin in "OnPlayerSpawn" and always return that one.Y_Less
GetWeaponNameReturns nothing for 18, 44, and 45.Return the correct names (Molotov Cocktail, Thermal Goggles, and Night vision Goggles).Y_LessFixed in 0.3.7
SetPlayerWorldBoundsAiming can bypass the edge.Check for the player leaving the area and reset them to their last good position if they leave the area (aiming or not).Y_Less
TogglePlayerControllableOther players see you moving on the spot.Return 0 in OnPlayerUpdate.SliceLink
HydraSniperEntering military aircraft with a sniper rifle messes up views.Set their armed weapon to fists.funky1234Link
IsPlayerInCheckpointFunction returns an undefined value if it is called before any other checkpoint functions are called to initialise the value.Call "DisablePlayerCheckpoint" when they connect.Y_Less
IsPlayerInRaceCheckpointFunction returns an undefined value if it is called before any other race checkpoint functions are called to initialise the value.Call "DisablePlayerRaceCheckpoint" when they connect.Y_Less
GetPlayerWeaponReturns the old value after entering in a vehicle.If "SetPlayerArmedWeapon" and other similar functions is called in a vehicle, store the new value and return that instead.Y_Less ronixtey
PutPlayerInVehicleIf this is used on a passenger the driver of their old vehicle doesn't see them in their new vehicle.Remove them from the vehicle first.leong124 Y_LessLink
KEY_AIM"KEY_AIM" isn't defined by default.Define it.Y_Less
SetPlayerCheckpointIf a checkpoint is already set it will use the size of that checkpoint instead of the new one.Call "DisablePlayerCheckpoint" before setting the checkpoint.ziggi
SetPlayerRaceCheckpointIf a checkpoint is already set it will use the size of that checkpoint instead of the new one.Call "DisablePlayerRaceCheckpoint" before setting the checkpoint.ziggi
TextDrawCreateCrashes on a blank string.Intercept blank strings.wups
TextDrawCreate_2If the last character in the text is a space (" "), the text will all be blank.Remove space characters from the end of the string.ziggiLink
TextDrawSetStringCrashes on a blank string and size greater than 1024.Intercept blank strings and truncate long strings.TomTrox
TextDrawSetString_2If the last character in the text is a space (" "), the text will all be blank.Remove space characters from the end of the string.ziggiLink
CreatePlayerTextDrawCrashes on a blank string.Intercept blank strings.wups Y_Less
CreatePlayerTextDraw_2If the last character in the text is a space (" "), the text will all be blank.Remove space characters from the end of the string.ziggiLink
PlayerTextDrawSetStringCrashes on a blank string and size greater than 1024.Intercept blank strings and truncate long strings.TomTrox Y_Less
PlayerTextDrawSetString_2If the last character in the text is a space (" "), the text will all be blank.Remove space characters from the end of the string.ziggiLink
AllowInteriorWeaponsDoes nothing.Set the player's weapon to fists in an interior.KoczkaHUN
OnPlayerEnterVehicleCrashes other players when people enter an invalid seat.Desync the people with invalid seats.RyDeR` Y_LessLink
OnPlayerEnterVehicle_2Crashes the server when hacks enter an invalid vehicle.Desync the people with invalid vehicles.Y_Less
OnPlayerEnterVehicle_3No player animation when trying to enter the driver door of a locked vehicleLeave the door unlocked and activate an animation when the player attemps to enter a 'locked' vehicle.ziggi rt-2Link
AllowTeleport0.3dRC9 removed "AllowPlayerTeleport" and "AllowAdminTeleport" in favour of "OnPlayerClickMap". Some scripts used the old code and.Teleport the player in "OnPlayerClickMap".Y_Less
SetPlayerSpecialActionRemoving jetpacks from players by setting their special action to 0 causes the sound to stay until death.Call "ClearAnimations" before "SetPlayerSpecialAction".MP2
OnDialogResponseCheaters can spoof the dialogid they are using to respond to ones they can't actually see.Store the displayed dialogid and use that instead.Y_LessFixed in 0.3e RC6
GetPlayerDialogThis function doesn't exist. Fixed for hidden dialogs.Add it.Y_Less simonepriDisabled By Default
PlayerDialogResponseA player's dialog doesn't hide when the gamemode restarts, causing the server to print "Warning: PlayerDialogResponse PlayerId: 0 dialog ID doesn't match last sent dialog ID".Hide it.simonepri
SetSpawnInfoKicks the player if "SpawnPlayer" is called before "SetSpawnInfo".Call "SetSpawnInfo" at least once.Y_Less
SetPlayerSkinBreaks sitting on bikes.Put them back in the vehicle after setting their skin.CyNiCLink
HideMenuForPlayerCrashes when passed an invalid menu ID.Don't hide it when passed an invalid menu.Y_LessLink
valstrCrashes on large numbers.Use "format" instead.Slice
fcloseCrashes on an invalid handle.Check for an invalid handle.Slice
fwriteCrashes on an invalid handle.Check for an invalid handle.Slice
freadCrashes on an invalid handle.Check for an invalid handle.Slice
fputcharCrashes on an invalid handle.Check for an invalid handle.Slice
fgetcharCrashes on an invalid handle.Check for an invalid handle.Slice
fblockwriteCrashes on an invalid handle.Check for an invalid handle.Slice
fblockreadCrashes on an invalid handle.Check for an invalid handle.Slice
fseekCrashes on an invalid handle.Check for an invalid handle.Slice
flengthCrashes on an invalid handle.Check for an invalid handle.Slice
file_incIncludes or excludes all the file function fixes together (can cause major overhead).Optionally group them all under one define.Y_LessDisabled By Default
SetPlayerAttachedObjectDoesn't remove objects when the mode ends.Remove them.Y_Less
OnPlayerDeathClients get stuck when they die with an animation applied.Clear their animations.h02Link
strinsIgnores the "maxlength" parameter causing possible crashes.Manually check the length.Slice Y_Less
IsPlayerConnectedOnly uses the lower two bytes of a passed ID.Mask the numbers.Slice
TrainExitWhen getting out of a train entered by "PutPlayerInVehicle", the camera does not reset properly.Reset the camera.Terminator3 Y_Less
KickCalling "Kick" in "OnPlayerConnect" doesn't work properly.Defer it.Y_LessLinkFixed in 0.3x
OnVehicleModCrashes other players when invalid mods are applied.Desync the player.JernejL Y_LessLink
randomDoesn't work with negative numbers.Invert then reinvert.simonepriDisabled By Default
sleepLeaks bytes from the stack.Call a function to store the correct value.Y_Less
AddMenuItemCrashes when passed an invalid menu ID.Don't hide it when passed an invalid menu.Y_Less
SetMenuColumnHeaderCrashes when passed an invalid menu ID.Don't hide it when passed an invalid menu.Y_Less
ShowMenuForPlayerCrashes when passed an invalid menu ID.Don't hide it when passed an invalid menu.Y_Less
HideMenuForPlayerCrashes when passed an invalid menu ID.Don't hide it when passed an invalid menu.Y_LessLink
HideMenuForPlayer_2Ignores the "menuid" parameter.Only hide the correct menu.Y_LessDisabled By Default
DisableMenuCrashes when passed an invalid menu ID.Don't hide it when passed an invalid menu.Y_Less
DisableMenuRowCrashes when passed an invalid menu ID.Don't hide it when passed an invalid menu.Y_Less
MenusAll menu function fixes are included separately for major overhead.Optionally group them all under one define.Y_Less
GetPlayerMenuReturns previous menu when none is displayed.Return the correct value.Y_Less
GetPlayerInteriorAlways returns 0 for NPCs.Return the correct value.Y_Less simonepri
ClearAnimationsUse ClearAnimation while you are in a vehicle cause the player exit from it.Apply an animation instead of clear animation.simonepri
ClearAnimations_2ClearAnimations doesn't do anything when the animation ends if we pass 1 for the freeze parameter in ApplyAnimation.Apply an idle animation for stop and then use ClearAnimation.simonepri
DriveByIf you press KEY_CROUCH while you're passenger and if you are armed, the player start to aim; if you repress KEY_CROUCH the player don't return in vehicle.Apply the animation to return the player in the vehicle.simonepri
SilentTeleportIf a vehicle teleports either by SetVehiclePos or enters an original samp interior if someone tries to enter it he will teleport silently along.Using 'ClearAnimation' to stop the player before the teleport happens.RogueDrifterLink
GangZoneCreateGang zones bug on the main map for players at certain angles relative to them.Set a non floating value for the gang zone co-ordinate.simonepri Y_Less
SPECIAL_ACTION_PISSING"SPECIAL_ACTION_PISSING" isn't defined by default.Define it.simonepri
IsValidVehicle"IsValidVehicle" isn't defined by default.Define it.simonepri
ApplyAnimationPassing an invalid animation library in ApplyAnimation causes a client crash for streamed in players.Block ApplyAnimation when an invalid library is passed.simonepri
ApplyAnimation_2First time a library is used, it does nothing.Apply animations twice when first using a library.simonepri Lordzy Y_Less
ApplyActorAnimationPassing an invalid animation library in ApplyAnimation causes a client crash for streamed in players.Block ApplyActorAnimation when an invalid library is passed.simonepri ziggi
ApplyActorAnimation_2First time a library is used, it does nothing.Apply animations twice when first using a library.simonepri Lordzy Y_Less ziggi
OnPlayerSpawnSan Andreas deducts $100 from players.Reset the player's money to what it was before they died.Y_Less
GetGravity"GetGravity" isn't defined by default.Define it.WhitetigerLink
gpci"gpci" isn't defined by default.Define it.simonepriLink
NativesSeveral natives are included by default, this enables or disables them all. Therefore this is an umbrella fix for several fixes.Define them.Y_Less
OnPlayerConnectThis function isn't called for players when a filterscript starts.Call it for all connected players.Y_Less
OnPlayerDisconnectThis function isn't called for players when a filterscript ends.Call it for all connected players.Y_Less
GameTextSeveral styles do not display for the time specified.Recreate the styles in Text Draws and use those instead.Y_Less
GameTextStylesSan Andreas has fixed styles for area and vehicle names, but they are not included in the GameText styles list.Add them.Y_LessDisabled By Default
HideGameTextThere is no "HideGameTextForXYZ" function.Show a single space for a game text.Y_Less
ClearPlayerWorldBoundsThere is no "ClearPlayerWorldBounds" function.Put the world bounds back to the default.Y_Less
GetPlayerWorldBoundsThere is no "GetPlayerWorldBounds" function.Store them and retrieve them.Y_Less
WEAPONSSome weapons are not defined by default.Define it.ziggi
BODYPARTSThe bodyparts to be used in OnPlayer(Take/Give)Damage are not defined by defaultDefine it.Whitetiger
CAMERAMODESThe camera modes for GetPlayerCameraMode are not defined by default.Define it.WhitetigerLink
SetPlayerCameraUsing the camera functions directly after enabling spectator mode doesn't work.Defer them.Emmet_
SetPlayerTimeUsing this function under "OnPlayerConnect" doesn't work.Defer it.Emmet_
OnPlayerRequestClassRandom blunts and bottles sometimes appear in class selection.Call "RemoveBuildingForPlayer".Y_Less
SetPlayerColorIf used under OnPlayerConnect, the affecting player will not see the color in the TAB menu.Defer it.Emmet_[Link](https:

Ler o resto no GitHub

crutchfixesgtagtasahacktoberfestpawnpawn-packagesampsanandreasscript

Esta página é montada com o que o GitHub publica sobre o repositório. O samp.directory não hospeda o código. Avisar de um problema com esta página

pawn-lang/sa-mp-fixes: Biblioteca de SA-MP | samp.directory