Natives


This section contains documentation for SA-MP natives, as well as the additional UG-MP exclusive natives. We included SA-MP native documentation here because the SA-MP wiki is no longer online.

UG-MP natives
AddAnimatedClumpModel AddAtomicModel AddCdImage AddDataFile AddIDE AddIPL AddPedModel AddTimeModel AddVehicleModel ApplyMapOffsetToCoords ChangePlayerPedColor ChangeVehicleColorRGB ChangeVehiclePearlColor ChangeVehiclePearlColorRGB CreateExtraWeather DestroyExtraWeather EnableRadioAutoTune GetNumPedModels GetNumVehicleModels GetNumWeaponModels GetPlayerAircraftHeightLimit GetPlayerJetpackHeightLimit GetPlayerNetModelID GetPlayerPedColor GetRadioStationName GetRandomPedModel GetRandomVehicleModel GetRandomWeaponModel GetRandomWeaponType GetValidPedModelAt GetValidVehicleModelAt GetValidVehicleModelAtEx GetValidWeaponModelAt GetValidWeaponTypeAt GetVehicleComponentTypeEx GetVehicleRadioStation GetWeaponHighestParentType InitialiseDiscordRichPresence IsAClmpNetModelValidForPlayer IsAtmModelValidForPlayer IsPedModelValidForPlayer IsRadioAutoTuneEnabled IsRubbishVisibleForPlayer IsSASunPositionFormulaEnabled IsTimeModelValidForPlayer IsValidAnimationAndLibrary IsValidPedModel IsValidVehicleModel IsValidWeaponModel IsValidWeaponType IsVehicleModelValidForPlayer MT19937_Random OnAddModelCompleted OnLaserDotUpdate OnPlayerChangeRadio OnPlayerFinishedDownloading OnPlayerStartedDownloading OnVehicleResprayAtGarage RedirectDownloadsTo SetAircraftHeightLimitForPlayer SetCurrentSeason SetExtraWeatherParam_Flags SetExtraWeatherParam_Float SetExtraWeatherParam_Int SetExtraWeatherParam_RGB SetExtraWeatherParam_RGBA SetExtraWeatherParam_Windyness SetJetpackHeightLimitForPlayer SetPlayerFireProof SetPlayerHUDComponentsColour SetPlayerKnockedOffBikeState SetPlayerSeason SetVehicleRadioStation ShutdownDiscordRichPresence ToggleFluffyClouds ToggleLowClouds ToggleMoon TogglePlayerCCTV TogglePlayerDarknessFilter TogglePlayerFluffyClouds TogglePlayerFogOverlay TogglePlayerGrass TogglePlayerHUDComponents TogglePlayerInfiniteSprint TogglePlayerInfraRed TogglePlayerLowClouds TogglePlayerMoon TogglePlayerNightVision TogglePlayerRainbow TogglePlayerRubbish TogglePlayerStars TogglePlayerSun TogglePlayerVideoCameraOverlay ToggleRainbow ToggleSASunPositionFormula ToggleSASunPositionFormula_Pl ToggleStars ToggleVehicleColorRGB UpdateDiscordRichPresence
SA-MP natives
AddMenuItem AddPlayerClass AddPlayerClassEx AddStaticPickup AddStaticVehicle AddStaticVehicleEx AddVehicleComponent AllowAdminTeleport AllowInteriorWeapons AllowPlayerTeleport ApplyActorAnimation ApplyAnimation Attach3DTextLabelToPlayer Attach3DTextLabelToVehicle AttachCameraToObject AttachCameraToPlayerObject AttachObjectToObject AttachObjectToPlayer AttachObjectToVehicle AttachPlayerObjectToPlayer AttachPlayerObjectToVehicle AttachTrailerToVehicle Ban BanEx BlockIpAddress CallLocalFunction CallRemoteFunction CancelEdit CancelSelectTextDraw ChangeVehicleColor ChangeVehiclePaintjob ClearActorAnimations ClearAnimations ConnectNPC Create3DTextLabel CreateActor CreateExplosion CreateExplosionForPlayer CreateMenu CreateObject CreatePickup CreatePlayer3DTextLabel CreatePlayerObject CreatePlayerTextDraw CreateVehicle Delete3DTextLabel DeletePVar DeletePlayer3DTextLabel DeleteSVar DestroyActor DestroyMenu DestroyObject DestroyPickup DestroyPlayerObject DestroyVehicle DetachTrailerFromVehicle DisableInteriorEnterExits DisableMenu DisableMenuRow DisableNameTagLOS DisablePlayerCheckpoint DisablePlayerRaceCheckpoint DisableRemoteVehicleCollisions EditAttachedObject EditObject EditPlayerObject EnablePlayerCameraTarget EnableStuntBonusForAll EnableStuntBonusForPlayer EnableTirePopping EnableVehicleFriendlyFire EnableZoneNames ForceClassSelection GameModeExit GameTextForAll GameTextForPlayer GangZoneCreate GangZoneDestroy GangZoneFlashForAll GangZoneFlashForPlayer GangZoneHideForAll GangZoneHideForPlayer GangZoneShowForAll GangZoneShowForPlayer GangZoneStopFlashForAll GangZoneStopFlashForPlayer GetActorFacingAngle GetActorHealth GetActorPoolSize GetActorPos GetActorVirtualWorld GetAnimationName GetConsoleVarAsBool GetConsoleVarAsInt GetConsoleVarAsString GetGravity GetMaxPlayers GetNetworkStats GetObjectModel GetObjectPos GetObjectRot GetPVarFloat GetPVarInt GetPVarNameAtIndex GetPVarString GetPVarType GetPVarsUpperIndex GetPlayerAmmo GetPlayerAnimationIndex GetPlayerArmour GetPlayerCameraAspectRatio GetPlayerCameraFrontVector GetPlayerCameraMode GetPlayerCameraPos GetPlayerCameraTargetActor GetPlayerCameraTargetObject GetPlayerCameraTargetPlayer GetPlayerCameraTargetVehicle GetPlayerCameraZoom GetPlayerColor GetPlayerDistanceFromPoint GetPlayerDrunkLevel GetPlayerFacingAngle GetPlayerFightingStyle GetPlayerHealth GetPlayerInterior GetPlayerIp GetPlayerKeys GetPlayerLastShotVectors GetPlayerMenu GetPlayerMoney GetPlayerName GetPlayerNetworkStats GetPlayerObjectModel GetPlayerObjectPos GetPlayerObjectRot GetPlayerPing GetPlayerPoolSize GetPlayerPos GetPlayerScore GetPlayerSkin GetPlayerSpecialAction GetPlayerState GetPlayerSurfingObjectID GetPlayerSurfingVehicleID GetPlayerTargetActor GetPlayerTargetPlayer GetPlayerTeam GetPlayerTime GetPlayerVehicleID GetPlayerVehicleSeat GetPlayerVelocity GetPlayerVersion GetPlayerVirtualWorld GetPlayerWantedLevel GetPlayerWeapon GetPlayerWeaponData GetPlayerWeaponState GetSVarFloat GetSVarInt GetSVarNameAtIndex GetSVarString GetSVarType GetSVarsUpperIndex GetServerTickRate GetServerVarAsBool GetServerVarAsInt GetServerVarAsString GetTickCount GetVehicleComponentInSlot GetVehicleComponentType GetVehicleDamageStatus GetVehicleDistanceFromPoint GetVehicleHealth GetVehicleModel GetVehicleModelInfo GetVehicleParamsCarDoors GetVehicleParamsCarWindows GetVehicleParamsEx GetVehicleParamsSirenState GetVehiclePoolSize GetVehiclePos GetVehicleRotationQuat GetVehicleTrailer GetVehicleVelocity GetVehicleVirtualWorld GetVehicleZAngle GetWeaponName GivePlayerMoney GivePlayerWeapon HTTP HideMenuForPlayer InterpolateCameraLookAt InterpolateCameraPos IsActorInvulnerable IsActorStreamedIn IsObjectMoving IsPlayerAdmin IsPlayerAttachedObjectSlotUsed IsPlayerConnected IsPlayerInAnyVehicle IsPlayerInCheckpoint IsPlayerInRaceCheckpoint IsPlayerInRangeOfPoint IsPlayerInVehicle IsPlayerNPC IsPlayerObjectMoving IsPlayerStreamedIn IsTrailerAttachedToVehicle IsValidActor IsValidObject IsValidPlayerObject IsValidVehicle IsVehicleStreamedIn Kick KillTimer LimitGlobalChatRadius LimitPlayerMarkerRadius LinkVehicleToInterior ManualVehicleEngineAndLights MoveObject MovePlayerObject NPC:GetDistanceFromMeToPoint NPC:GetMyFacingAngle NPC:GetMyPos NPC:GetPlayerArmedWeapon NPC:GetPlayerHealth NPC:IsPlayerStreamedIn NPC:IsVehicleStreamedIn NPC:OnClientMessage NPC:OnNPCConnect NPC:OnNPCDisconnect NPC:OnNPCEnterVehicle NPC:OnNPCExitVehicle NPC:OnNPCModeExit NPC:OnNPCModeInit NPC:OnNPCSpawn NPC:OnPlayerDeath NPC:OnPlayerStreamIn NPC:OnPlayerStreamOut NPC:OnPlayerText NPC:OnRecordingPlaybackEnd NPC:OnVehicleStreamIn NPC:OnVehicleStreamOut NPC:PauseRecordingPlayback NPC:ResumeRecordingPlayback NPC:SendChat NPC:SendCommand NPC:SetMyFacingAngle NPC:SetMyPos NPC:StartRecordingPlayback NPC:StopRecordingPlayback NetStats_BytesReceived NetStats_BytesSent NetStats_ConnectionStatus NetStats_GetConnectedTime NetStats_GetIpPort NetStats_MessagesReceived NetStats_MessagesRecvPerSecond NetStats_MessagesSent NetStats_PacketLossPercent OnActorStreamIn OnActorStreamOut OnClientCheckResponse OnDialogResponse OnEnterExitModShop OnFilterScriptExit OnFilterScriptInit OnGameModeExit OnGameModeInit OnIncomingConnection OnObjectMoved OnPlayerClickMap OnPlayerClickPlayer OnPlayerClickPlayerTextDraw OnPlayerClickTextDraw OnPlayerCommandText OnPlayerConnect OnPlayerDeath OnPlayerDisconnect OnPlayerEditAttachedObject OnPlayerEditObject OnPlayerEnterCheckpoint OnPlayerEnterRaceCheckpoint OnPlayerEnterVehicle OnPlayerExitVehicle OnPlayerExitedMenu OnPlayerGiveDamage OnPlayerGiveDamageActor OnPlayerInteriorChange OnPlayerKeyStateChange OnPlayerLeaveCheckpoint OnPlayerLeaveRaceCheckpoint OnPlayerObjectMoved OnPlayerPickUpPickup OnPlayerRequestClass OnPlayerRequestSpawn OnPlayerSelectObject OnPlayerSelectedMenuRow OnPlayerSpawn OnPlayerStateChange OnPlayerStreamIn OnPlayerStreamOut OnPlayerTakeDamage OnPlayerText OnPlayerUpdate OnPlayerWeaponShot OnRconCommand OnRconLoginAttempt OnTrailerUpdate OnUnoccupiedVehicleUpdate OnVehicleDamageStatusUpdate OnVehicleDeath OnVehicleMod OnVehiclePaintjob OnVehicleRespray OnVehicleSirenStateChange OnVehicleSpawn OnVehicleStreamIn OnVehicleStreamOut PlayAudioStreamForPlayer PlayCrimeReportForPlayer PlayerPlaySound PlayerSpectatePlayer PlayerSpectateVehicle PlayerTextDrawAlignment PlayerTextDrawBackgroundColor PlayerTextDrawBoxColor PlayerTextDrawColor PlayerTextDrawDestroy PlayerTextDrawFont PlayerTextDrawHide PlayerTextDrawLetterSize PlayerTextDrawSetOutline PlayerTextDrawSetPreviewModel PlayerTextDrawSetPreviewRot PlayerTextDrawSetPreviewVehCol PlayerTextDrawSetProportional PlayerTextDrawSetSelectable PlayerTextDrawSetShadow PlayerTextDrawSetString PlayerTextDrawShow PlayerTextDrawTextSize PlayerTextDrawUseBox PutPlayerInVehicle RemoveBuildingForPlayer RemovePlayerAttachedObject RemovePlayerFromVehicle RemovePlayerMapIcon RemoveVehicleComponent RepairVehicle ResetPlayerMoney ResetPlayerWeapons SHA256_PassHash SelectObject SelectTextDraw SendClientMessage SendClientMessageToAll SendDeathMessage SendDeathMessageToPlayer SendPlayerMessageToAll SendPlayerMessageToPlayer SendRconCommand SetActorFacingAngle SetActorHealth SetActorInvulnerable SetActorPos SetActorVirtualWorld SetCameraBehindPlayer SetDeathDropAmount SetDisabledWeapons SetGameModeText SetGravity SetMenuColumnHeader SetNameTagDrawDistance SetObjectMaterial SetObjectMaterialText SetObjectNoCameraCol SetObjectPos SetObjectRot SetObjectsDefaultCameraCol SetPVarFloat SetPVarInt SetPVarString SetPlayerAmmo SetPlayerArmedWeapon SetPlayerArmour SetPlayerAttachedObject SetPlayerCameraLookAt SetPlayerCameraPos SetPlayerChatBubble SetPlayerCheckpoint SetPlayerColor SetPlayerDrunkLevel SetPlayerFacingAngle SetPlayerFightingStyle SetPlayerHealth SetPlayerInterior SetPlayerMapIcon SetPlayerMarkerForPlayer SetPlayerName SetPlayerObjectMaterial SetPlayerObjectMaterialText SetPlayerObjectNoCameraCol SetPlayerObjectPos SetPlayerObjectRot SetPlayerPos SetPlayerPosFindZ SetPlayerRaceCheckpoint SetPlayerScore SetPlayerShopName SetPlayerSkillLevel SetPlayerSkin SetPlayerSpecialAction SetPlayerTeam SetPlayerTime SetPlayerVelocity SetPlayerVirtualWorld SetPlayerWantedLevel SetPlayerWeather SetPlayerWorldBounds SetSVarFloat SetSVarInt SetSVarString SetSpawnInfo SetTeamCount SetTimer SetTimerEx SetVehicleAngularVelocity SetVehicleHealth SetVehicleNumberPlate SetVehicleParamsCarDoors SetVehicleParamsCarWindows SetVehicleParamsEx SetVehicleParamsForPlayer SetVehiclePos SetVehicleToRespawn SetVehicleVelocity SetVehicleVirtualWorld SetVehicleZAngle SetWeather SetWorldTime ShowMenuForPlayer ShowNameTags ShowPlayerDialog ShowPlayerMarkers ShowPlayerNameTagForPlayer SpawnPlayer StartRecordingPlayerData StopAudioStreamForPlayer StopObject StopPlayerObject StopRecordingPlayerData TextDrawAlignment TextDrawBackgroundColor TextDrawBoxColor TextDrawColor TextDrawCreate TextDrawDestroy TextDrawFont TextDrawHideForAll TextDrawHideForPlayer TextDrawLetterSize TextDrawSetOutline TextDrawSetPreviewModel TextDrawSetPreviewRot TextDrawSetPreviewVehCol TextDrawSetProportional TextDrawSetSelectable TextDrawSetShadow TextDrawSetString TextDrawShowForAll TextDrawShowForPlayer TextDrawTextSize TextDrawUseBox TogglePlayerClock TogglePlayerControllable TogglePlayerSpectating UnBlockIpAddress Update3DTextLabelText UpdatePlayer3DTextLabelText UpdateVehicleDamageStatus UsePlayerPedAnims VectorSize acos asin atan atan2 clamp db_close db_debug_openfiles db_debug_openresults db_field_name db_free_result db_get_field db_get_field_assoc db_get_field_assoc_float db_get_field_assoc_int db_get_field_float db_get_field_int db_get_mem_handle db_get_result_mem_handle db_next_row db_num_fields db_num_rows db_open db_query deleteproperty existproperty fblockread fblockwrite fclose fexist fgetchar flength float floatabs floatadd floatcmp floatcos floatdiv floatfract floatlog floatmul floatpower floatround floatsin floatsqroot floatstr floatsub floattan fopen format fputchar fread fremove fseek ftemp funcidx fwrite getarg getdate getproperty gettime gpci heapspace ispacked max memcpy numargs print printf random setarg setproperty settime settimer strcat strcmp strdel strfind strins strlen strmid strpack strunpack strval tickcount tolower toupper uudecode uuencode valstr

ApplyAnimation

Apply an animation to a player.
Parameters
Name Description
int playerid The ID of the player to apply the animation to.
string animlib[] The animation library from which to apply an animation.
string animname[] The name of the animation to apply, within the specified library.
float fDelta The speed to play the animation (use 4.1).
bool loop If set to 1, the animation will loop. If set to 0, the animation will play once.
bool lockx If set to 0, the player is returned to their old X coordinate once the animation is complete (for animations that move the player such as walking). 1 will not return them to their old position.
bool locky Same as above but for the Y axis. Should be kept the same as the previous parameter.
bool freeze Setting this to 1 will freeze the player at the end of the animation. 0 will not.
int time Timer in milliseconds. For a never-ending loop it should be 0.
int forcesync Set to 1 to make server sync the animation with all other players in streaming radius (optional). 2 works same as 1, but will ONLY apply the animation to streamed-in players, but NOT the actual player being animated (useful for npc animations and persistent animations when players are being streamed)
Return value
bool
This function always returns 1, even if the player specified does not exist, or any of the parameters are invalid (e.g. invalid library).
Related functions

The following functions and/or callbacks might be useful, as they're related to this one in one way or another.

  • ClearAnimations: Clears all animations for the given player (it also cancels all current tasks such as jetpacking,parachuting,entering vehicles, driving (removes player out of vehicle), swimming, etc.. ).
  • SetPlayerSpecialAction: This function allows to set players special action.
Warninig: The 'forcesync' optional parameter, which defaults to 0, in most cases is not needed since players sync animations themselves. The 'forcesync' parameter can force all players who can see 'playerid' to play the animation regardless of whether the player is performing that animation. This is useful in circumstances where the player can't sync the animation themselves. For example, they may be paused.
Important: An invalid animation library will crash the player's game.