Server Scripting Functions: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
 
(258 intermediate revisions by 63 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 [[Module functions]] for a list of non-native functions and modules that are available.
Head over to [[Modules]] for a list of non-native serverside functions and modules that are available.
 
==Incomplete/Malfunctioning Functions==
For more functions, check the [[Useful_Functions|useful functions page]].
Incomplete Function List: http://www.mtavc.com/once-upon_a_time-there_was-this_girl/index.php?title=Category:Incomplete
 
'''Client-side scripting functions can be found here: [[Client Scripting Functions]].'''
[[setPlayerRotation]] - Possibly not functional
__TOC__
==Account functions==
{{Account functions}}
==ACL functions==
{{ACL functions}}
==Admin functions==
{{Admin functions}}
==Audio functions==
'''Shared'''
{{Audio functions}}


==Announcement functions==
{{Announce functions}}
==Blip functions==
==Blip functions==
{{Blip_functions}}
'''Shared'''
{{Blip functions}}


==Element functions==
==Camera functions==
{{Element functions}}
'''Shared'''
{{Camera functions}}


==Entity functions==
==Clothes and body functions==
[[float]] [[float]] [[float]] [[getEntityPosition]] ( [[entity]] entity )
'''Shared'''
{{Clothes and body functions}}


[[bool]] [[setEntityPosition]] ( [[element]] entity, [[float]] x, [[float]] y, [[float]] z )
==Collision shape functions==
'''Shared'''
{{Collision shape functions}}


[[bool]] [[addEntityVisibleTo]] ( [[element]] entity, [[element]] visibleTo )
==Cursor functions==
 
'''Shared'''
[[bool]] [[removeEntityVisibleTo]] ( [[element]] entity, [[element]] visibleTo )
{{Cursor functions}}
 
[[bool]] [[clearEntityVisibleTo]] ( [[element]] entity )


==Element functions==
{{Element functions|server}}
==Event functions==
==Event functions==
[[bool]] [[addEvent]] ( [[string]] name, [[string]] arguments )
{{Event functions|server}}
==Explosion functions==
'''Shared'''
{{Explosion functions}}


[[bool]] [[addEventHandler]] ( [[string]] name, [[element]] element, [[string]] handler )
==File functions==
 
'''Shared'''
[[bool]] [[triggerEvent]] ( [[string]] name, [[element]] element, [ [[var]] argument1, [[var]] argument2, ... ] )
{{File functions}}


==HTTP functions==
{{HTTP functions}}
==Input functions==
{{Input functions|server}}
==Map functions==
==Map functions==
[[string]] [[getLoadedMapName]] ()
{{Map functions}}
 
[[xmlnode]] [[getLoadedMapXMLRoot]] ()
 
[[bool]] [[startMap]] ( [[string]] name )
 
[[bool]] [[endMap]] ()
 
[[element]] [[loadMapData]] ( [[xmlnode]] node, [[element]] parent )
 
[[string]] [[getMapOption]] ( [[string]] name )
 
==Marker functions==
==Marker functions==
A marker is a 3D model in the world that can highlight a particular point or area, often used to instruct players where to go to perform actions such as entering buildings.
'''Shared'''
 
{{Marker functions}}
[[element]] [[createMarker]] ( [[float]] x, [[float]] y, [[float]] z, [ [[string]] type, [[float]] size, [[int]] r, [[int]] g, [[int]] b, [[int]] a, visibleTo=[[getRootElement]] () ] )
 
[[bool]] [[destroyAllMarkers]] ()
 
[[int]] [[getMarkerCount]] ()
 
[[string]] [[getMarkerType]] ( [[element]] marker )
 
[[float]] [[getMarkerSize]] ( [[element]] marker )
 
[[int]] [[int]] [[int]] [[int]] [[getMarkerColor]] ( [[element]] marker )
 
[[float]] [[float]] [[float]] [[getMarkerTarget]] ( [[element]] marker )
 
[[bool]] [[setMarkerType]] ( [[element]] marker, [[string]] type )
 
[[bool]] [[setMarkerSize]] ( [[element]] marker, [[float]] size )
 
[[bool]] [[setMarkerColor]] ( [[element]] marker, [[int]] r, [[int]] g, [[int]] b, [[int]] a )
 
[[bool]] [[setMarkerTarget]] ( [[element]] marker, [[bool]] false )


[[bool]] [[setMarkerTarget]] ( [[element]] marker, [[float]] x, [[float]] y, [[float]] z )
==Matrix functions==
'''Shared'''
{{Matrix functions}}


==Module functions==
{{Module functions}}
==Object functions==
==Object functions==
An object is a model in the world. These have collision models and can be moved and rotated at will. Any existing GTA model can be used.
'''Shared'''
 
{{Object functions}}
[[element]] [[createObject]] ( [[int]] id, [[float]] x, [[float]] y, [[float]] z, [ [[float]] rx, [[float]] ry, [[float]] rz] )
 
[[bool]] [[destroyAllObjects]] ()
 
[[int]] [[getObjectModel]] ( [[element]] object )
 
[[float]] [[float]] [[float]] [[getObjectRotation]] ( [[element]] object )
 
[[bool]] [[setObjectModel]] ( [[element]] object, [[int]] id )
 
[[bool]] [[setObjectRotation]] ( [[element]] object, [[float]] x, [[float]] y, [[float]] z )
 
[[bool]] [[moveObject]] ( [[element]] 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]] ()
 
[[int]] [[getPickupType]] ( [[pickup]] pickup )
 
[[int]] [[getPickupWeapon]] ( [[pickup]] pickup )
 
[[int]] [[getPickupHealth]] ( [[pickup]] pickup )
 
[[int]] [[getPickupAmmo]] ( [[pickup]] pickup )
 
[[bool]] [[setPickupType]] ( [[element]] pickup, [[int]] type, [[int]] amount/weapon, [ [[int]] ammo ] )
 
==Player functions==
==Player functions==
[[int]] [[getPlayerCount]] ()
{{Player functions|server}}
 
[[int]] [[getPlayerCurrentWeaponAmmoInClip]] ( [[player]] player )
==Projectile functions==
 
'''Shared'''
[[int]] [[getPlayerCurrentWeaponID]] ( [[player]] player )
{{Projectile_functions}}
 
[[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 ) ---------------Cannot get to work
 
[[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=0 ] )
 
[[bool]] [[removePlayerFromVehicle]] ( [[element]] player )
 
[[bool]] [[spawnPlayer]] ( [[player]] player, [[spawnpoint]] spawnpoint )
 
[[bool]] [[spawnPlayer]] ( [[player]] player, [[float]] x, [[float]] y, [[float]] z, [[float]] rotation, [[int]] skin )


==Radar area functions==
==Radar area functions==
[[radararea]] [[createRadarArea]] ( [[float]] x, [[float]] y, [[float]] sizex, [[float]] sizey, [[int]] r, [[int]] g, [[int]] b, [[int]] a, [ visibleTo=[[getRootElement]] () ] )
'''Shared'''
 
{{Radar functions}}
[[bool]] [[destroyAllRadarAreas]] ()
 
[[float]] [[float]] [[getRadarAreaSize]] ( [[radararea]] radararea )
 
[[int]] [[int]] [[int]] [[int]] [[getRadarAreaColor]] ( [[radararea]] radararea )
 
[[bool]] [[isRadarAreaFlashing]] ( [[radararea]] radararea )
 
[[bool]] [[setRadarAreaSize]] ( [[element]] radararea, [[float]] x, [[float]] y )
 
[[bool]] [[setRadarAreaColor]] ( [[element]] radararea, [[int]] r, [[int]] g, [[int]] b, [[int]] a )
 
[[bool]] [[setRadarAreaFlashing]] ( [[element]] radararea, [[bool]] flash )
 
==Scoreboard functions==
[[bool]] [[addScoreboardColumn]] ( [[string]] id, [[string]] name, [[float]] width )
 
[[bool]] [[removeScoreboardColumn]] ( [[string]] id )


==Resource functions==
{{Resource functions|server}}
==Server functions==
==Server functions==
[[int]] [[getMaxPlayers]] ()
{{Server functions}}
 
[[bool]] [[outputChatBox]] ( [[string]] text, [[element]] player, [ [[int]] r, [[int]] g, [[int]] b ] )
==Settings registry functions==
 
{{Settings registry functions}}
[[bool]] [[outputConsole]] ( [[string]] text, [[element]] player )
 
==SQL functions==
[[bool]] [[outputDebugString]] ( [[string]] text, [ [[int]] level=3 ] )
{{SQL functions}}
 
[[bool]] [[outputServerLog]] ( [[string]] text )
==Team functions==
 
{{Team functions|server}}
[[bool]] [[addCommandHandler]] ( [[string]] key, [[string]] handler )
 
[[bool]] [[removeCommandHandler]] ( [[string]] key )
 
==Spawnpoint functions==
[[float]] [[getspawnpointRotation]] ( [[spawnpoint]] spawn )
 
[[int]] [[getspawnpointSkin]] ( [[spawnpoint]] spawn )
 
[[bool]] [[setspawnpointRotation]] ( [[element]] spawn, [[float]] rotation )
 
[[bool]] [[setspawnpointSkin]] ( [[element]] spawn, [[int]] skin )
 
==Text functions==
==Text functions==
[[textdisplay]] [[textCreateDisplay]] ()
{{Text functions}}
 
[[void]] [[textDestroyDisplay]] ( [[textdisplay]] textdisplay )
 
[[textitem]] [[textCreateTextItem]] ( [ [[string]] text, [[float]] x, [[float]] y, [[int]] priority, [[int]] r, [[int]] g, [[int]] b, [[int]] a, [[float]] scale ] )
 
[[void]] [[textDestroyTextItem]] ( [[textitem]] textitem )
 
[[void]] [[textDisplayAddText]] ( [[textdisplay]] textdisplay, [[textitem]] textitem )
 
[[void]] [[textDisplayAddObserver]] ( [[textdisplay]] textdisplay, [[player]] player )
 
[[void]] [[textItemSetText]] ( [[textitem]] textitem, [[string]] text )
 
[[string]] [[textItemGetText]] ( [[textitem]] textitem )
 
[[void]]] [[textItemSetScale]] ( [[textitem]] textitem, [[float]] scale )
 
[[float]] [[textItemGetScale]] ( [[textitem]] textitem )
 
[[void]] [[textItemSetPosition]] ( [[textitem]] textitem, [[float]] x, [[float]] y )
 
[[float]] [[float]] [[textItemGetPosition]] ( [[textitem]] textitem )
 
[[void]] [[textItemSetColor]] ( [[textitem]] textitem, [[int]] r, [[int]] g, [[int]] b, [[int]] a )
 
[[int]] [[int]] [[int]] [[int]] [[textItemGetColor]] ( [[textitem]] textitem )
 
[[void]] [[textItemSetPriority]] ( [[textitem]] textitem, [[int]] priority )
 
[[int]] [[textItemGetPriority]] ( [[textitem]] textitem )
 
==Utility functions==
==Utility functions==
[[float]] [[getDistanceBetweenPoints2D]] ( [[float]] x1, [[float]] y1, [[float]] x2, [[float]] y2 )
{{Utility functions|server}}
 
[[float]] [[getDistanceBetweenPoints3D]] ( [[float]] x1, [[float]] y1, [[float]] z1, [[float]] x2, [[float]] y2, [[float]] z2 )
==UTF8 Library==
 
'''Shared'''
[[int]] [[randInt]] ( [[int]] lowerbound, [[int]] upperbound )
{{UTF8 functions}}
 
[[float]] [[randFloat]] ()
 
[[int]] [[getTickCount]] ()
 
[[string]] [[gettok]] ( [[string]] text, [[int]] index, [[int]] separator )
 
[[bool]] [[setTimer]] ( [[string]] function, [[int]] time, [ [[var]] argument1, [[var]] argument2, ... ] )
 
==Vehicle functions==
==Vehicle functions==
[[vehicle]] [[createVehicle]] ( [[int]] id, [[float]] x, [[float]] y, [[float]] z, [ [[float]] rx, [[float]] ry, [[float]] rz ] )
{{Vehicle functions|server}}
 
[[bool]] [[destroyAllVehicles]] ()
==Water functions==
 
'''Shared'''
[[int]] [[int]] [[int]] [[int]] [[getVehicleColor]] ( [[vehicle]] vehicle )
{{Water functions}}
 
[[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]] [[fixVehicle]] ( [[element]] vehicle )
 
[[bool]] [[blowVehicle]] ( [[element]] vehicle, [ [[bool]] explode=true ] )
 
[[bool]] [[setVehicleRotation]] ( [[element]] vehicle, [[float]] rx, [[float]] ry, [[float]] rz )
 
[[bool]] [[setVehicleMoveSpeed]] ( [[element]] vehicle, [[float]] x, [[float]] y, [[float]] z )
 
[[bool]] [[setVehicleTurnSpeed]] ( [[element]] vehicle, [[float]] rx, [[float]] ry, [[float]] rz )
 
[[bool]] [[setVehicleHealth]] ( [[element]] vehicle, [[float]] health )
 
[[bool]] [[setVehicleColor]] ( [[element]] vehicle, [[int]] color1, [[int]] color2, [[int]] color3, [[int]] color4 )
 
[[bool]] [[setVehicleLocked]] ( [[element]] vehicle, [[bool]] locked )


==Weapon functions==
==Weapon functions==
[[string]] [[getWeaponNameFromID]] ( [[int]] id )
{{Weapon functions|server}}
 
[[int]] [[getWeaponIDFromName]] ( [[string]] name )
 
[[bool]] [[giveWeapon]] ( [[element]] player, [[int]] [[weapon]], [ [[int]] ammo=30 ] )
 
[[bool]] [[takeWeapon]] ( [[element]] player, [[int]] [[weapon]] )
 
[[bool]] [[takeAllWeapons]] ( [[element]] player )
 
==World functions==
==World functions==
[[int]] [[int]] [[getTime]] ()
{{World functions|server}}
 
[[int]] [[getWeather]] ()
 
[[bool]] [[setTime]] ( [[int]] hour, [[int]] min )
 
[[bool]] [[setWeather]] ( [[int]] id )
 
[[bool]] [[setWeatherBlended]] ( [[int]] id )
 
==XML functions==
==XML functions==
[[xmlnode]] [[xmlFindSubNode]] ( [[xmlnode]] parent, [[string]] subnode, [[int]] index )
'''Shared'''
 
{{XML functions}}
[[string]] [[xmlNodeGetValue]] ( [[xmlnode]] xmlnode )
 
[[bool]] [[xmlNodeSetValue]] ( [[xmlnode]] xmlnode, [[var]] value )
 
[[string]] [[xmlNodeGetAttribute]] ( [[xmlnode]] xmlnode, [[string]] name )
 
[[bool]] [[xmlNodeSetAttribute]] ( [[xmlnode]] xmlnode, [[string]] name, [[var]] value )
 
[[xmlnode]] [[xmlLoadFile]] ( [[string]] filename )


[[bool]] [[xmlUnloadFile]] ( [[xmlnode]] xmlnode )
[[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