Server Scripting Functions: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 17: Line 17:
addAccount
addAccount
copyAccountData
copyAccountData
getAccount
[[getAccount]]
getAccountData
getAccountData
getAccountName
getAccountName

Revision as of 01:36, 15 June 2023

Server Scripting Functions Jump to navigationJump to search Contributors: Did you create a page but it's not on this list? Confused? Read: Adding Pages to Categories and Templates This page lists all the server-side scripting functions that have been implemented and are available as native functions. To request a function, create an issue in our GitHub repository.

Please note that the scripting functions can also be extended by loading in dynamic modules that provide new functionality, such as utility functions. These scripting functions are non-native and require the module to be loaded in order to work.

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

For more functions, check the useful functions page.

Client-side scripting functions can be found here: Client Scripting Functions.


Contents Account functions addAccount copyAccountData getAccount getAccountData getAccountName getAccountPlayer getAccountSerial getAccounts getAccountsBySerial getAllAccountData getPlayerAccount isGuestAccount logIn logOut removeAccount setAccountData setAccountPassword getAccountByID getAccountID getAccountIP getAccountsByData getAccountsByIP setAccountName

ACL functions aclCreate aclCreateGroup aclDestroy aclDestroyGroup aclGet aclGetGroup aclGetName aclGetRight aclGroupAddACL aclGroupAddObject aclGroupGetName aclGroupList aclGroupListACL aclGroupListObjects aclGroupRemoveACL aclGroupRemoveObject aclList aclListRights aclReload aclRemoveRight aclSave aclSetRight hasObjectPermissionTo isObjectInACLGroup

Admin functions addBan banPlayer getBanAdmin getBanIP getBanNick getBanReason getBanSerial getBanTime getBanUsername getBans getUnbanTime isBan kickPlayer setBanAdmin setBanNick setBanReason setUnbanTime reloadBans removeBan

Audio functions playSoundFrontEnd

Announcement functions getGameType getMapName getRuleValue removeRuleValue setGameType setMapName setRuleValue

Blip functions createBlip createBlipAttachedTo getBlipColor getBlipIcon getBlipOrdering getBlipSize getBlipVisibleDistance setBlipColor setBlipIcon setBlipOrdering setBlipSize setBlipVisibleDistance

Camera functions fadeCamera getCameraInterior getCameraMatrix getCameraTarget setCameraInterior setCameraMatrix setCameraTarget

Clothes and body functions getBodyPartName getClothesByTypeIndex getClothesTypeName getTypeIndexFromClothes

Collision shape functions addColPolygonPoint createColCircle createColCuboid createColPolygon createColRectangle createColSphere createColTube

  • FEATURE ADDED IN 1.5.9 (REVISION: r20807)

getColPolygonHeight getColPolygonPoints getColPolygonPointPosition getColShapeType getColShapeRadius getColShapeSize getElementColShape getElementsWithinColShape isElementWithinColShape isInsideColShape removeColPolygonPoint

  • FEATURE ADDED IN 1.5.9 (REVISION: r20807)

setColPolygonHeight setColPolygonPointPosition setColShapeRadius setColShapeSize

Cursor functions isCursorShowing showCursor

Element functions addElementDataSubscriber attachElements clearElementVisibleTo cloneElement createElement destroyElement detachElements getAllElementData getAttachedElements getElementAlpha getElementAttachedOffsets getElementAttachedTo getElementCollisionsEnabled getElementByID getElementByIndex getElementChild getElementChildren getElementChildrenCount getElementColShape getElementData getElementDimension getElementHealth getElementID getElementInterior getElementMatrix getElementModel getElementParent getElementPosition getElementRotation getElementSyncer getElementType getElementVelocity getElementZoneName getElementsByType getElementsWithinColShape getElementsWithinRange getLowLODElement getRootElement hasElementData hasElementDataSubscriber isElement isElementAttached isElementCallPropagationEnabled isElementDoubleSided isElementFrozen isElementInWater isElementLowLOD isElementVisibleTo isElementWithinColShape isElementWithinMarker removeElementData removeElementDataSubscriber setElementAlpha setElementAngularVelocity getElementAngularVelocity setElementAttachedOffsets setElementCallPropagationEnabled setElementCollisionsEnabled setElementData setElementDimension setElementDoubleSided setElementFrozen setElementHealth setElementID setElementInterior setElementModel setElementParent setElementPosition setElementRotation setElementSyncer setElementVelocity setElementVisibleTo setLowLODElement

Event functions addEvent addEventHandler cancelEvent cancelLatentEvent getCancelReason getEventHandlers getLatentEventHandles getLatentEventStatus removeEventHandler triggerEvent triggerClientEvent triggerLatentClientEvent wasEventCancelled

Explosion functions createExplosion

File functions fileClose fileCopy fileCreate fileDelete fileExists fileFlush fileGetPath fileGetPos fileGetSize fileIsEOF fileOpen fileRead fileRename fileSetPos fileWrite

HTTP functions These functions can only be used from within lua blocks in HTML pages hosted by the server

httpClear httpRequestLogin httpSetResponseCode httpSetResponseCookie httpSetResponseHeader httpWrite

Input functions addCommandHandler bindKey executeCommandHandler getCommandHandlers getControlState getFunctionsBoundToKey getKeyBoundToFunction isControlEnabled isKeyBound removeCommandHandler setControlState toggleAllControls toggleControl unbindKey

Map functions loadMapData resetMapInfo saveMapData

Marker functions createMarker getMarkerColor getMarkerCount getMarkerIcon getMarkerSize getMarkerTarget getMarkerType setMarkerColor setMarkerIcon setMarkerSize setMarkerTarget setMarkerType

Matrix functions Matrix Vector/Vector2 Vector/Vector3 Vector/Vector4

Module functions getLoadedModules getModuleInfo

Object functions createObject getObjectScale moveObject setObjectScale stopObject ADDED/UPDATED IN VERSION 1.6.0 r21765: isObjectBreakable setObjectBreakable

Output functions clearChatBox outputChatBox outputConsole outputDebugString outputServerLog showChat

Ped functions addPedClothes createPed getPedAmmoInClip getPedArmor getPedClothes getPedContactElement getPedFightingStyle getPedGravity getPedOccupiedVehicle getPedOccupiedVehicleSeat getPedStat getPedTarget getPedTotalAmmo getPedWalkingStyle getPedWeapon getPedWeaponSlot getValidPedModels isPedChoking isPedDead isPedDoingGangDriveby isPedDucked isPedHeadless isPedInVehicle isPedOnFire isPedOnGround isPedWearingJetpack killPed reloadPedWeapon removePedClothes removePedFromVehicle setPedAnimation setPedAnimationProgress setPedAnimationSpeed setPedArmor setPedChoking setPedDoingGangDriveby setPedFightingStyle setPedGravity setPedHeadless setPedOnFire setPedStat setPedWalkingStyle setPedWeaponSlot setPedWearingJetpack warpPedIntoVehicle

Pickup functions createPickup getPickupAmmo getPickupAmount getPickupRespawnInterval getPickupType getPickupWeapon isPickupSpawned setPickupRespawnInterval setPickupType usePickup

Player functions forcePlayerMap getAlivePlayers getDeadPlayers getPlayerACInfo getPlayerAnnounceValue getPlayerBlurLevel getPlayerCount getPlayerFromName getPlayerIdleTime getPlayerIP getPlayerMoney getPlayerName getPlayerNametagColor getPlayerNametagText getPlayerPing getPlayerScriptDebugLevel getPlayerSerial getPlayerTeam getPlayerVersion getPlayerWantedLevel getRandomPlayer givePlayerMoney isPlayerMapForced isPlayerMuted isPlayerNametagShowing isVoiceEnabled redirectPlayer resendPlayerACInfo resendPlayerModInfo setPlayerAnnounceValue setPlayerBlurLevel setPlayerHudComponentVisible setPlayerMoney setPlayerMuted setPlayerName setPlayerNametagColor setPlayerNametagShowing setPlayerNametagText setPlayerScriptDebugLevel setPlayerTeam setPlayerVoiceBroadcastTo setPlayerVoiceIgnoreFrom setPlayerWantedLevel spawnPlayer takePlayerMoney takePlayerScreenShot

Projectile functions detonateSatchels

Radar area functions createRadarArea getRadarAreaColor getRadarAreaSize isInsideRadarArea isRadarAreaFlashing setRadarAreaColor setRadarAreaFlashing setRadarAreaSize

Resource functions abortRemoteRequest addResourceConfig addResourceMap call callRemote copyResource createResource deleteResource fetchRemote getRemoteRequestInfo getRemoteRequests getResourceACLRequests getResourceConfig getResourceDynamicElementRoot getResourceExportedFunctions getResourceFromName getResourceInfo getResourceLastStartTime getResourceLoadFailureReason getResourceLoadTime getResourceMapRootElement getResourceName getResourceOrganizationalPath getResourceRootElement getResources getResourceState getThisResource isResourceArchived isResourceProtected refreshResources removeResourceFile renameResource restartResource setResourceInfo startResource stopResource updateResourceACLRequest

Server functions getFPSLimit getMaxPlayers getServerHttpPort getServerName getServerPassword getServerPort getVersion isGlitchEnabled

  • FEATURE ADDED IN 1.5.9 (REVISION: r20788)

isTransferBoxAlwaysVisible isTransferBoxVisible setFPSLimit setGlitchEnabled setMaxPlayers setServerPassword

  • FEATURE ADDED IN 1.5.9 (REVISION: r20788)

setTransferBoxVisible shutdown

Settings registry functions get set

SQL functions executeSQLQuery dbConnect dbExec dbFree dbPoll dbPrepareString dbQuery

Team functions countPlayersInTeam createTeam getPlayerTeam getPlayersInTeam getTeamColor getTeamFriendlyFire getTeamFromName getTeamName setPlayerTeam setTeamColor setTeamFriendlyFire setTeamName

Text functions textCreateDisplay textCreateTextItem textDestroyDisplay textDestroyTextItem textDisplayAddObserver textDisplayAddText textDisplayGetObservers textDisplayIsObserver textDisplayRemoveObserver textDisplayRemoveText textItemGetColor textItemGetPosition textItemGetPriority textItemGetScale textItemGetText textItemSetColor textItemSetPosition textItemSetPriority textItemSetScale textItemSetText

Utility functions addDebugHook base64Decode base64Encode bitAnd bitNot bitOr bitXor bitTest bitLRotate bitRRotate bitLShift bitRShift bitArShift bitExtract bitReplace debugSleep decodeString deref encodeString fromJSON BETA: NEW FEATURE (BUILD: 1.5.9 r21055) generateKeyPair getColorFromString getDevelopmentMode getDistanceBetweenPoints2D getDistanceBetweenPoints3D getEasingValue getFPSLimit getNetworkStats getNetworkUsageData getPerformanceStats BETA: NEW FEATURE (BUILD: 1.5.9 r21389) getProcessMemoryStats getRealTime getServerConfigSetting getTickCount getTimerDetails getTimers gettok getUserdataType getVersion hash inspect interpolateBetween iprint isOOPEnabled isTimer killTimer md5 passwordHash passwordVerify pregFind pregMatch pregReplace removeDebugHook ref resetTimer setDevelopmentMode setFPSLimit setServerConfigSetting setTimer sha256 split teaDecode teaEncode tocolor toJSON utfChar utfCode utfLen utfSeek utfSub

UTF8 Library utf8.byte utf8.char utf8.charpos utf8.escape utf8.find utf8.fold utf8.gmatch utf8.gsub utf8.insert utf8.len utf8.lower utf8.match utf8.ncasecmp utf8.next utf8.remove utf8.reverse utf8.sub utf8.title utf8.upper utf8.width utf8.widthindex

Vehicle functions addVehicleSirens addVehicleUpgrade attachTrailerToVehicle blowVehicle createVehicle detachTrailerFromVehicle fixVehicle getModelHandling getOriginalHandling getTrainDirection getTrainPosition getTrainSpeed getVehicleColor getVehicleCompatibleUpgrades getVehicleController getVehicleDoorOpenRatio getVehicleDoorState getVehicleEngineState getVehicleHandling getVehicleHeadLightColor getVehicleLandingGearDown getVehicleLightState getVehicleMaxPassengers getVehicleModelFromName getVehicleName getVehicleNameFromModel getVehicleOccupant getVehicleOccupants getVehicleOverrideLights getVehiclePaintjob getVehiclePanelState getVehiclePlateText getVehicleRespawnPosition getVehicleRespawnRotation getVehicleSirenParams getVehicleSirens getVehicleSirensOn getVehiclesOfType getVehicleTowedByVehicle getVehicleTowingVehicle BEFORE VERSION 1.5.6 : getVehicleTurnVelocity getVehicleTurretPosition getVehicleType getVehicleUpgradeOnSlot getVehicleUpgrades getVehicleUpgradeSlotName getVehicleVariant getVehicleWheelStates isTrainDerailable isTrainDerailed isVehicleBlown isVehicleDamageProof isVehicleFuelTankExplodable isVehicleLocked isVehicleOnGround isVehicleTaxiLightOn removeVehicleSirens removeVehicleUpgrade resetVehicleExplosionTime resetVehicleIdleTime respawnVehicle setModelHandling setTrainDerailable setTrainDerailed setTrainDirection setTrainPosition setTrainSpeed setVehicleColor setVehicleDamageProof setVehicleDoorOpenRatio setVehicleDoorState setVehicleDoorsUndamageable setVehicleEngineState setVehicleFuelTankExplodable setVehicleHandling setVehicleHeadLightColor setVehicleIdleRespawnDelay setVehicleLandingGearDown setVehicleLightState setVehicleLocked setVehicleOverrideLights setVehiclePaintjob setVehiclePanelState setVehiclePlateText setVehicleRespawnDelay setVehicleRespawnPosition setVehicleRespawnRotation setVehicleSirens setVehicleSirensOn setVehicleTaxiLightOn BEFORE VERSION 1.5.6 : setVehicleTurnVelocity setVehicleTurretPosition

  • FEATURE UPDATED IN 1.5.9 (REVISION: r20693)

setVehicleVariant setVehicleWheelStates spawnVehicle toggleVehicleRespawn

Water functions createWater getWaterColor getWaterVertexPosition getWaveHeight resetWaterColor resetWaterLevel setWaterColor setWaterLevel setWaterVertexPosition setWaveHeight

Weapon functions getOriginalWeaponProperty getSlotFromWeapon getWeaponIDFromName getWeaponNameFromID getWeaponProperty giveWeapon setWeaponAmmo setWeaponProperty takeAllWeapons takeWeapon

World functions areTrafficLightsLocked getAircraftMaxVelocity getCloudsEnabled getFarClipDistance getFogDistance getGameSpeed getGravity getHeatHaze getJetpackMaxHeight getJetpackWeaponEnabled getMinuteDuration getMoonSize getOcclusionsEnabled getRainLevel getSkyGradient getSunColor getSunSize getTime getTrafficLightState getWeather getWindVelocity getZoneName isGarageOpen removeWorldModel

  • FEATURE ADDED IN 1.5.9 (REVISION: r20718)

resetColorFilter resetFarClipDistance resetFogDistance resetHeatHaze resetMoonSize resetRainLevel resetSkyGradient resetSunColor resetSunSize resetWindVelocity restoreAllWorldModels restoreWorldModel setAircraftMaxVelocity setCloudsEnabled

  • FEATURE ADDED IN 1.5.9 (REVISION: r20718)

setColorFilter setFarClipDistance setFogDistance setGameSpeed setGarageOpen setGravity setHeatHaze setInteriorSoundsEnabled setJetpackWeaponEnabled setMinuteDuration setMoonSize setOcclusionsEnabled setRainLevel setSkyGradient setSunColor setSunSize setTime setTrafficLightState setTrafficLightsLocked setWeather setWeatherBlended setWindVelocity

XML functions xmlCopyFile xmlCreateChild xmlCreateFile xmlDestroyNode xmlFindChild xmlLoadFile xmlLoadString xmlNodeGetAttribute xmlNodeGetAttributes xmlNodeGetChildren xmlNodeGetName xmlNodeGetParent xmlNodeGetValue xmlNodeSetAttribute xmlNodeSetName xmlNodeSetValue xmlSaveFile xmlUnloadFile Category (++): Changes in 1.5.9(+)