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 UpdateDiscordRichPresenceSA-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 valstrAddPedModel
Adds a ped model for all players. The parameters of this native correspond with raw IDE:peds entries.
Parameters
Name | Description |
---|---|
int modelid | The model ID. |
string modelname | The model name. |
string txdname | The name of the TXD to use. |
string pedstatname | The ped stat name to use. |
int pedtype | The ped type. Certain types have different behavior on singleplayer. |
string animgrpname | The anim group to use for this ped. This can be used to give the ped a custom walking style, for example. |
string animfilename | The anim file to use for this ped. This can be used to give the ped a custom walking style, for example. |
int carmask | The "cars can drive..." mask. See the notes for more info. |
int flags | The ped flags. See the notes for more info. |
int radio1 | The primary preferred radio to use. See the notes for more info. |
int radio2 | The secondary preferred radio to use. See the notes for more info. |
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.
- AddAtomicModel: Adds a normal model for all players. The parameters of this native correspond with raw IDE:objs entries.
- AddTimeModel: Adds a timed model for all players. The parameters of this native correspond with raw IDE:tobj entries.
- AddAnimatedClumpModel: Adds an animated clump model for all players. The parameters of this native correspond with raw IDE:anim entries.
- AddVehicleModel: Adds a vehicle model for all players. The parameters of this native correspond with raw IDE:cars entries.
- OnAddModelCompleted: Callback which fires whenever a server-side model is fully set up and a valid model ID is stored for the player.
Tip: This function was added in Snapshot 4.2 and will not work in earlier versions!
Important: Make sure you update assets.json so players will have to download the files first! Failing to do so (and proceeding to use the assets in your script) can easily result in crashes if you're not careful.
Warninig: In order to guarantee added peds get synchronized properly, dynamic allocation of model IDs is not supported. You must use a static model ID instead.
Warninig: The animation group and animation file are linked to one another and you will need to use a suitable animation file when choosing a specific animation group.
Note: Use 120C as a car mask as it has no impact on UG-MP since there is no NPC traffic.
Note: You don't have to set any ped flags. None of them have any impact on UG-MP due to no NPC traffic.
Note: Certain peds have a preferred radio station the game will choose. Use 0 as this only takes effect when there is NPC traffic.