Server Scripting Functions: Difference between revisions
Line 167: | Line 167: | ||
==Marker functions== | ==Marker functions== | ||
marker [[createMarker]] ( x, y, z, [type, size, r, g, b | marker [[createMarker]] ( float x, float y, float z, [int type, float size, int r, int g, int b] ) | ||
bool [[destroyAllMarkers]] () | bool [[destroyAllMarkers]] () | ||
Line 173: | Line 173: | ||
int [[getMarkerCount]] () | int [[getMarkerCount]] () | ||
int [[getMarkerType]] ( [[marker]] ) | int [[getMarkerType]] ( [[marker]] marker ) | ||
float [[getMarkerSize]] ( [[marker]] ) | float [[getMarkerSize]] ( [[marker]] marker ) | ||
int int int [[getMarkerColor]] ( [[marker]] ) | int int int [[getMarkerColor]] ( [[marker]] marker ) | ||
bool [[setMarkerType]] ( [[marker]], type ) | bool [[setMarkerType]] ( [[marker]] marker, int type ) | ||
bool [[setMarkerSize]] ( [[marker]], size ) | bool [[setMarkerSize]] ( [[marker]] marker, float size ) | ||
bool [[setMarkerColor]] ( [[marker]], r, g, b ) | bool [[setMarkerColor]] ( [[marker]] marker, int r, int g, int b ) | ||
==Blip functions== | ==Blip functions== |
Revision as of 18:08, 1 May 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 ( string name, string arguments )
bool addEventHandler ( string name, element element, string handler )
bool triggerEvent ( string name, element element, [argument, ...] )
World functions
int int getTime ()
int getWeather ()
bool setTime ( int hour, int min )
bool setWeather ( int id )
bool setWeatherBlended ( int id )
Element functions
bool destroyElement ( element element )
element getRootElement ()
string getElementID ( element element )
element getElementByID ( string name, int index )
var getElementData ( string name )
string getElementType ( element element )
bool setElementID ( element element, string name )
bool setElementData ( element element, string name, var data )
Entity functions
float float float getEntityPosition ( entity entity, float x, float y, float z )
bool setEntityPosition ( element element )
Player functions
int getPlayerCount ()
int getPlayerCurrentWeaponAmmoInClip ( player player )
int getPlayerCurrentWeaponID ( player player )
player getPlayerFromNick ( string nick )
float getPlayerHealth ( player player )
float getPlayerArmor ( player player )
int getPlayerLevel ( player player )
int getPlayerMoney ( player player )
float float float getPlayerMoveSpeed ( player player )
string getPlayerName ( player player )
vehicle getPlayerOccupiedVehicle ( player player )
int getPlayerOccupiedVehicleSeat ( player player )
int getPlayerPing ( player player )
float getPlayerRotation ( player player )
int getPlayerSkin ( player player )
string getPlayerSourceIP ( player player )
bool isPlayerDead ( player player )
bool isPlayerDucked ( player player )
bool isPlayerMuted ( player player )
bool setPlayerRotation ( element player, float rotation )
bool setPlayerSkin ( element player, int id )
bool setPlayerHealth ( element player, float health )
bool setPlayerArmor ( element player, float armor )
bool setPlayerMoney ( element player, int money )
bool givePlayerMoney ( element player, int money )
bool takePlayerMoney ( element player, int money )
bool killPlayer ( element player )
bool warpPlayerIntoVehicle ( player player, vehicle vehicle, [int seat] )
bool removePlayerFromVehicle ( element player )
bool spawnPlayer ( player player, float x, float y, float z, float rotation, int skin )
Weapon functions
bool giveWeapon ( player player, int weapon, [int ammo=30] )
bool giveWeaponToAll ( int weapon, [int ammo=30] )
bool takeWeapon ( player player, int weapon )
bool takeWeaponFromAll ( int weapon )
bool takeAllWeapons ( player player )
bool takeAllWeaponsFromAll ()
Vehicle functions
vehicle createVehicle ( int id, float x, float y, float z, [float rx, float ry, float rz] )
bool destroyAllVehicles ()
int int int int getVehicleColor ( vehicle vehicle )
float getVehicleHealth ( vehicle vehicle )
int getVehicleID ( vehicle vehicle )
int getVehicleIDFromName ( string name )
int getVehicleIndex ( vehicle vehicle )
float float float getVehicleMoveSpeed ( string vehicle )
string getVehicleName ( string vehicle )
string getVehicleNameFromID ( int id )
player getVehicleOccupant ( vehicle vehicle, [int seat=0] )
float float float getVehicleRotation ( vehicle vehicle )
float float float getVehicleTurnSpeed ( vehicle vehicle )
float float getVehicleTurretPosition ( vehicle vehicle )
int getVehicleMaxPassengers ( vehicle vehicle )
bool isVehicleLocked ( vehicle vehicle )
bool setVehicleRotation ( vehicle vehicle, float rx, float ry, float rz )
bool setVehicleMoveSpeed ( vehicle vehicle, float x, float y, float z )
bool setVehicleTurnSpeed ( vehicle vehicle, float rx, float ry, float rz )
bool setVehicleHealth ( vehicle vehicle, float health )
bool setVehicleColor ( vehicle vehicle, int color1, int color2, int color3, int color4 )
bool setVehicleLocked ( vehicle vehicle, bool locked )
Marker functions
marker createMarker ( float x, float y, float z, [int type, float size, int r, int g, int b] )
bool destroyAllMarkers ()
int getMarkerCount ()
int getMarkerType ( marker marker )
float getMarkerSize ( marker marker )
int int int getMarkerColor ( marker marker )
bool setMarkerType ( marker marker, int type )
bool setMarkerSize ( marker marker, float size )
bool setMarkerColor ( marker marker, int r, int g, int 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 destroyBlipAttachedTo ( entity )
bool destroyAllBlips ()
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 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 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 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 )