Server Scripting Functions: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
 
(394 intermediate revisions by 64 users not shown)
Line 1: Line 1:
This page lists all the scripting functions that exist already. To request a function or event, use [[Requested Functions and Events]].
<pageclass class="server"></pageclass>
{{Adding_Pages_to_Categories_and_Templates}}
This page lists all the '''server-side''' scripting functions that have been implemented and are available as native functions. To request a function, create an issue in [https://github.com/multitheftauto/mtasa-blue/issues our GitHub repository.]


==World functions==
Please note that the scripting functions can also be extended by loading in dynamic modules that provide new functionality, such as utility functions. These scripting functions are non-native and require the module to be loaded in order to work.
int int [[getTime]] ()
Head over to [[Modules]] for a list of non-native serverside functions and modules that are available.
For more functions, check the [[Useful_Functions|useful functions page]].
'''Client-side scripting functions can be found here: [[Client Scripting Functions]].'''
__TOC__
==Account functions==
{{Account functions}}
==ACL functions==
{{ACL functions}}
==Admin functions==
{{Admin functions}}
==Audio functions==
'''Shared'''
{{Audio functions}}


int int [[getWeather]] ()
==Announcement functions==
 
{{Announce functions}}
bool [[setTime]] ( hour, min )
==Blip functions==
'''Shared'''
{{Blip functions}}


bool [[setWeather]] ( primary, secondary )
==Camera functions==
'''Shared'''
{{Camera functions}}


bool [[setWeatherBlended]] ( id )
==Clothes and body functions==
'''Shared'''
{{Clothes and body functions}}


==Player functions==
==Collision shape functions==
int [[getPlayerAdminLevel]] ( player )
'''Shared'''
{{Collision shape functions}}


int [[getPlayerCount]] ()
==Cursor functions==
'''Shared'''
{{Cursor functions}}


int [[getPlayerCurrentWeaponAmmoInClip]] ( player )
==Element functions==
{{Element functions|server}}
==Event functions==
{{Event functions|server}}
==Explosion functions==
'''Shared'''
{{Explosion functions}}


int [[getPlayerCurrentWeaponID]] ( player )
==File functions==
 
'''Shared'''
player [[getPlayerFromID]] ( id )
{{File functions}}
 
player [[getPlayerFromNick]] ( nick )
 
float [[getPlayerHealth]] ( player )
 
float [[getPlayerArmor]] ( player )
 
int [[getPlayerID]] ( player )
 
float float float [[getPlayerMoveSpeed]] ( player )
 
float [[getPlayerMoveSpeed|getPlayerMoveSpeedX]] ( player )
 
float [[getPlayerMoveSpeed|getPlayerMoveSpeedY]] ( player )
 
float [[getPlayerMoveSpeed|getPlayerMoveSpeedZ]] ( player )
 
string [[getPlayerName]] ( player )
 
vehicle [[getPlayerOccupiedVehicle]] ( player )
 
int [[getPlayerOccupiedVehicleSeat]] ( player )
 
int [[getPlayerPing]] ( player )
 
float float float [[getPlayerPosition]] ( player )
 
float [[getPlayerPosition|getPlayerPositionX]] ( player )
 
float [[getPlayerPosition|getPlayerPositionY]] ( player )
 
float [[getPlayerPosition|getPlayerPositionZ]] ( player )
 
float [[getPlayerRotation]] ( player )
 
string [[getPlayerSourceIP]] ( player )
 
player [[getRandomPlayer]] ()
 
bool [[isPlayerDead]] ( player )
 
bool [[isPlayerDucked]] ( player )
 
bool [[isPlayerMuted]] ( player )
 
bool [[setPlayerPosition]] ( player, x, y, z )
 
bool [[setPlayerRotation]] ( player, rotation )
 
bool [[setPlayerHealth]] ( player, health )
 
bool [[setPlayerArmor]] ( player, armor )
 
bool [[killPlayer]] ( player )
 
bool [[warpPlayerIntoVehicle]] ( player, vehicle, [seat] )
 
bool [[removePlayerFromVehicle]] ( player )
 
bool [[spawnPlayer]] ( player, x, y, z, rotation, model )
 
==Weapon functions==
bool [[giveWeapon]] ( player, weaponid, [ammo=30] )
 
bool [[giveWeaponToAll]] ( weaponid, [ammo=30] )
 
bool [[takeWeapon]] ( player, weaponid )
 
bool [[takeWeaponFromAll]] ( weaponid )
 
bool [[takeAllWeapons]] ( player )
 
bool [[takeAllWeaponsFromAll]] ()
 
==Vehicle functions==
vehicle [[createVehicle]] ( id, x, y, z, [rx, ry, rz] )
 
bool [[destroyVehicle]] ( vehicle )
 
float [[getVehicleHealth]] ( vehicle )
 
int [[getVehicleID]] ( vehicle )
 
int [[getVehicleIndex]] ( vehicle )
 
float float float [[getVehicleMoveSpeed]] ( vehicle )
 
float [[getVehicleMoveSpeed|getVehicleMoveSpeedX]] ( vehicle )
 
float [[getVehicleMoveSpeed|getVehicleMoveSpeedY]] ( vehicle )
 
float [[getVehicleMoveSpeed|getVehicleMoveSpeedZ]] ( vehicle )
{{Needs_Checking|getVehicleOccupant is missing an optional [seat] argument|[[User:Vandalite|Vandalite]]}}
player [[getVehicleOccupant]] ( vehicle )
 
float float float [[getVehiclePosition]] ( vehicle )
 
float [[getVehiclePosition|getVehiclePositionX]] ( vehicle )
 
float [[getVehiclePosition|getVehiclePositionY]] ( vehicle )
 
float [[getVehiclePosition|getVehiclePositionZ]] ( vehicle )
 
float float float [[getVehicleRotation]] ( vehicle )
 
float [[getVehicleRotation|getVehicleRotationX]] ( vehicle )
 
float [[getVehicleRotation|getVehicleRotationY]] ( vehicle )
 
float [[getVehicleRotation|getVehicleRotationZ]] ( vehicle )
 
float float float [[getVehicleTurnSpeed]] ( vehicle )
 
float [[GetVehicleTurnSpeed|getVehicleTurnSpeedX]] ( vehicle )
 
float [[GetVehicleTurnSpeed|getVehicleTurnSpeedY]] ( vehicle )
 
float [[GetVehicleTurnSpeed|getVehicleTurnSpeedZ]] ( vehicle )
 
float float [[getVehicleTurretPosition]] ( vehicle )
 
float [[GetVehicleTurretPosition|getVehicleTurretPositionX]] ( vehicle )
 
float [[GetVehicleTurretPosition|getVehicleTurretPositionY]] ( vehicle )
 
int [[GetVehicleMaxPassengers]] ( vehicle )
 
bool [[setVehiclePosition]] ( vehicle, x, y, z )
 
bool [[setVehicleRotation]] ( vehicle, rx, ry, rz )
 
bool [[setVehicleMoveSpeed]] ( vehicle, x, y, z )
 
bool [[setVehicleTurnSpeed]] ( vehicle, rx, ry, rz )
 
bool [[setVehicleHealth]] ( vehicle, health )
 
bool [[setVehicleColor]] ( vehicle, color1, color2, color3, color4 )


==HTTP functions==
{{HTTP functions}}
==Input functions==
{{Input functions|server}}
==Map functions==
{{Map functions}}
==Marker functions==
==Marker functions==
marker [[createMarker]] ( x, y, z, [type, size, r, g, b,] )
'''Shared'''
 
{{Marker functions}}
bool [[destroyMarker]] ( marker )
 
bool [[destroyAllMarkers]] ()
 
int [[getMarkerCount]] ()
 
marker [[getMarkerFromID]] ( id )
 
int [[getMarkerType]] ( [[marker]] )
 
float float float [[getMarkerPosition]] ( [[marker]] )
 
float [[getMarkerPosition|getMarkerPositionX]] ( [[marker]] )
 
float [[getMarkerPosition|getMarkerPositionY]] ( [[marker]] )
 
float [[getMarkerPosition|getMarkerPositionZ]] ( [[marker]] )
 
float [[getMarkerSize]] ( [[marker]] )
 
int int int [[getMarkerColor]] ( [[marker]] )
 
int [[getMarkerColor|getMarkerColorRed]] ( [[marker]] )
 
int [[getMarkerColor|getMarkerColorGreen]] ( [[marker]] )
 
int [[getMarkerColor|getMarkerColorBlue]] ( [[marker]] )
 
bool [[setMarkerType]] ( [[marker]], type )
 
bool [[setMarkerPosition]] ( [[marker]], x, y, z )
 
bool [[setMarkerSize]] ( [[marker]], size )
 
bool [[setMarkerColor]] ( [[marker]], r, g, b )
 
==Blip functions==
{{Needs_Checking|CreateBlip has the wrong arguments set to optional. the color/transparencies can be defaulted, the location cannot. Also, there is no option for creating blips larger than others. perhaps an additional scale option? That would make the final markup for the function "blip createBlip ( x, y, z, [r, g, b, a, scale} )|[[User:Vandalite|Vandalite]]}}
blip [[createBlip]] ( r, g, b, a, [x, y, z] )
{{Needs_Checking|CreateBlipAttachedTo should have the r,g,b,a arguments optional. also required is a scale argument. EG: blip  createBlipAttachedTo ( entity, [r, g, b, a, scale] )|[[User:Vandalite|Vandalite]]}}
blip [[createBlipAttachedTo]] ( entity, r, g, b, a )
 
bool [[destroyBlip]] ( blip )
 
bool [[destroyBlipAttachedTo]] ( entity )
 
float float float [[getBlipPosition]] ( blip )
 
float [[getBlipPositionX]] ( blip )
 
float [[getBlipPositionY]] ( blip )


float [[getBlipPositionZ]] ( blip )
==Matrix functions==
{{Needs_Checking|Does setBlipPosition automatically detach a blip that has been attached to something?|[[User:Vandalite|Vandalite]]}}
'''Shared'''
bool [[setBlipPosition]] ( blip, x, y, z )
{{Matrix functions}}
 
bool [[attachBlipToEntity]] ( blip, entity )


==Module functions==
{{Module functions}}
==Object functions==
==Object functions==
object [[createObject]] ( model, x, y, z, [rx, ry, rz] )
'''Shared'''
 
{{Object functions}}
bool [[destroyObject]] ( object )
 
bool [[destroyAllObjects]] ()
 
string [[getObjectName]] ( object )
 
int [[getObjectModel]] ( object )
 
float float float [[getObjectPosition]] ( object )
 
float [[getObjectPositionX]] ( object )
 
float [[getObjectPositionY]] ( object )
 
float [[getObjectPositionZ]] ( object )
 
float float float [[getObjectRotation]] ( object )
 
float [[getObjectRotationX]] ( object )
 
float [[getObjectRotationY]] ( object )
 
float [[getObjectRotationZ]] ( object )
 
bool [[setObjectName]] ( object, name )
 
bool [[setObjectModel]] ( object, model )
 
bool [[setObjectPosition]] ( object, x, y, z )
 
bool [[setObjectRotation]] ( object, x, y, z )
 
bool [[moveObject]] ( object, time, x, y, z, rx, ry, rz )


==Output functions==
{{Output functions|server}}
==Ped functions==
{{Ped functions|server}}
==Pickup functions==
==Pickup functions==
[[pickup]] [[createPickup]] ( float x, float y, float z, int type, int amount/weapon, [int ammo] )
{{Pickup functions|server}}
 
bool [[destroyPickup]] ( [[pickup]] pickup )
==Player functions==
 
{{Player functions|server}}
bool [[destroyAllPickups]] ()
 
==Projectile functions==
string [[getPickupName]] ( [[pickup]] pickup )
'''Shared'''
 
{{Projectile_functions}}
[[pickup]] [[getPickupFromName]] ( string name )
 
float float float [[getPickupPosition]] ( [[pickup]] pickup )
 
float [[getPickupPositionX]] ( [[pickup]] pickup )
 
float [[getPickupPositionY]] ( [[pickup]] pickup )
 
float [[getPickupPositionZ]] ( [[pickup]] pickup )
 
int [[getPickupType]] ( [[pickup]] pickup )
 
int [[getPickupWeapon]] ( [[pickup]] pickup )
 
int [[getPickupHealth]] ( [[pickup]] pickup )
 
int [[getPickupAmmo]] ( [[pickup]] pickup )
 
bool [[setPickupName]] ( string name )
 
bool [[setPickupPosition]] ( [[pickup]] pickup, float x, float y, float z )
 
bool [[setPickupType]] ( [[pickup]] pickup, int type, int amount/weapon, [int ammo] )


==Radar area functions==
==Radar area functions==
radararea [[createRadarArea]] ( x, y, sizex, sizey, r, g, b, a )
'''Shared'''
 
{{Radar functions}}
bool [[destroyRadarArea]] ( radararea )
 
bool [[destroyAllRadarAreas]] ()
 
float float [[getRadarAreaPosition]] ( radararea )
 
float [[getRadarAreaPositionX]] ( radararea )
 
float [[getRadarAreaPositionY]] ( radararea )
 
float float [[getRadarAreaSize]] ( radararea )
 
float [[getRadarAreaSizeX]] ( radararea )
 
float [[getRadarAreaSizeY]] ( radararea )
 
int int int int [[getRadarAreaColor]] ( radararea )
 
int [[getRadarAreaColorRed]] ( radararea )
 
int [[getRadarAreaColorGreen]] ( radararea )
 
int [[getRadarAreaColorBlue]] ( radararea )
 
int [[getRadarAreaColorAlpha]] ( radararea )
 
bool [[isRadarAreaFlashing]] ( radararea )
 
bool [[setRadarAreaPosition]] ( radararea, x, y )
 
bool [[setRadarAreaSize]] ( radararea, x, y )
 
bool [[setRadarAreaColor]] ( radararea, r, g, b, a )
 
bool [[setRadarAreaFlashing]] ( radararea, bool )


==Resource functions==
{{Resource functions|server}}
==Server functions==
==Server functions==
int [[getMaxPlayers]] ()
{{Server functions}}
 
bool [[serverLoggerPrint]] ( string, [...] )
==Settings registry functions==
 
{{Settings registry functions}}
bool [[serverChat]] ( string, [...] )
 
==SQL functions==
bool [[playerPM]] ( player, string, [...] )
{{SQL functions}}
 
bool [[showTextForAll]] ( duration, r, g, b, size, string, [...] )
==Team functions==
 
{{Team functions|server}}
bool [[showTextForPlayer]] ( player, duration, r, g, b, size, string, [...] )
 
==Text functions==
{{Text functions}}
==Utility functions==
==Utility functions==
float [[getDistanceBetweenPoints2D]] ( x1, y1, x2, y2 )
{{Utility functions|server}}
 
float [[getDistanceBetweenPoints3D]] ( x1, y1, z1, x2, y2, z2 )
==UTF8 Library==
 
'''Shared'''
int [[randInt]] ( lowerbound, upperbound )
{{UTF8 functions}}
 
float [[randFloat]] ()
==Vehicle functions==
 
{{Vehicle functions|server}}
int [[getTickCount]] ()
 
==Water functions==
string [[gettok]] ( string, index, separatingchar )
'''Shared'''
 
{{Water functions}}
bool [[setTimer]] ( function, time, [arg1, arg2, ...] )
 
==Map functions==
string [[getLoadedMapName]] ()
 
xmlnode [[getLoadedMapXMLRoot]] ()


==Weapon functions==
{{Weapon functions|server}}
==World functions==
{{World functions|server}}
==XML functions==
==XML functions==
xmlnode [[xmlFindSubNode]] ( parent, subnode, index )
'''Shared'''
 
{{XML functions}}
string [[xmlNodeGetValue]] ( xmlNode )
 
bool [[xmlNodeSetValue]] ( xmlNode, value )
 
string [[xmlNodeGetAttribute]] ( xmlNode, attribute name )
 
bool [[xmlNodeSetAttribute]] ( xmlNode, attribute name, value )
 
xmlnode [[xmlLoadFile]] ( filename )
 
bool [[xmlUnloadFile]] ( xmlnode )
 
==Text Functions==
 
textdisplay [[textCreateDisplay]] ()
 
void [[textDestroyDisplay]] ( textdisplay )
 
textitem [[textCreateTextItem]] ( [text, x, y, priority, red, green, blue, alpha, scale] )
 
void [[textDestroyTextItem]] ( textitem )
 
void [[textDisplayAddText]] ( textdisplay, textitem )
 
void [[textDisplayAddObserver]] ( textdisplay, player )
 
void [[textItemSetText]] ( textitem, text )
 
string [[textItemGetText]] ( textitem )
 
void [[textItemSetScale]] ( textitem, scale )
 
float [[textItemGetScale]] ( textitem )
 
void [[textItemSetPosition]] ( textitem, x, y )
 
float float [[textItemGetPosition]] ( textitem )
 
void [[textItemSetColor]] ( textitem, red, green, blue, alpha )
 
int int int int [[textItemGetColor]] ( textitem )
 
void [[textItemSetPriority]] ( textitem, priority )


int [[textItemGetPriority]] ( textitem )
[[ar:Server Scripting Functions]]
[[de:Server-Seitige Scripting Funktionen]]
[[en:Server Scripting Functions]]
[[es:Funciones_del_Server]]
[[hu:Server Scripting Functions]]
[[pl:Server Scripting Functions]]
[[pt-br:Funções de Scripting do Servidor]]
[[ru:Server Scripting Functions]]
[[tr:Server Scripting Functions]]
[[zh-cn:Server Scripting Functions]]

Latest revision as of 22:34, 6 September 2024

Contributors: Did you create a page but it's not on this list? Confused? Read: Adding Pages to Categories and Templates

This page lists all the server-side scripting functions that have been implemented and are available as native functions. To request a function, create an issue in our GitHub repository.

Please note that the scripting functions can also be extended by loading in dynamic modules that provide new functionality, such as utility functions. These scripting functions are non-native and require the module to be loaded in order to work.

Head over to Modules for a list of non-native serverside functions and modules that are available.

For more functions, check the useful functions page.

Client-side scripting functions can be found here: Client Scripting Functions.

Account functions


ACL functions


Admin functions


Audio functions

Shared



Announcement functions


Blip functions

Shared


Camera functions

Shared



Clothes and body functions

Shared


Collision shape functions

Shared


Cursor functions

Shared



Element functions



Event functions



Explosion functions

Shared


File functions

Shared


HTTP functions

These functions can only be used from within lua blocks in HTML pages hosted by the server


Input functions



Map functions


Marker functions

Shared



Matrix functions

Shared


Module functions


Object functions

Shared



Output functions



Ped functions



Pickup functions



Player functions



Projectile functions

Shared



Radar area functions

Shared


Resource functions



Server functions


Settings registry functions


SQL functions


Team functions



Text functions


Utility functions



UTF8 Library

Shared


Vehicle functions



Water functions

Shared



Weapon functions



World functions



XML functions

Shared