Server Scripting Functions: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 192: Line 192:
int [[getMaxPlayers]] ()
int [[getMaxPlayers]] ()


bool [[serverLoggerPrint]] ( string, ... )
bool [[serverLoggerPrint]] ( string, [...] )


bool [[serverChat]] ( string, ... )
bool [[serverChat]] ( string, [...] )


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


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


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


==Utility functions==
==Utility functions==

Revision as of 10:41, 25 March 2006

Dialog-information.png This article needs checking.

Reason(s): There is an inconsistency in the functions listed here. findPlayer and getPlayerFromID have similar uses. Perhaps FindPlayer should just take a name, instead of either Name or ID.

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

Player functions

player findPlayer ( nick/id )

int getPlayerAdminLevel ( player )

int getPlayerCount ()

int getPlayerCurrentWeaponAmmoInClip ( player )

int getPlayerCurrentWeaponID ( player )

player getPlayerFromID ( id )

int getPlayerHealth ( player )

int getPlayerID ( player )

float getPlayerMoveSpeedX ( player )

float getPlayerMoveSpeedY ( player )

float getPlayerMoveSpeedZ ( player )

string getPlayerName ( player )

vehicle getPlayerOccupiedVehicle ( player )

int getPlayerOccupiedVehicleSeat ( player )

int getPlayerPing ( player )

float getPlayerPositionX ( player )

float getPlayerPositionY ( player )

float getPlayerPositionZ ( player )

float getPlayerRotation ( player )

string getPlayerSourceIP ( player )

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

bool giveWeapon ( player, weaponid, ammo )

bool giveWeaponToAll ( weaponid, ammo )

bool takeWeapon ( player, weaponid )

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

marker createMarker ( id, x, y, z, r, g, b )

bool destroyMarker ( marker )

marker getMarkerFromID ( id )


Blip functions

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

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 )

bool setBlipPosition ( blip, x, y, z )

bool attachBlipToEntity ( blip, entity )


Object functions

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

bool destroyObject ( object )

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 )

bool moveObject ( object, time, x, y, z, rx, ry, rz )

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, seperatingchar )

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 )