Server Scripting Functions: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 60: Line 60:


==Weapon functions==
==Weapon functions==
bool [[giveWeapon] ( player, weaponid, ammo )
bool [[giveWeapon]] ( player, weaponid, ammo )


bool [[giveWeaponToAll]] ( weaponid, ammo )
bool [[giveWeaponToAll]] ( weaponid, ammo )
Line 71: Line 71:


bool [[takeAllWeaponsFromAll]] ()
bool [[takeAllWeaponsFromAll]] ()


==Vehicle functions==
==Vehicle functions==

Revision as of 19:08, 23 March 2006

This page lists all the scripting functions that exist.

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 )


Server functions

int getMaxPlayers ()

bool serverLoggerPrint ( string/int/float, ... )

bool serverChat ( string/int/float, ... )

bool playerPM ( player, string/int/float... )

bool showTextForAll ( duration, r, g, b, size, string/int/float ... )

bool showTextForPlayer ( player, duration, r, g, b, size, string/int/float ... )


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 in ms for execution, function arguments ... )


Map functions

string getLoadedMapName ()

xmlnode getLoadedMapXMLRoot ()


XML functions

xmlnode xmlFindSubNode ( xmlNode, sub node name, 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 )