Server Scripting Functions: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
 
(476 intermediate revisions by 68 users not shown)
Line 1: Line 1:
This page lists all the scripting functions that exists.
<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.]


==Player 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.
player [[findPlayer]] ( nick/id )
int [[getPlayerAdminLevel]] ( player )
Head over to [[Modules]] for a list of non-native serverside functions and modules that are available.
int [[getPlayerCount]] ()
int [[getPlayerCurrentWeaponAmmoInClip]] ( player )
For more functions, check the [[Useful_Functions|useful functions page]].
int [[getPlayerCurrentWeaponID]] ( player )
player [[getPlayerFromID]] ( id )
'''Client-side scripting functions can be found here: [[Client Scripting Functions]].'''
int [[getPlayerHealth]] ( player )
__TOC__
int [[getPlayerID]] ( player )
float [[getPlayerMoveSpeedX]] ( player )
==Account functions==
float [[getPlayerMoveSpeedY]] ( player )
{{Account_functions}}
float [[getPlayerMoveSpeedZ]] ( player )
string [[getPlayerName]] ( player )
==ACL functions==
vehicle [[getPlayerOccupiedVehicle]] ( player )
{{ACL_functions}}
int [[getPlayerOccupiedVehicleSeat]] ( player )
int [[getPlayerPing]] ( player )
==Admin functions==
float [[getPlayerPositionX]] ( player )
{{Admin_functions}}
float [[getPlayerPositionY]] ( player )
float [[getPlayerPositionZ]] ( player )
==Audio functions==
float [[getPlayerRotation]] ( player )
'''Shared'''
string [[getPlayerSourceIP]] ( player )
{{Shared_sound_functions}}
float [[getPlayerTurnSpeedX]] ( player )
float [[getPlayerTurnSpeedY]] ( player )
float [[getPlayerTurnSpeedZ]] ( player )
player [[getRandomPlayer]] ()
bool [[isPlayerDead]] ( player )
bool [[isPlayerDucked]] ( player )
bool [[isPlayerMuted]] ( player )
bool [[killPlayer]] ( player )


==Weapon functions==
==Announcement functions==
bool giveWeapon ( player, weaponid, ammo )
{{Announce_functions}}
bool giveWeaponToAll ( weaponid, ammo )
bool takeWeapon ( player, weaponid )
==Blip functions==
bool takeWeaponFromAll ( player, weaponid )
'''Shared'''
bool takeAllWeapons ( player )
{{Shared_blip_functions}}
bool takeAllWeaponsFromAll ()


==Vehicle functions==
==Camera functions==
vehicle createVehicle ( id, x, y, z [, rx, ry, rz] )
'''Shared'''
bool destroyVehicle ( vehicle )
{{Shared_camera_functions}}
float getVehicleHealth ( vehicle )
int getVehicleID ( vehicle )
int getVehicleIndex ( vehicle )
float getVehicleMoveSpeedX ( vehicle )
float getVehicleMoveSpeedY ( vehicle )
float getVehicleMoveSpeedZ ( vehicle )
player getVehicleOccupant ( vehicle )
float getVehiclePositionX ( vehicle )
float getVehiclePositionY ( vehicle )
float getVehiclePositionZ ( vehicle )
float getVehicleRotationX ( vehicle )
float getVehicleRotationY ( vehicle )
float getVehicleRotationZ ( vehicle )
float getVehicleTurnSpeedX ( vehicle )
float getVehicleTurnSpeedY ( vehicle )
float getVehicleTurnSpeedZ ( vehicle )
float getVehicleTurretPositionX ( vehicle )
float getVehicleTurretPositionY ( 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 )


==Marker functions==
==Clothes and body functions==
marker createMarker ( id, x, y, z, r, g, b )
'''Shared'''
bool destroyMarker ( marker )
{{Shared_clothes_and_body_functions}}
marker getMarkerFromID ( id )


==Blip functions==
==Collision shape functions==
blip createBlip ( r, g, b, a [, x, y, z] )
'''Shared'''
blip createBlipAttachedTo ( entity, r, g, b, a )
{{Shared_collision_shape_functions}}
bool destroyBlip ( blip )
bool destroyBlipAttachedTo ( entity )
float, float, float getBlipPosition ( blip )
float getBlipPositionX ( blip )
float getBlipPositionY ( blip )
float getBlipPositionZ ( blip )
bool setBlipPosition ( blip, x, y, z )
bool attachBlipToEntity ( blip, entity )


==Object functions==
==Cursor functions==
object createObject ( model, x, y, z [,rx, ry, rz] )
'''Shared'''
bool destroyObject ( object )
{{Shared_cursor_functions}}
string getObjectName ( object )
int getObjectModel ( object )
float getObjectPositionX ( object )
float getObjectPositionY ( object )
float getObjectPositionZ ( 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 )


==Server functions==
==Element functions==
int getMaxPlayers ()
{{Element_functions}}
bool serverLoggerPrint ( string/int/float, ... )
bool serverChat ( string/int/float, ... )
==Event functions==
bool playerPM ( player, string/int/float... )
{{Event_functions}}
bool showTextForAll ( duration, r, g, b, size, string/int/float ... )
bool showTextForPlayer ( player, duration, r, g, b, size, string/int/float ... )
==Explosion functions==
'''Shared'''
{{Shared_explosion_functions}}


==Utility functions==
==File functions==
float getDistanceBetweenPoints2D ( x1, y1, x2, y2 )
'''Shared'''
float getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 )
{{File_functions}}
int randInt ( lowerbound, upperbound )
float randFloat ()
int getTickCount ()
string gettok ( string, index, seperatingchar )
bool setTimer ( "function", time in ms for execution, function arguments ... )


==HTTP functions==
{{HTTP_functions}}
==Input functions==
{{Server_input_functions}}
==Map functions==
==Map functions==
string [[getLoadedMapName]] ()
{{Map_functions}}
xmlnode [[getLoadedMapXMLRoot]] ()
==Marker functions==
{{Marker_functions}}
==Matrix functions==
'''Shared'''
{{Shared_matrix_functions}}


==Module functions==
{{Module_functions}}
==Object functions==
{{Object_functions}}
==Output functions==
{{Output_functions}}
==Ped functions==
{{Ped_functions}}
==Pickup functions==
{{Pickup_functions}}
==Player functions==
{{Player_functions}}
==Projectile functions==
'''Shared'''
{{Shared_projectile_functions}}
==Radar area functions==
'''Shared'''
{{Shared_radar_functions}}
==Resource functions==
{{Resource_functions}}
==Server functions==
{{Server_functions}}
==Settings registry functions==
{{Settings_registry_functions}}
==SQL functions==
{{SQL_functions}}
==Team functions==
{{Team_functions}}
==Text functions==
{{Text_functions}}
==Utility functions==
{{Utility_functions}}
==UTF8 Library==
{{UTF8_functions}}
==Vehicle functions==
{{Vehicle_functions}}
==Water functions==
{{Water_functions}}
==Weapon functions==
{{Weapon_functions}}
==World functions==
{{World_functions}}
==XML functions==
==XML functions==
xmlnode [[xmlFindSubNode]] ( xmlNode, sub node name, index )
'''Shared'''
string [[xmlNodeGetValue]] ( xmlNode )
{{Shared_xml_functions}}
bool [[xmlNodeSetValue]] ( xmlNode, value )
string [[xmlNodeGetAttribute]] ( xmlNode, attribute name )
 
bool [[xmlNodeSetAttribute]] ( xmlNode, attribute name, value )
[[ar:Server Scripting Functions]]
xmlnode [[xmlLoadFile]] ( filename )
[[de:Server-Seitige Scripting Funktionen]]
bool [[xmlUnloadFile]] ( xmlnode )
[[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 12:59, 30 April 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

Shared


Event functions

Shared



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

Shared


Map functions


Marker functions

Shared


Matrix functions

Shared


Module functions


Object functions

Shared


Output functions

Shared



Ped functions

Shared



Pickup functions

Shared



Player functions

Shared


Projectile functions

Shared

Radar area functions

Shared


Resource functions

Shared



Server functions


Settings registry functions


SQL functions


Team functions

Shared



Text functions


Utility functions

Shared



UTF8 Library

Shared


Vehicle functions

Shared



Water functions

Shared



Weapon functions

Shared



World functions

Shared


XML functions

Shared