Scripting Functions
This page contains an overview of the hundreds of functions available in San Andreas: Multiplayer. All functions have received their own page with extended information about the function, the required parameters, possible usage and other functions you might want to look at.
Functions get added with every new release of San Andreas: Multiplayer. The SA-MP Server Plugins can also add a lot of extra functions to the multiplayer mod, click on the link for more information about the server plugins. There currently are 438 native functions available.
Scroll down for a full list of functions ordered alphabetically.
3D Text Labels
- Attach3DTextLabelToPlayer - Attach a 3D text label to a player.
- Attach3DTextLabelToVehicle - Attach a 3D text label to a vehicle.
- Create3DTextLabel - Create a 3D text label.
- CreatePlayer3DTextLabel - Create a 3D text label for one player.
- Delete3DTextLabel - Delete a 3D text label.
- DeletePlayer3DTextLabel - Delete a player's 3D text label.
- Update3DTextLabelText - Update the text and color of a 3D label.
- UpdatePlayer3DTextLabelText - Update the text and color of a player's 3D label.
Actors
- CreateActor - Create a static 'actor' in the world.
- DestroyActor - Destroy an actor which was created with CreateActor.
- GetActorPos - Get the position of an actor.
- SetActorPos - Set the position of an actor.
- GetActorFacingAngle - Get the facing angle of an actor.
- SetActorFacingAngle - Set the facing angle of an actor.
- GetActorVirtualWorld - Get the virtual world of an actor.
- SetActorVirtualWorld - Set the virtual world of an actor.
- ApplyActorAnimation - Apply an animation to an actor.
- ClearActorAnimations - Clear any animations applied to an actor.
- GetPlayerCameraTargetActor - Allows you to retrieve the ID of the actor the player is looking at (in any).
- IsActorStreamedIn - Checks if an actor is streamed in for a player.
- GetActorHealth - Get the health of an actor.
- SetActorHealth - Set the health of an actor.
- SetActorInvulnerable - Toggle an actor's invulnerability.
- IsActorInvulnerable: Check if an actor is invulnerable.
- IsValidActor: Checks if an actor ID is valid.
- GetActorPoolSize: Gets the highest actorid created on the server.
- GetPlayerTargetActor: Gets id of an actor which is aimed by certain player.
Administration
- Ban - Ban a player so they can't connect to the server.
- BanEx - Ban a player with a custom reason.
- IsPlayerAdmin - Check whether a player is logged into RCON or not.
- Kick - Kick a player from the server.
- SendRconCommand - Send an RCON command via the script.
Checkpoints
Normal Checkpoints
- DisablePlayerCheckpoint - Disable a player's checkpoint.
- IsPlayerInCheckpoint - Check if a player is in a checkpoint.
- SetPlayerCheckpoint - Set a player's checkpoint.
Race Checkpoints
- DisablePlayerRaceCheckpoint - Disable a player's race checkpoint.
- IsPlayerInRaceCheckpoint - Check if a player is in a race checkpoint.
- SetPlayerRaceCheckpoint - Set a player's race checkpoint.
Gangzones
Global Gangzones
- GangZoneCreate - Create a gangzone.
- GangZoneDestroy - Destroy a gangzone.
- GangZoneFlashForAll - Make a gangzone flash for all players.
- GangZoneHideForAll - Hide a gangzone for all players.
- GangZoneShowForAll - Show a gangzone for all players.
- GangZoneStopFlashForAll - Stop a gangzone flashing for all players.
Player Gangzones
- GangZoneFlashForPlayer - Make a gangzone flash for a certain player.
- GangZoneHideForPlayer - Hide a gangzone for a specific player.
- GangZoneShowForPlayer - Show a gangzone for a player.
- GangZoneStopFlashForPlayer - Stop a gangzone flashing for a specific player.
NPCs
npcmodes
- NPC:StartRecordingPlayback - Run a .rec file which has to be saved in the npcmodes/recordings folder.
- NPC:StopRecordingPlayback - Stop the current .rec file which is being ran by the NPC, making it stay idle until some other order is given.
- NPC:PauseRecordingPlayback - Pause playing back the recording.
- NPC:ResumeRecordingPlayback - Resume the paused recording.
- NPC:SendChat - Send a player text by the bot, just like using SendPlayerMessageToAll, but this function is to be used inside the NPC scripts.
- NPC:SendCommand - Force the NPC to write a desired command, and this way, getting the effects it would produce.
- NPC:GetMyPos - Get the current location of the NPC.
- NPC:SetMyPos - Set the position of the NPC.
- NPC:GetMyFacingAngle - Get the current facing angle of the NPC.
- NPC:SetMyFacingAngle - Set the NPC's facing angle.
- NPC:GetDistanceFromMeToPoint - Get the distance between the NPC and a point.
- NPC:IsVehicleStreamedIn - Checks if a vehicle is streamed in for an NPC. Only nearby vehicles are streamed in.
- NPC:IsPlayerStreamedIn - Checks if a player is streamed in for an NPC. Only nearby players are streamed in.
Scripts
- ConnectNPC - Connect an NPC.
- IsPlayerNPC - Check if a player is an NPC or an actual player.
Objects
Global Objects
- AttachCameraToObject - Attach a playercamera to an object.
- AttachObjectToObject - Attach an object to another object.
- AttachObjectToPlayer - Attach an object to a player.
- AttachObjectToVehicle - Attach an object to a vehicle.
- CreateObject - Create an object.
- DestroyObject - Destroy an object.
- EditObject - Allows a player to edit an object (position and rotation) using their mouse on a GUI.
- GetObjectPos - Get an object's position.
- GetObjectRot - Get an object's rotation.
- IsValidObject - Check if an object exists.
- MoveObject - Move an object.
- SelectObject - Display the cursor and allow the player to select an object.
- SetObjectMaterial - Replace the texture of an object with the texture from another model in the game.
- SetObjectMaterialText - Replace the texture of an object with text.
- SetObjectPos - Set an object's position.
- SetObjectRot - Set an object's rotation.
- StopObject - Stop an object (moving).
Player Objects
- CreatePlayerObject - Create an player-object.
- DestroyPlayerObject - Destroy an object.
- GetPlayerObjectPos - Get an object's position.
- GetPlayerObjectRot - Get an object's rotation.
- IsValidPlayerObject - Check if an object exists.
- MovePlayerObject - Move an object.
- SetPlayerObjectPos - Set an object's position.
- SetPlayerObjectRot - Set an object's rotation.
- StopPlayerObject - Stop an object (moving).
Player Variables (pVars)
- DeletePVar - Delete a player variable.
- GetPVarFloat - Get a player variable as a float.
- GetPVarInt - Get a player variable as an integer.
- GetPVarString - Get a player variable as a string.
- SetPVarFloat - Set a player variable to a float.
- SetPVarInt - Set a player variable to an integer.
- SetPVarString - Set a player variable to a string.
Spectating
- PlayerSpectatePlayer - Make a player spectate another player.
- PlayerSpectateVehicle - Make a player spectate a vehicle.
- AttachCameraToPlayerObject - Make a player spectate a object.
- TogglePlayerSpectating - Toggle whether a player is spectating or not.
Textdraws
Global Textdraws
- TextDrawAlignment - Set a textdraw's alignment.
- TextDrawBackgroundColor - Set the background color of a textdraw.
- TextDrawBoxColor - Set the color of a textdraw's box.
- TextDrawColor - Set the color of a textdraw.
- TextDrawCreate - Create a textdraw.
- TextDrawDestroy - Destroy a textdraw.
- TextDrawFont - Set a textdraw's font.
- TextDrawHideForAll - Hide a textdraw for all players.
- TextDrawHideForPlayer - Hide a textdraw for a specific player.
- TextDrawLetterSize - Set the size of a textdraw's text.
- TextDrawSetOutline - Set the outline thickness of a textdraw.
- TextDrawSetProportional - Set a textdraw's text proportion.
- TextDrawSetShadow - Toggle a shadow behind a textdraw's text.
- TextDrawSetString - Set the text in a textdraw.
- TextDrawShowForAll - Show a textdraw for all players.
- TextDrawShowForPlayer - Show a textdraw for a certain player.
- TextDrawTextSize - Set the size of a textdraw.
- TextDrawUseBox - Toggle whether a textdraw should have a box or not.
- TextDrawSetSelectable - Sets whether a textdraw is selectable through SelectTextDraw.
- TextDrawSetPreviewModel - Set the 3D preview model of a textdraw.
- TextDrawSetPreviewRot - Set rotation of a 3D textdraw preview.
- TextDrawSetPreviewVehCol - Set the colours of a vehicle in a 3D textdraw preview.
Player Textdraws
- CreatePlayerTextDraw - Create a player-textdraw.
- PlayerTextDrawAlignment - Set the alignment of a player-textdraw.
- PlayerTextDrawBackgroundColor - Set the background color of a player-textdraw.
- PlayerTextDrawBoxColor - Set the color of a player-textdraw's box.
- PlayerTextDrawColor - Set the color of the text in a player-textdraw.
- PlayerTextDrawDestroy - Destroy a player-textdraw.
- PlayerTextDrawFont - Set the font of a player-textdraw.
- PlayerTextDrawHide - Hide a player-textdraw.
- PlayerTextDrawLetterSize - Set the letter size of the text in a player-textdraw.
- PlayerTextDrawSetOutline - Toggle the outline on a player-textdraw.
- PlayerTextDrawSetProportional - Scale the text spacing in a player-textdraw to a proportional ratio.
- PlayerTextDrawSetShadow - Set the shadow on a player-textdraw.
- PlayerTextDrawSetString - Set the text of a player-textdraw.
- PlayerTextDrawShow - Show a player-textdraw.
- PlayerTextDrawTextSize - Set the size of a player-textdraw box (or clickable area for PlayerTextDrawSetSelectable).
- PlayerTextDrawUseBox - Toggle the box on a player-textdraw.
- PlayerTextDrawSetSelectable - Sets whether a player-textdraw is selectable through SelectTextDraw.
- PlayerTextDrawSetPreviewModel - Set model ID of a 3D player textdraw preview.
- PlayerTextDrawSetPreviewRot - Set rotation of a 3D player textdraw preview.
- PlayerTextDrawSetPreviewVehCol - Set the colours of a vehicle in a 3D player textdraw preview.
Selection
- SelectTextDraw - Enables the mouse, so the player can select a textdraw.
- CancelSelectTextDraw - Cancel textdraw selection with the mouse.
Vehicles
- AddStaticVehicle - Add a static vehicle.
- AddStaticVehicleEx - Add a static vehicle with a re-spawn delay.
- AddVehicleComponent - Add a component (tuning part) to a vehicle.
- AttachTrailerToVehicle - Attach a trailer to a vehicle.
- ChangeVehicleColor - Change the color(s) of a vehicle.
- ChangeVehiclePaintjob - Change the paintjob of a vehicle.
- CreateVehicle - Create a vehicle.
- DestroyVehicle - Destroy a vehicle.
- DetachTrailerFromVehicle - Detach a trailer from a vehicle.
- GetPlayerSurfingVehicleID - Get the ID of the vehicle a player is surfing.
- GetPlayerVehicleID - Get the ID of the vehicle that a player is in.
- GetVehicleComponentInSlot - Get a vehicle's component (tuning part) in a certain slot.
- GetVehicleComponentType - Find out the type of component a component is.
- GetVehicleDamageStatus - Get a vehicle's damage status (visual damage).
- GetVehicleHealth - Get a vehicle's health (engine).
- GetVehicleModel - Get the model of a vehicle.
- GetVehiclePos - Get the position of a vehicle.
- GetVehicleTrailer - Get the ID of a vehicle's trailer.
- GetVehicleVelocity - Get a vehicle's velocity.
- GetVehicleVirtualWorld - Get a vehicle's virtual world.
- GetVehicleZAngle - Get the rotation of a vehicle.
- GetVehicleRotation - Get the rotation of a vehicle on the XYZ axis.
- GetVehicleRotationQuat - Get the quaternion rotation of a vehicle.
- IsPlayerInAnyVehicle - Check if a player is in any vehicle.
- IsPlayerInVehicle - Check if a player is in a certain vehicle.
- IsTrailerAttachedToVehicle - Check if a vehicle has a trailer attached.
- IsVehicleStreamedIn - Check if a vehicle is streamed in for a certain player.
- LinkVehicleToInterior - Link a vehicle into an interior.
- PlayerSpectateVehicle - Make a player spectate a vehicle.
- PutPlayerInVehicle - Put a player in a vehicle.
- RemovePlayerFromVehicle - Remove a player from their vehicle.
- RemoveVehicleComponent - Remove a component from a vehicle.
- RepairVehicle - Repair a vehicle (visual damage + engine).
- SetVehicleHealth - Set a vehicle's health (engine).
- SetVehicleParamsForPlayer - Set the parameters of a vehicle for a player (locked, objective).
- SetVehiclePos - Set a vehicle's position.
- SetVehicleToRespawn - Respawn a vehicle.
- SetVehicleVelocity - Set a vehicle's velocity.
- SetVehicleVirtualWorld - Set a vehicle's virtual world.
- SetVehicleZAngle - Set a vehicle's rotation.
- UpdateVehicleDamageStatus - Update the damage status of a vehicle (visual damage).
Plugins
Pages in category "Scripting Functions"
The following 200 pages are in this category, out of 497 total.
(previous page) (next page)A
- Acos
- AddCharModel
- AddMenuItem
- AddPlayerClass
- AddPlayerClassEx
- AddSimpleModel
- AddSimpleModelTimed
- AddStaticPickup
- AddStaticVehicle
- AddStaticVehicleEx
- AddVehicleComponent
- AllowAdminTeleport
- AllowInteriorWeapons
- AllowPlayerTeleport
- Angle modes
- ApplyActorAnimation
- ApplyAnimation
- Asin
- Atan
- Atan2
- Attach3DTextLabelToPlayer
- Attach3DTextLabelToVehicle
- AttachCameraToObject
- AttachCameraToPlayerObject
- AttachObjectToObject
- AttachObjectToPlayer
- AttachObjectToVehicle
- AttachPlayerObjectToPlayer
- AttachPlayerObjectToVehicle
- AttachTrailerToVehicle
C
- CallLocalFunction
- CallRemoteFunction
- CancelEdit
- CancelSelectTextDraw
- ChangeVehicleColor
- ChangeVehiclePaintjob
- Clamp
- ClearActorAnimations
- ClearAnimations
- Connection status
- Control Structures
- Create3DTextLabel
- CreateActor
- CreateExplosion
- CreateExplosionForPlayer
- CreateMenu
- CreateObject
- CreatePickup
- CreatePlayer3DTextLabel
- CreatePlayerObject
- CreatePlayerTextDraw
- CreateVehicle
D
- Db close
- 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
- Delete3DTextLabel
- DeletePlayer3DTextLabel
- Deleteproperty
- DeletePVar
- DeleteSVar
- DestroyActor
- DestroyMenu
- DestroyObject
- DestroyPickup
- DestroyPlayerObject
- DestroyVehicle
- DetachTrailerFromVehicle
- Dialog Styles
- DisableInteriorEnterExits
- DisableMenu
- DisableMenuRow
- DisableNameTagLOS
- DisablePlayerCheckpoint
- DisablePlayerRaceCheckpoint
- DisableRemoteVehicleCollisions
E
F
- Fblockread
- Fblockwrite
- Fclose
- Fexist
- Fgetchar
- Flength
- Float
- Floatabs
- Floatadd
- Floatcmp
- Floatcos
- Floatdiv
- Floatfract
- Floatlog
- Floatmul
- Floatpower
- Floatround
- Floatround methods
- Floatsin
- Floatsqroot
- Floatstr
- Floatsub
- Floattan
- Fmatch
- Fopen
- ForceClassSelection
- Format
- Fputchar
- Fread
- Fremove
- Fseek
- Ftemp
- Funcidx
- Fwrite
G
- GameModeExit
- GameTextForAll
- GameTextForPlayer
- GangZoneCreate
- GangZoneDestroy
- GangZoneFlashForAll
- GangZoneFlashForPlayer
- GangZoneHideForAll
- GangZoneHideForPlayer
- GangZoneShowForAll
- GangZoneShowForPlayer
- GangZoneStopFlashForAll
- GangZoneStopFlashForPlayer
- GetActorFacingAngle
- GetActorHealth
- GetActorPoolSize
- GetActorPos
- GetActorVirtualWorld
- GetAnimationName
- Getarg
- GetConsoleVarAsBool
- GetConsoleVarAsInt
- GetConsoleVarAsString
- Getdate
- GetGravity
- GetMaxPlayers
- GetNetworkStats
- GetObjectModel
- GetObjectPos
- GetObjectRot
- GetPlayerAmmo
- GetPlayerAnimationIndex
- GetPlayerArmour
- GetPlayerCameraAspectRatio
- GetPlayerCameraFrontVector
- GetPlayerCameraMode
- GetPlayerCameraPos
- GetPlayerCameraTargetActor
- GetPlayerCameraTargetObject
- GetPlayerCameraTargetPlayer
- GetPlayerCameraTargetVehicle
- GetPlayerCameraZoom
- GetPlayerColor
- GetPlayerCustomSkin
- GetPlayerDistanceFromPoint
- GetPlayerDrunkLevel
- GetPlayerFacingAngle
- GetPlayerFightingStyle
- GetPlayerHealth
- GetPlayerInterior
- GetPlayerIp
- GetPlayerKeys
- GetPlayerLastShotVectors
- GetPlayerMenu
- GetPlayerMoney
- GetPlayerName
- GetPlayerNetworkStats
- GetPlayerObjectModel
- GetPlayerObjectPos
- GetPlayerObjectRot
- GetPlayerPing
- GetPlayerPoolSize
- GetPlayerPos
- GetPlayerScore