Server Scripting Functions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This page lists all the scripting functions that exist already. To request a function or event, use Requested Functions and Events.

World functions

int int getTime ()

int int getWeather ()

bool setTime ( hour, min )

bool setWeather ( primary, secondary )

Player functions

int getPlayerAdminLevel ( player )

int getPlayerCount ()

int getPlayerCurrentWeaponAmmoInClip ( player )

int getPlayerCurrentWeaponID ( player )

player getPlayerFromID ( id )

player getPlayerFromNick ( nick )

float getPlayerHealth ( player )

float getPlayerArmor ( player )

int getPlayerID ( player )

float float float getPlayerMoveSpeed ( player )

float getPlayerMoveSpeedX ( player )

float getPlayerMoveSpeedY ( player )

float getPlayerMoveSpeedZ ( player )

string getPlayerName ( player )

vehicle getPlayerOccupiedVehicle ( player )

int getPlayerOccupiedVehicleSeat ( player )

int getPlayerPing ( player )

float float float getPlayerPosition ( player )

float getPlayerPositionX ( player )

float getPlayerPositionY ( player )

float 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 )

Weapon functions

Dialog-information.png This article needs checking.

Reason(s): giveWeapon and giveWeaponToAll should use ammo as an optional argument. if not specified, default to 0. (give the player the weapon, but no ammo)

bool giveWeapon ( player, weaponid, ammo )

bool giveWeaponToAll ( weaponid, ammo )

bool takeWeapon ( player, weaponid )


Dialog-information.png This article needs checking.

Reason(s): the following function appears to require a useless argument. A dev should check the codebase and see if player really is a required argument for takeWeaponFromAll.

bool takeWeaponFromAll ( player, 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 getVehicleMoveSpeedX ( vehicle )

float getVehicleMoveSpeedY ( vehicle )

float getVehicleMoveSpeedZ ( vehicle )

Dialog-information.png This article needs checking.

Reason(s): getVehicleOccupant is missing an optional [seat] argument

player getVehicleOccupant ( vehicle )

float float float getVehiclePosition ( vehicle )

float getVehiclePositionX ( vehicle )

float getVehiclePositionY ( vehicle )

float getVehiclePositionZ ( vehicle )

float float float getVehicleRotation ( vehicle )

float getVehicleRotationX ( vehicle )

float getVehicleRotationY ( vehicle )

float getVehicleRotationZ ( vehicle )

float float float getVehicleTurnSpeed ( vehicle )

float getVehicleTurnSpeedX ( vehicle )

float getVehicleTurnSpeedY ( vehicle )

float getVehicleTurnSpeedZ ( vehicle )

float float getVehicleTurretPosition ( vehicle )

float getVehicleTurretPositionX ( vehicle )

float 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 )

Marker functions

marker createMarker ( x, y, z, [type, size, r, g, b,] )

bool destroyMarker ( marker )

bool destroyAllMarkers ()

int getMarkerCount ()

marker getMarkerFromID ( id )

int getMarkerType ( marker )

float float float getMarkerPosition ( marker )

float getMarkerPositionX ( marker )

float getMarkerPositionY ( marker )

float getMarkerPositionZ ( marker )

float getMarkerSize ( marker )

int int int getMarkerColor ( marker )

int getMarkerColorRed ( marker )

int getMarkerColorGreen ( marker )

int getMarkerColorBlue ( marker )

bool setMarkerType ( marker, type )

bool setMarkerPosition ( marker, x, y, z )

bool setMarkerSize ( marker, size )

bool setMarkerColor ( marker, r, g, b )

Blip functions

Dialog-information.png This article needs checking.

Reason(s): 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} )

blip createBlip ( r, g, b, a, [x, y, z] )

Dialog-information.png This article needs checking.

Reason(s): 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] )

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 )

Dialog-information.png This article needs checking.

Reason(s): Does setBlipPosition automatically detach a blip that has been attached to something?

bool setBlipPosition ( blip, x, y, z )

bool attachBlipToEntity ( blip, entity )

Object functions

object createObject ( model, x, y, z, [rx, ry, rz] )

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 )

Pickup functions

pickup createPickup ( float x, float y, float z, int type, int amount/weapon, [int ammo] )

bool destroyPickup ( pickup pickup )

bool destroyAllPickups ()

string getPickupName ( pickup pickup )

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 )

Radar area functions

radararea createRadarArea ( x, y, sizex, sizey, r, g, b, a )

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 )

Server functions

int getMaxPlayers ()

bool serverLoggerPrint ( string, [...] )

bool serverChat ( string, [...] )

bool playerPM ( player, string, [...] )

bool showTextForAll ( duration, r, g, b, size, string, [...] )

bool showTextForPlayer ( player, duration, r, g, b, size, string, [...] )

Utility functions

float getDistanceBetweenPoints2D ( x1, y1, x2, y2 )

float getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 )

int randInt ( lowerbound, upperbound )

float randFloat ()

int getTickCount ()

string gettok ( string, index, separatingchar )

bool setTimer ( function, time, [arg1, arg2, ...] )

Map functions

string getLoadedMapName ()

xmlnode getLoadedMapXMLRoot ()

XML functions

xmlnode xmlFindSubNode ( parent, subnode, index )

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 )