Jump to content

loadString ugly disadvantage problem.


bandi94

Recommended Posts

Well i dont have any other option to use , I must use loadString (custom maploader). After some small bug's i get it working very well.

I just found out that a big part of FUN(shooter) map's , have an ugly check on start:

if check == "done" return end

well first load works , but secound time loadString keeps in the memory check == "done" from the first time , so secound time the script is not started bk of this check.

I realy dont wanna check all maps 1 by 1 to find this checks and remove them. Is there any way to refres the variables to nil ( variables created/runed by LoadString ) ??????

Link to comment

I read the wiki. But i will need to define all MTA/LUA functions , prity much work here to.

sandbox_table.getLocalPlayer = getLocalPlayer 
sandbox_table.guiGetScreenSize = guiGetScreenSize 
........ 

Well i will copy the client side function from Wiki , and make a batch script to make the jobb ( translate it as : sandbox_table.function = function )

And lett see if it will work.

Link to comment

Well , it's working , in time i will need to add more functions from LUA function's.

If anybody need something like this , here are all the client side functions and some LUA functions

sandbox_table.playSoundFrontEnd = playSoundFrontEnd  
sandbox_table.getRadioChannel = getRadioChannel
sandbox_table.getRadioChannelName = getRadioChannelName
sandbox_table.getSoundEffects = getSoundEffects
sandbox_table.getSoundLength = getSoundLength
sandbox_table.getSoundMaxDistance = getSoundMaxDistance
sandbox_table.getSoundMetaTags = getSoundMetaTags
sandbox_table.getSoundMinDistance = getSoundMinDistance
sandbox_table.getSoundPosition = getSoundPosition
sandbox_table.getSoundSpeed = getSoundSpeed
sandbox_table.getSoundVolume = getSoundVolume
sandbox_table.setSoundEffectEnabled = setSoundEffectEnabled
sandbox_table.isSoundPaused = isSoundPaused
sandbox_table.playSound = playSound
sandbox_table.playSound3D = playSound3D
sandbox_table.playSFX = playSFX
sandbox_table.playSFX3D = playSFX3D
sandbox_table.getSFXStatus = getSFXStatus
sandbox_table.setRadioChannel = setRadioChannel
sandbox_table.setSoundMaxDistance = setSoundMaxDistance
sandbox_table.setSoundMinDistance = setSoundMinDistance
sandbox_table.setSoundPaused = setSoundPaused
sandbox_table.setSoundPosition = setSoundPosition
sandbox_table.setSoundSpeed = setSoundSpeed
sandbox_table.setSoundVolume = setSoundVolume
sandbox_table.stopSound = stopSound
sandbox_table.getSoundBPM = getSoundBPM
sandbox_table.getSoundProperties = getSoundProperties
sandbox_table.setSoundProperties = setSoundProperties
sandbox_table.getSoundFFTData = getSoundFFTData
sandbox_table.getSoundWaveData = getSoundWaveData
sandbox_table.getSoundLevelData = getSoundLevelData
sandbox_table.setSoundPan = setSoundPan
sandbox_table.getSoundPan = getSoundPan
sandbox_table.createBlip = createBlip
sandbox_table.createBlipAttachedTo = createBlipAttachedTo
sandbox_table.getBlipColor = getBlipColor
sandbox_table.getBlipIcon = getBlipIcon
sandbox_table.getBlipSize = getBlipSize
sandbox_table.setBlipColor = setBlipColor
sandbox_table.setBlipIcon = setBlipIcon
sandbox_table.setBlipSize = setBlipSize
sandbox_table.getBlipOrdering = getBlipOrdering
sandbox_table.setBlipOrdering = setBlipOrdering
sandbox_table.getBlipVisibleDistance = getBlipVisibleDistance
sandbox_table.setBlipVisibleDistance = setBlipVisibleDistance
sandbox_table.fadeCamera = fadeCamera
sandbox_table.getCameraTarget = getCameraTarget
sandbox_table.setCameraTarget = setCameraTarget
sandbox_table.getCameraInterior = getCameraInterior
sandbox_table.getCameraMatrix = getCameraMatrix
sandbox_table.setCameraInterior = setCameraInterior
sandbox_table.setCameraMatrix = setCameraMatrix
sandbox_table.setCameraClip = setCameraClip
sandbox_table.getCameraViewMode = getCameraViewMode
sandbox_table.setCameraViewMode = setCameraViewMode
sandbox_table.getCameraGoggleEffect = getCameraGoggleEffect
sandbox_table.setCameraGoggleEffect = setCameraGoggleEffect
sandbox_table.getCamera = getCamera
sandbox_table.addPedClothes = addPedClothes
sandbox_table.getBodyPartName = getBodyPartName
sandbox_table.getClothesByTypeIndex = getClothesByTypeIndex
sandbox_table.getClothesTypeName = getClothesTypeName
sandbox_table.getPedClothes = getPedClothes
sandbox_table.getTypeIndexFromClothes = getTypeIndexFromClothes
sandbox_table.removePedClothes = removePedClothes
sandbox_table.createColCircle = createColCircle
sandbox_table.createColCuboid = createColCuboid
sandbox_table.createColRectangle = createColRectangle
sandbox_table.createColSphere = createColSphere
sandbox_table.createColTube = createColTube
sandbox_table.createColPolygon = createColPolygon
sandbox_table.isElementWithinColShape = isElementWithinColShape
sandbox_table.getElementsWithinColShape = getElementsWithinColShape
sandbox_table.getElementColShape = getElementColShape
sandbox_table.getCursorPosition = getCursorPosition
sandbox_table.setCursorPosition = setCursorPosition
sandbox_table.isCursorShowing = isCursorShowing
sandbox_table.showCursor = showCursor
sandbox_table.getCursorAlpha = getCursorAlpha
sandbox_table.setCursorAlpha = setCursorAlpha
sandbox_table.dxDrawImage = dxDrawImage
sandbox_table.dxDrawImageSection = dxDrawImageSection
sandbox_table.dxDrawLine = dxDrawLine
sandbox_table.dxDrawLine3D = dxDrawLine3D
sandbox_table.dxDrawRectangle = dxDrawRectangle
sandbox_table.dxDrawText = dxDrawText
sandbox_table.dxGetFontHeight = dxGetFontHeight
sandbox_table.dxGetTextWidth = dxGetTextWidth
sandbox_table.dxCreateFont = dxCreateFont
sandbox_table.dxCreateTexture = dxCreateTexture
sandbox_table.dxCreateShader = dxCreateShader
sandbox_table.dxCreateRenderTarget = dxCreateRenderTarget
sandbox_table.dxCreateScreenSource = dxCreateScreenSource
sandbox_table.dxGetMaterialSize = dxGetMaterialSize
sandbox_table.dxSetShaderValue = dxSetShaderValue
sandbox_table.dxSetShaderTessellation = dxSetShaderTessellation
sandbox_table.dxSetShaderTransform = dxSetShaderTransform
sandbox_table.dxSetRenderTarget = dxSetRenderTarget
sandbox_table.dxUpdateScreenSource = dxUpdateScreenSource
sandbox_table.dxGetStatus = dxGetStatus
sandbox_table.dxSetTestMode = dxSetTestMode
sandbox_table.dxGetTexturePixels = dxGetTexturePixels
sandbox_table.dxSetTexturePixels = dxSetTexturePixels
sandbox_table.dxGetPixelsSize = dxGetPixelsSize
sandbox_table.dxGetPixelsFormat = dxGetPixelsFormat
sandbox_table.dxConvertPixels = dxConvertPixels
sandbox_table.dxGetPixelColor = dxGetPixelColor
sandbox_table.dxSetPixelColor = dxSetPixelColor
sandbox_table.dxSetBlendMode = dxSetBlendMode
sandbox_table.dxGetBlendMode = dxGetBlendMode
sandbox_table.dxDrawMaterialLine3D = dxDrawMaterialLine3D
sandbox_table.dxDrawMaterialSectionLine3D = dxDrawMaterialSectionLine3D
sandbox_table.dxSetAspectRatioAdjustmentEnabled = dxSetAspectRatioAdjustmentEnabled
sandbox_table.fxAddBlood = fxAddBlood
sandbox_table.fxAddBulletImpact = fxAddBulletImpact
sandbox_table.fxAddBulletSplash = fxAddBulletSplash
sandbox_table.fxAddDebris = fxAddDebris
sandbox_table.fxAddFootSplash = fxAddFootSplash
sandbox_table.fxAddGlass = fxAddGlass
sandbox_table.fxAddGunshot = fxAddGunshot
sandbox_table.fxAddPunchImpact = fxAddPunchImpact
sandbox_table.fxAddSparks = fxAddSparks
sandbox_table.fxAddTankFire = fxAddTankFire
sandbox_table.fxAddTyreBurst = fxAddTyreBurst
sandbox_table.fxAddWaterHydrant = fxAddWaterHydrant
sandbox_table.fxAddWaterSplash = fxAddWaterSplash
sandbox_table.fxAddWood = fxAddWood
sandbox_table.createElement = createElement
sandbox_table.destroyElement = destroyElement
sandbox_table.getAttachedElements = getAttachedElements
sandbox_table.getElementAttachedOffsets = getElementAttachedOffsets
sandbox_table.getElementCollisionsEnabled = getElementCollisionsEnabled
sandbox_table.getElementAttachedTo = getElementAttachedTo
sandbox_table.getElementBoundingBox = getElementBoundingBox
sandbox_table.getElementByID = getElementByID
sandbox_table.getElementChild = getElementChild
sandbox_table.getElementChildren = getElementChildren
sandbox_table.getElementChildrenCount = getElementChildrenCount
sandbox_table.getElementData = getElementData
sandbox_table.getElementDimension = getElementDimension
sandbox_table.getElementDistanceFromCentreOfMassToBaseOfModel = getElementDistanceFromCentreOfMassToBaseOfModel
sandbox_table.getElementHealth = getElementHealth
sandbox_table.getElementID = getElementID
sandbox_table.getElementInterior = getElementInterior
sandbox_table.getElementParent = getElementParent
sandbox_table.getElementPosition = getElementPosition
sandbox_table.getElementRadius = getElementRadius
sandbox_table.getElementsByType = getElementsByType
sandbox_table.getElementType = getElementType
sandbox_table.getElementVelocity = getElementVelocity
sandbox_table.getRootElement = getRootElement
sandbox_table.isElement = isElement
sandbox_table.isElementAttached = isElementAttached
sandbox_table.isElementLocal = isElementLocal
sandbox_table.isElementOnScreen = isElementOnScreen
sandbox_table.isElementStreamable = isElementStreamable
sandbox_table.isElementStreamedIn = isElementStreamedIn
sandbox_table.isElementWithinColShape = isElementWithinColShape
sandbox_table.getElementsWithinColShape = getElementsWithinColShape
sandbox_table.getElementColShape = getElementColShape
sandbox_table.setElementAlpha = setElementAlpha
sandbox_table.setElementCollisionsEnabled = setElementCollisionsEnabled
sandbox_table.setElementData = setElementData
sandbox_table.setElementDimension = setElementDimension
sandbox_table.setElementDoubleSided = setElementDoubleSided
sandbox_table.setElementHealth = setElementHealth
sandbox_table.setElementID = setElementID
sandbox_table.setElementInterior = setElementInterior
sandbox_table.setElementParent = setElementParent
sandbox_table.setElementPosition = setElementPosition
sandbox_table.setElementStreamable = setElementStreamable
sandbox_table.setElementVelocity = setElementVelocity
sandbox_table.attachElements = attachElements
sandbox_table.detachElements = detachElements
sandbox_table.getElementMatrix = getElementMatrix
sandbox_table.getElementModel = getElementModel
sandbox_table.getElementRotation = getElementRotation
sandbox_table.isElementInWater = isElementInWater
sandbox_table.isElementSyncer = isElementSyncer
sandbox_table.setElementModel = setElementModel
sandbox_table.setElementRotation = setElementRotation
sandbox_table.isElementCollidableWith = isElementCollidableWith
sandbox_table.setElementCollidableWith = setElementCollidableWith
sandbox_table.isElementDoubleSided = isElementDoubleSided
sandbox_table.setLowLODElement = setLowLODElement
sandbox_table.getLowLODElement = getLowLODElement
sandbox_table.isElementLowLOD = isElementLowLOD
sandbox_table.attachElementToElement = attachElementToElement
sandbox_table.detachElementFromElement = detachElementFromElement
sandbox_table.isElementFrozen = isElementFrozen
sandbox_table.setElementFrozen = setElementFrozen
sandbox_table.setElementMatrix = setElementMatrix
sandbox_table.engineImportTXD = engineImportTXD
sandbox_table.engineLoadCOL = engineLoadCOL
sandbox_table.engineLoadDFF = engineLoadDFF
sandbox_table.engineLoadTXD = engineLoadTXD
sandbox_table.engineReplaceCOL = engineReplaceCOL
sandbox_table.engineReplaceModel = engineReplaceModel
sandbox_table.engineRestoreCOL = engineRestoreCOL
sandbox_table.engineRestoreModel = engineRestoreModel
sandbox_table.engineSetAsynchronousLoading = engineSetAsynchronousLoading
sandbox_table.engineSetModelLODDistance = engineSetModelLODDistance
sandbox_table.engineGetModelLODDistance = engineGetModelLODDistance
sandbox_table.engineApplyShaderToWorldTexture = engineApplyShaderToWorldTexture
sandbox_table.engineRemoveShaderFromWorldTexture = engineRemoveShaderFromWorldTexture
sandbox_table.engineGetModelNameFromID = engineGetModelNameFromID
sandbox_table.engineGetModelIDFromName = engineGetModelIDFromName
sandbox_table.engineGetVisibleTextureNames = engineGetVisibleTextureNames
sandbox_table.engineGetModelTextureNames = engineGetModelTextureNames
sandbox_table.addEvent = addEvent
sandbox_table.addEventHandler = addEventHandler
sandbox_table.getEventHandlers = getEventHandlers
sandbox_table.cancelEvent = cancelEvent
sandbox_table.removeEventHandler = removeEventHandler
sandbox_table.triggerEvent = triggerEvent
sandbox_table.triggerServerEvent = triggerServerEvent
sandbox_table.wasEventCancelled = wasEventCancelled
sandbox_table.triggerLatentServerEvent = triggerLatentServerEvent
sandbox_table.getLatentEventHandles = getLatentEventHandles
sandbox_table.getLatentEventStatus = getLatentEventStatus
sandbox_table.cancelLatentEvent = cancelLatentEvent
sandbox_table.createExplosion = createExplosion
sandbox_table.fileClose = fileClose
sandbox_table.fileCreate = fileCreate
sandbox_table.fileDelete = fileDelete
sandbox_table.fileExists = fileExists
sandbox_table.fileFlush = fileFlush
sandbox_table.fileGetPos = fileGetPos
sandbox_table.fileGetSize = fileGetSize
sandbox_table.fileIsEOF = fileIsEOF
sandbox_table.fileOpen = fileOpen
sandbox_table.fileRead = fileRead
sandbox_table.fileRename = fileRename
sandbox_table.fileSetPos = fileSetPos
sandbox_table.fileWrite = fileWrite
sandbox_table.fileCopy = fileCopy
sandbox_table.createFire = createFire
sandbox_table.getChatboxLayout = getChatboxLayout
sandbox_table.guiBringToFront = guiBringToFront
sandbox_table.guiCreateFont = guiCreateFont
sandbox_table.guiGetAlpha = guiGetAlpha
sandbox_table.guiGetEnabled = guiGetEnabled
sandbox_table.guiGetFont = guiGetFont
sandbox_table.guiGetInputEnabled = guiGetInputEnabled
sandbox_table.guiGetInputMode = guiGetInputMode
sandbox_table.guiGetPosition = guiGetPosition
sandbox_table.guiGetProperties = guiGetProperties
sandbox_table.guiGetProperty = guiGetProperty
sandbox_table.guiGetScreenSize = guiGetScreenSize
Link to comment
[...] Or a more flexible way would be to make a copy of the environment at resource startup, before defining anything but local variables (since they aren't stored in the environment table), and then copying it to your sandbox (don't link the sandbox __index metatable event with the copied environment because the map's scripts can then mess with it, instead choose to copy it).
Edited by Guest
Link to comment

Ok , thx. Well i made it how you tell , and i have a habit to make all variables "local" , i use global only when it is absolutely necessary. And the mapLoader is a standalone resource. So if there will be some mess up (very poor chances) it will mess only the client's map , what can be solved with a reconnect.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...