Server Scripting Functions: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 3: Line 3:
==Player functions==
==Player functions==
player [[findPlayer]] ( nick/id )
player [[findPlayer]] ( nick/id )
int [[getPlayerAdminLevel]] ( player )
int [[getPlayerAdminLevel]] ( player )
int [[getPlayerCount]] ()
int [[getPlayerCount]] ()
int [[getPlayerCurrentWeaponAmmoInClip]] ( player )
int [[getPlayerCurrentWeaponAmmoInClip]] ( player )
int [[getPlayerCurrentWeaponID]] ( player )
int [[getPlayerCurrentWeaponID]] ( player )
player [[getPlayerFromID]] ( id )
player [[getPlayerFromID]] ( id )
int [[getPlayerHealth]] ( player )
int [[getPlayerHealth]] ( player )
int [[getPlayerID]] ( player )
int [[getPlayerID]] ( player )
float [[getPlayerMoveSpeedX]] ( player )
float [[getPlayerMoveSpeedX]] ( player )
float [[getPlayerMoveSpeedY]] ( player )
float [[getPlayerMoveSpeedY]] ( player )
float [[getPlayerMoveSpeedZ]] ( player )
float [[getPlayerMoveSpeedZ]] ( player )
string [[getPlayerName]] ( player )
string [[getPlayerName]] ( player )
vehicle [[getPlayerOccupiedVehicle]] ( player )
vehicle [[getPlayerOccupiedVehicle]] ( player )
int [[getPlayerOccupiedVehicleSeat]] ( player )
int [[getPlayerOccupiedVehicleSeat]] ( player )
int [[getPlayerPing]] ( player )
int [[getPlayerPing]] ( player )
float [[getPlayerPositionX]] ( player )
float [[getPlayerPositionX]] ( player )
float [[getPlayerPositionY]] ( player )
float [[getPlayerPositionY]] ( player )
float [[getPlayerPositionZ]] ( player )
float [[getPlayerPositionZ]] ( player )
float [[getPlayerRotation]] ( player )
float [[getPlayerRotation]] ( player )
string [[getPlayerSourceIP]] ( player )
string [[getPlayerSourceIP]] ( player )
float [[getPlayerTurnSpeedX]] ( player )
float [[getPlayerTurnSpeedX]] ( player )
float [[getPlayerTurnSpeedY]] ( player )
float [[getPlayerTurnSpeedY]] ( player )
float [[getPlayerTurnSpeedZ]] ( player )
float [[getPlayerTurnSpeedZ]] ( player )
player [[getRandomPlayer]] ()
player [[getRandomPlayer]] ()
bool [[isPlayerDead]] ( player )
bool [[isPlayerDead]] ( player )
bool [[isPlayerDucked]] ( player )
bool [[isPlayerDucked]] ( player )
bool [[isPlayerMuted]] ( player )
bool [[isPlayerMuted]] ( player )
bool [[killPlayer]] ( player )
bool [[killPlayer]] ( player )


==Weapon functions==
==Weapon functions==
bool giveWeapon ( player, weaponid, ammo )
bool giveWeapon ( player, weaponid, ammo )
bool giveWeaponToAll ( weaponid, ammo )
bool giveWeaponToAll ( weaponid, ammo )
bool takeWeapon ( player, weaponid )
bool takeWeapon ( player, weaponid )
bool takeWeaponFromAll ( player, weaponid )
bool takeWeaponFromAll ( player, weaponid )
bool takeAllWeapons ( player )
bool takeAllWeapons ( player )
bool takeAllWeaponsFromAll ()
bool takeAllWeaponsFromAll ()


==Vehicle functions==
==Vehicle functions==
vehicle createVehicle ( id, x, y, z [, rx, ry, rz] )
vehicle createVehicle ( id, x, y, z [, rx, ry, rz] )
bool destroyVehicle ( vehicle )
bool destroyVehicle ( vehicle )
float getVehicleHealth ( vehicle )
float getVehicleHealth ( vehicle )
int getVehicleID ( vehicle )
int getVehicleID ( vehicle )
int getVehicleIndex ( vehicle )
int getVehicleIndex ( vehicle )
float getVehicleMoveSpeedX ( vehicle )
float getVehicleMoveSpeedX ( vehicle )
float getVehicleMoveSpeedY ( vehicle )
float getVehicleMoveSpeedY ( vehicle )
float getVehicleMoveSpeedZ ( vehicle )
float getVehicleMoveSpeedZ ( vehicle )
player getVehicleOccupant ( vehicle )
player getVehicleOccupant ( vehicle )
float getVehiclePositionX ( vehicle )
float getVehiclePositionX ( vehicle )
float getVehiclePositionY ( vehicle )
float getVehiclePositionY ( vehicle )
float getVehiclePositionZ ( vehicle )
float getVehiclePositionZ ( vehicle )
float getVehicleRotationX ( vehicle )
float getVehicleRotationX ( vehicle )
float getVehicleRotationY ( vehicle )
float getVehicleRotationY ( vehicle )
float getVehicleRotationZ ( vehicle )
float getVehicleRotationZ ( vehicle )
float getVehicleTurnSpeedX ( vehicle )
float getVehicleTurnSpeedX ( vehicle )
float getVehicleTurnSpeedY ( vehicle )
float getVehicleTurnSpeedY ( vehicle )
float getVehicleTurnSpeedZ ( vehicle )
float getVehicleTurnSpeedZ ( vehicle )
float getVehicleTurretPositionX ( vehicle )
float getVehicleTurretPositionX ( vehicle )
float getVehicleTurretPositionY ( vehicle )
float getVehicleTurretPositionY ( vehicle )
bool setVehiclePosition ( vehicle, x, y, z )
bool setVehiclePosition ( vehicle, x, y, z )
bool setVehicleRotation ( vehicle, rx, ry, rz )
bool setVehicleRotation ( vehicle, rx, ry, rz )
bool setVehicleMoveSpeed ( vehicle, x, y, z )
bool setVehicleMoveSpeed ( vehicle, x, y, z )
bool setVehicleTurnSpeed ( vehicle, rx, ry, rz )
bool setVehicleTurnSpeed ( vehicle, rx, ry, rz )
bool setVehicleHealth ( vehicle, health )
bool setVehicleHealth ( vehicle, health )
bool setVehicleColor ( vehicle, color1, color2, color3, color4 )
bool setVehicleColor ( vehicle, color1, color2, color3, color4 )


==Marker functions==
==Marker functions==
marker createMarker ( id, x, y, z, r, g, b )
marker createMarker ( id, x, y, z, r, g, b )
bool destroyMarker ( marker )
bool destroyMarker ( marker )
marker getMarkerFromID ( id )
marker getMarkerFromID ( id )


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


==Object functions==
==Object functions==
object createObject ( model, x, y, z [,rx, ry, rz] )
object createObject ( model, x, y, z [,rx, ry, rz] )
bool destroyObject ( object )
bool destroyObject ( object )
string getObjectName ( object )
string getObjectName ( object )
int getObjectModel ( object )
int getObjectModel ( object )
float getObjectPositionX ( object )
float getObjectPositionX ( object )
float getObjectPositionY ( object )
float getObjectPositionY ( object )
float getObjectPositionZ ( object )
float getObjectPositionZ ( object )
float getObjectRotationX ( object )
float getObjectRotationX ( object )
float getObjectRotationY ( object )
float getObjectRotationY ( object )
float getObjectRotationZ ( object )
float getObjectRotationZ ( object )
bool setObjectName ( object, name )
bool setObjectName ( object, name )
bool setObjectModel ( object, model )
bool setObjectModel ( object, model )
bool setObjectPosition ( object, x, y, z )
bool setObjectPosition ( object, x, y, z )
bool setObjectRotation ( object, x, y, z )
bool setObjectRotation ( object, x, y, z )


==Server functions==
==Server functions==
int getMaxPlayers ()
int getMaxPlayers ()
bool serverLoggerPrint ( string/int/float, ... )
bool serverLoggerPrint ( string/int/float, ... )
bool serverChat ( string/int/float, ... )
bool serverChat ( string/int/float, ... )
bool playerPM ( player, string/int/float... )
bool playerPM ( player, string/int/float... )
bool showTextForAll ( duration, r, g, b, size, string/int/float ... )
bool showTextForAll ( duration, r, g, b, size, string/int/float ... )
bool showTextForPlayer ( player, duration, r, g, b, size, string/int/float ... )
bool showTextForPlayer ( player, duration, r, g, b, size, string/int/float ... )


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


==Map functions==
==Map functions==
string [[getLoadedMapName]] ()
string [[getLoadedMapName]] ()
xmlnode [[getLoadedMapXMLRoot]] ()
xmlnode [[getLoadedMapXMLRoot]] ()


==XML functions==
==XML functions==
xmlnode [[xmlFindSubNode]] ( xmlNode, sub node name, index )
xmlnode [[xmlFindSubNode]] ( xmlNode, sub node name, index )
string [[xmlNodeGetValue]] ( xmlNode )
string [[xmlNodeGetValue]] ( xmlNode )
bool [[xmlNodeSetValue]] ( xmlNode, value )
bool [[xmlNodeSetValue]] ( xmlNode, value )
string [[xmlNodeGetAttribute]] ( xmlNode, attribute name )
string [[xmlNodeGetAttribute]] ( xmlNode, attribute name )
bool [[xmlNodeSetAttribute]] ( xmlNode, attribute name, value )
bool [[xmlNodeSetAttribute]] ( xmlNode, attribute name, value )
xmlnode [[xmlLoadFile]] ( filename )
xmlnode [[xmlLoadFile]] ( filename )
bool [[xmlUnloadFile]] ( xmlnode )
bool [[xmlUnloadFile]] ( xmlnode )

Revision as of 18:11, 23 March 2006

This page lists all the scripting functions that exists.

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 )