Server Scripting Functions: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 65: Line 65:


float float float [[getPlayerMoveSpeed]] ( player )
float float float [[getPlayerMoveSpeed]] ( player )
float [[getPlayerMoveSpeed|getPlayerMoveSpeedX]] ( player )
float [[getPlayerMoveSpeed|getPlayerMoveSpeedY]] ( player )
float [[getPlayerMoveSpeed|getPlayerMoveSpeedZ]] ( player )


string [[getPlayerName]] ( player )
string [[getPlayerName]] ( player )
Line 145: Line 139:


float float float [[getVehicleMoveSpeed]] ( vehicle )
float float float [[getVehicleMoveSpeed]] ( vehicle )
float [[getVehicleMoveSpeed|getVehicleMoveSpeedX]] ( vehicle )
float [[getVehicleMoveSpeed|getVehicleMoveSpeedY]] ( vehicle )
float [[getVehicleMoveSpeed|getVehicleMoveSpeedZ]] ( vehicle )


string [[getVehicleName]] ( vehicle )
string [[getVehicleName]] ( vehicle )
Line 159: Line 147:


float float float [[getVehicleRotation]] ( vehicle )
float float float [[getVehicleRotation]] ( vehicle )
float [[getVehicleRotation|getVehicleRotationX]] ( vehicle )
float [[getVehicleRotation|getVehicleRotationY]] ( vehicle )
float [[getVehicleRotation|getVehicleRotationZ]] ( vehicle )


float float float [[getVehicleTurnSpeed]] ( vehicle )
float float float [[getVehicleTurnSpeed]] ( vehicle )
float [[GetVehicleTurnSpeed|getVehicleTurnSpeedX]] ( vehicle )
float [[GetVehicleTurnSpeed|getVehicleTurnSpeedY]] ( vehicle )
float [[GetVehicleTurnSpeed|getVehicleTurnSpeedZ]] ( vehicle )


float float [[getVehicleTurretPosition]] ( vehicle )
float float [[getVehicleTurretPosition]] ( vehicle )
float [[GetVehicleTurretPosition|getVehicleTurretPositionX]] ( vehicle )
float [[GetVehicleTurretPosition|getVehicleTurretPositionY]] ( vehicle )


int [[getVehicleMaxPassengers]] ( vehicle )
int [[getVehicleMaxPassengers]] ( vehicle )
Line 212: Line 184:


int int int [[getMarkerColor]] ( [[marker]] )
int int int [[getMarkerColor]] ( [[marker]] )
int [[getMarkerColor|getMarkerColorRed]] ( [[marker]] )
int [[getMarkerColor|getMarkerColorGreen]] ( [[marker]] )
int [[getMarkerColor|getMarkerColorBlue]] ( [[marker]] )


bool [[setMarkerType]] ( [[marker]], type )
bool [[setMarkerType]] ( [[marker]], type )
Line 260: Line 226:


float float float [[getObjectRotation]] ( object )
float float float [[getObjectRotation]] ( object )
float [[getObjectRotationX]] ( object )
float [[getObjectRotationY]] ( object )
float [[getObjectRotationZ]] ( object )


bool [[setObjectModel]] ( object, model )
bool [[setObjectModel]] ( object, model )
Line 296: Line 256:


bool [[destroyAllRadarAreas]] ()
bool [[destroyAllRadarAreas]] ()
float float [[getRadarAreaPosition]] ( radararea )
float [[getRadarAreaPositionX]] ( radararea )
float [[getRadarAreaPositionY]] ( radararea )


float float [[getRadarAreaSize]] ( radararea )
float float [[getRadarAreaSize]] ( radararea )
float [[getRadarAreaSizeX]] ( radararea )
float [[getRadarAreaSizeY]] ( radararea )


int int int int [[getRadarAreaColor]] ( radararea )
int int int int [[getRadarAreaColor]] ( radararea )
int [[getRadarAreaColorRed]] ( radararea )
int [[getRadarAreaColorGreen]] ( radararea )
int [[getRadarAreaColorBlue]] ( radararea )
int [[getRadarAreaColorAlpha]] ( radararea )


bool [[isRadarAreaFlashing]] ( radararea )
bool [[isRadarAreaFlashing]] ( radararea )
bool [[setRadarAreaPosition]] ( radararea, x, y )


bool [[setRadarAreaSize]] ( radararea, x, y )
bool [[setRadarAreaSize]] ( radararea, x, y )

Revision as of 23:17, 30 April 2006

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

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.

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

Event functions

bool addEvent ( name, argumentstring )

bool addEventHandler ( name, element, handler )

bool triggerEvent ( name, element, [argument, ...] )

World functions

int int getTime ()

int getWeather ()

bool setTime ( hour, min )

bool setWeather ( id )

bool setWeatherBlended ( id )

Element functions

string getElementID ( element )

element getElementByID ( name, index )

variable getElementData ( name )

string getElementType ( element )

bool setElementID ( element, name )

bool setElementData ( element, name, variable )

Entity functions

float float float getEntityPosition ( entity entity, x, y, z )

bool setEntityPosition ( element element )

Player functions

bool hasPlayerEnoughMoney ( player, prize )

int getPlayerCount ()

int getPlayerCurrentWeaponAmmoInClip ( player )

int getPlayerCurrentWeaponID ( player )

player getPlayerFromID ( id )

player getPlayerFromNick ( nick )

float getPlayerHealth ( player )

float getPlayerArmor ( player )

int getPlayerID ( player )

int getPlayerLevel ( player )

int getPlayerMoney ( player )

float float float getPlayerMoveSpeed ( player )

string getPlayerName ( player )

vehicle getPlayerOccupiedVehicle ( player )

int getPlayerOccupiedVehicleSeat ( player )

int getPlayerPing ( player )

float getPlayerRotation ( player )

int getPlayerSkin ( player )

string getPlayerSourceIP ( player )

player getRandomPlayer ()

bool isPlayerDead ( player )

bool isPlayerDucked ( player )

bool isPlayerMuted ( player )

bool setPlayerRotation ( player, rotation )

bool setPlayerSkin ( player, id )

bool setPlayerHealth ( player, health )

bool setPlayerArmor ( player, armor )

bool setPlayerMoney ( player, money )

bool givePlayerMoney ( player, money )

bool takePlayerMoney ( player, money )

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 )

int int int int getVehicleColor ( vehicle )

float getVehicleHealth ( vehicle )

int getVehicleID ( vehicle )

int getVehicleIDFromName ( name )

int getVehicleIndex ( vehicle )

float float float getVehicleMoveSpeed ( vehicle )

string getVehicleName ( vehicle )

string getVehicleNameFromID ( id )

player getVehicleOccupant ( vehicle, [seat=0] )

float float float getVehicleRotation ( vehicle )

float float float getVehicleTurnSpeed ( vehicle )

float float getVehicleTurretPosition ( vehicle )

int getVehicleMaxPassengers ( vehicle )

bool isVehicleLocked ( vehicle )

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 )

bool setVehicleLocked ( vehicle, locked )

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 getMarkerSize ( marker )

int int int getMarkerColor ( marker )

bool setMarkerType ( marker, type )

bool setMarkerSize ( marker, size )

bool setMarkerColor ( marker, r, g, b )

Blip functions

blip createBlip ( x, y, z, [icon = 0, size = 2, r = 255, g = 0, b = 0, a = 255] )

blip createBlipAttachedTo ( entity, [icon = 0, size = 2, r = 255, g = 0, b = 0, a = 255] )

bool destroyBlip ( blip )

bool destroyBlipAttachedTo ( entity )

int getBlipIcon ( blip )

int getBlipSize ( blip )

int int int int getBlipColor ( blip )

blip getBlipAttachedTo ( entity )

bool setBlipIcon ( blip, icon )

bool setBlipSize ( blip, size )

bool setBlipColor ( blip, red, green, blue, alpha )

bool attachBlipToEntity ( blip, entity )

Object functions

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

bool destroyObject ( object )

bool destroyAllObjects ()

int getObjectModel ( object )

float float float getObjectRotation ( object )

bool setObjectModel ( object, model )

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

int getPickupType ( pickup pickup )

int getPickupWeapon ( pickup pickup )

int getPickupHealth ( pickup pickup )

int getPickupAmmo ( pickup pickup )

bool setPickupType ( pickup pickup, int type, int amount/weapon, [int ammo] )

Radar area functions

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

bool destroyRadarArea ( radararea )

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 )

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 )