Server Scripting Functions: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
 
(342 intermediate revisions by 64 users not shown)
Line 1: Line 1:
This page lists all the scripting functions that have been implemented and are available as native functions from the Deathmatch mod. 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.]


Please note that the scripting functions can now be extended by loading in dynamic modules that provide new functionality, such as MySQL database access. These scripting functions are non-native and require the module to be loaded in order to work.
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|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}}


Head over to [[Module functions]] for a list of non-native functions and modules that are available.
==Announcement functions==
 
{{Announce functions}}
==Event functions==
bool [[addEvent]] ( string name, string arguments )
==Blip functions==
 
'''Shared'''
bool [[addEventHandler]] ( string name, [[element]] element, string handler )
{{Blip functions}}


bool [[triggerEvent]] ( string name, [[element]] element, [argument, ...] )
==Camera functions==
'''Shared'''
{{Camera functions}}


==World functions==
==Clothes and body functions==
int int [[getTime]] ()
'''Shared'''
{{Clothes and body functions}}


int [[getWeather]] ()
==Collision shape functions==
'''Shared'''
{{Collision shape functions}}


bool [[setTime]] ( int hour, int min )
==Cursor functions==
 
'''Shared'''
bool [[setWeather]] ( int id )
{{Cursor functions}}
 
bool [[setWeatherBlended]] ( int id )


==Element functions==
==Element functions==
bool [[destroyElement]] ( [[element]] element )
{{Element functions|server}}
==Event functions==
{{Event functions|server}}
==Explosion functions==
'''Shared'''
{{Explosion functions}}


element [[getRootElement]] ()
==File functions==
 
'''Shared'''
string [[getElementID]] ( [[element]] element )
{{File functions}}
 
element [[getElementByID]] ( string name, int index )
 
var [[getElementData]] ( string name )
 
string [[getElementType]] ( [[element]] element )
 
bool [[setElementID]] ( [[element]] element, string name )
 
bool [[setElementData]] ( [[element]] element, string name, var data )
 
==Entity functions==
float float float [[getEntityPosition]] ( [[entity]] entity, float x, float y, float z )
 
bool [[setEntityPosition]] ( [[element]] element )
 
==Player functions==
int [[getPlayerCount]] ()
 
int [[getPlayerCurrentWeaponAmmoInClip]] ( [[player]] player )
 
int [[getPlayerCurrentWeaponID]] ( [[player]] player )
 
[[player]] [[getPlayerFromNick]] ( string nick )
 
float [[getPlayerHealth]] ( [[player]] player )
 
float [[getPlayerArmor]] ( [[player]] player )
 
int [[getPlayerLevel]] ( [[player]] player )
 
int [[getPlayerMoney]] ( [[player]] player )
 
float float float [[getPlayerMoveSpeed]] ( [[player]] player )
 
string [[getPlayerName]] ( [[player]] player )
 
[[vehicle]] [[getPlayerOccupiedVehicle]] ( [[player]] player )
 
int [[getPlayerOccupiedVehicleSeat]] ( [[player]] player )
 
int [[getPlayerPing]] ( [[player]] player )
 
float [[getPlayerRotation]] ( [[player]] player )
 
int [[getPlayerSkin]] ( [[player]] player )
 
string [[getPlayerSourceIP]] ( [[player]] player )
 
[[player]] [[getRandomPlayer]] ()
 
bool [[isPlayerDead]] ( [[player]] player )
 
bool [[isPlayerDucked]] ( [[player]] player )
 
bool [[isPlayerMuted]] ( [[player]] player )
 
bool [[setPlayerRotation]] ( [[element]] player, float rotation )
 
bool [[setPlayerSkin]] ( [[element]] player, int id )
 
bool [[setPlayerHealth]] ( [[element]] player, float health )
 
bool [[setPlayerArmor]] ( [[element]] player, float armor )
 
bool [[setPlayerMoney]] ( [[element]] player, int money )
 
bool [[givePlayerMoney]] ( [[element]] player, int money )
 
bool [[takePlayerMoney]] ( [[element]] player, int money )
 
bool [[killPlayer]] ( [[element]] player )
 
bool [[warpPlayerIntoVehicle]] ( [[player]] player, [[vehicle]] vehicle, [int seat] )
 
bool [[removePlayerFromVehicle]] ( [[element]] player )
 
bool [[spawnPlayer]] ( [[player]] player, float x, float y, float z, float rotation, int skin )
 
==Weapon functions==
bool [[giveWeapon]] ( [[player]] player, int weapon, [int ammo=30] )
 
bool [[giveWeaponToAll]] ( int weapon, [int ammo=30] )
 
bool [[takeWeapon]] ( [[player]] player, int weapon )
 
bool [[takeWeaponFromAll]] ( int weapon )
 
bool [[takeAllWeapons]] ( [[player]] player )
 
bool [[takeAllWeaponsFromAll]] ()
 
==Vehicle functions==
vehicle [[createVehicle]] ( int id, float x, float y, float z, [float rx, float ry, float rz] )
 
bool [[destroyAllVehicles]] ()
 
int int int int [[getVehicleColor]] ( [[vehicle]] vehicle )
 
float [[getVehicleHealth]] ( [[vehicle]] vehicle )
 
int [[getVehicleID]] ( [[vehicle]] vehicle )
 
int [[getVehicleIDFromName]] ( string name )
 
int [[getVehicleIndex]] ( [[vehicle]] vehicle )
 
float float float [[getVehicleMoveSpeed]] ( string vehicle )
 
string [[getVehicleName]] ( string vehicle )
 
string [[getVehicleNameFromID]] ( int id )
 
player [[getVehicleOccupant]] ( [[vehicle]] vehicle, [int seat=0] )
 
float float float [[getVehicleRotation]] ( [[vehicle]] vehicle )
 
float float float [[getVehicleTurnSpeed]] ( [[vehicle]] vehicle )
 
float float [[getVehicleTurretPosition]] ( [[vehicle]] vehicle )
 
int [[getVehicleMaxPassengers]] ( [[vehicle]] vehicle )
 
bool [[isVehicleLocked]] ( [[vehicle]] vehicle )
 
bool [[setVehicleRotation]] ( [[vehicle]] vehicle, float rx, float ry, float rz )
 
bool [[setVehicleMoveSpeed]] ( [[vehicle]] vehicle, float x, float y, float z )
 
bool [[setVehicleTurnSpeed]] ( [[vehicle]] vehicle, float rx, float ry, float rz )
 
bool [[setVehicleHealth]] ( [[vehicle]] vehicle, float health )
 
bool [[setVehicleColor]] ( [[vehicle]] vehicle, int color1, int color2, int color3, int color4 )
 
bool [[setVehicleLocked]] ( [[vehicle]] vehicle, bool locked )


==HTTP functions==
{{HTTP functions}}
==Input functions==
{{Input functions|server}}
==Map functions==
{{Map functions}}
==Marker functions==
==Marker functions==
marker [[createMarker]] ( float x, float y, float z, [int type, float size, int r, int g, int b] )
'''Shared'''
{{Marker functions}}


bool [[destroyAllMarkers]] ()
==Matrix functions==
 
'''Shared'''
int [[getMarkerCount]] ()
{{Matrix functions}}
 
int [[getMarkerType]] ( [[marker]] marker )
 
float [[getMarkerSize]] ( [[marker]] marker )
 
int int int [[getMarkerColor]] ( [[marker]] marker )
 
bool [[setMarkerType]] ( [[marker]] marker, int type )
 
bool [[setMarkerSize]] ( [[marker]] marker, float size )
 
bool [[setMarkerColor]] ( [[marker]] marker, int r, int g, int b )
 
==Blip functions==
blip [[createBlip]] ( float x, float y, float z, [int icon=0, int size=2, int r=255, int g=0, int b=0, int a=255] )
 
blip [[createBlipAttachedTo]] ( [[entity]] entity, [int icon=0, int size=2, int r=255, int g=0, int b=0, int a=255] )
 
bool [[destroyBlipAttachedTo]] ( [[entity]] entity )
 
bool [[destroyAllBlips]] ()
 
int [[getBlipIcon]] ( [[blip]] blip )
 
int [[getBlipSize]] ( [[blip]] blip )
 
int int int int [[getBlipColor]] ( [[blip]] blip )
 
blip [[getBlipAttachedTo]] ( [[entity]] entity )
 
bool [[setBlipIcon]] ( [[blip]] blip, int icon )
 
bool [[setBlipSize]] ( [[blip]] blip, int size )
 
bool [[setBlipColor]] ( [[blip]] blip, int red, int green, int blue, int alpha )
 
bool [[attachBlipToEntity]] ( [[blip]] blip, [[entity]] entity )


==Module functions==
{{Module functions}}
==Object functions==
==Object functions==
[[object]] [[createObject]] ( int id, float x, float y, float z, [float rx, float ry, float rz] )
'''Shared'''
 
{{Object functions}}
bool [[destroyAllObjects]] ()
 
int [[getObjectModel]] ( [[object]] object )
 
float float float [[getObjectRotation]] ( [[object]] object )
 
bool [[setObjectModel]] (  [[object]] object, int id )
 
bool [[setObjectRotation]] (  [[object]] object, float x, float y, float z )
 
bool [[moveObject]] (  [[object]] object, int time, float x, float y, float z, float rx, float ry, float 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 [[destroyAllPickups]] ()
==Player functions==
 
{{Player functions|server}}
int [[getPickupType]] ( [[pickup]] pickup )
 
==Projectile functions==
int [[getPickupWeapon]] ( [[pickup]] pickup )
'''Shared'''
 
{{Projectile_functions}}
int [[getPickupHealth]] ( [[pickup]] pickup )
 
int [[getPickupAmmo]] ( [[pickup]] pickup )
 
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 [[destroyAllRadarAreas]] ()
 
float float [[getRadarAreaSize]] ( radararea )
 
int int int int [[getRadarAreaColor]] ( radararea )
 
bool [[isRadarAreaFlashing]] ( radararea )
 
bool [[setRadarAreaSize]] ( radararea, x, y )
 
bool [[setRadarAreaColor]] ( radararea, r, g, b, a )
 
bool [[setRadarAreaFlashing]] ( radararea, bool )
 
==Weapon functions==
string [[getWeaponNameFromID]] ( id )
 
int [[getWeaponIDFromName]] ( string )
 
==Scoreboard functions==
bool [[addScoreboardColumn]] ( id, name, width )
 
bool [[removeScoreboardColumn]] ( id )


==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