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

SetPlayerKnockedOffBikeState

This native can be used to make sure a player does not fall off a bike, which may be very useful during cutscenes.
Parameters
Name Description
int playerid The player ID.
int knockState The 'behavior type' which should be set for this player. This parameter can be one of the following values:

BIKE_KNOCK_OFF_DEFAULT - The player can be knocked off a bike by crashing, or whatever. The difference between BIKE_KNOCK_OFF_ALWAYS and BIKE_KNOCK_OFF_DEFAULT is that with the default value used mission peds aren't knocked off their bike as often, but with BIKE_KNOCK_OFF_ALWAYS mission peds can be knocked off their bike just as easily as normal peds.
BIKE_KNOCK_OFF_NEVER - Never allow a player to be knocked off a bike, even when crashing into a wall at full speed.
BIKE_KNOCK_OFF_ALWAYS - See the description for BIKE_KNOCK_OFF_DEFAULT
Return value

None

Related functions

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

  • SetPlayerFireProof: This native can be used to make a player fireproof. By default, all players receive fire damage.
  • TogglePlayerInfiniteSprint: Enables or disables infinite stamina for a single player. Infinite sprint is disabled for all players by default.
Note: Since SA-MP internally uses the GTA:SA scripting code for a lot of its natives it is safe to assume that all SA-MP peds may be considered as mission peds, but this is unconfirmed. This assumption is why there are three 'behavior types' you can use instead of a simple boolean parameter, and this native will probably be changed should this assumption be incorrect.