Search the Community
Showing results for tags 'ram'.
-
Hola y buen dia, tengo un problema con script que lee mapas y almacena los datos en tablas, el problema está en que al ejecutar la funcion toda la informacion se almacena en la memoria RAM (pienso que asi es como trabaja) y no encuentro la forma correcta de vaciar esa memoria usada por el script, entonces esto provoca que al ejcutarse varias veces el mismo, se termine consumiendo la meroia del VPS hasta bloquearlo. He probado con varias formas pero ninguna parece funcionar, les adjunto toda la informacion y esperoque puedan ayudarme con este problema. local cacheRead = {} function readMapData(executeElement, mapName) cacheRead[executeElement] = { objects = {}; vehicles = {}; peds = {}; markers = {}; } local meta = xmlLoadFile(":"..mapName.."/meta.xml") if meta then for i, metaData in ipairs(xmlNodeGetChildren(meta)) do local metaTypeData = xmlNodeGetName(metaData) if metaTypeData == "map" then local metaMapFileMap = xmlNodeGetAttribute(metaData,"src") if metaMapFileMap then local mapFile = xmlLoadFile(":"..mapName.."/"..metaMapFileMap) if mapFile then for index, elementsMap in ipairs(xmlNodeGetChildren(mapFile)) do local mapTypeNode = xmlNodeGetName(elementsMap) if mapTypeNode == "object" then table.insert(cacheRead[executeElement]["objects"] ,{ modelId = tonumber(xmlNodeGetAttribute(elementsMap,"model")), interiorID = tonumber(xmlNodeGetAttribute(elementsMap, "interior")) or 0, posX = tonumber(xmlNodeGetAttribute(elementsMap,"posX")), posY = tonumber(xmlNodeGetAttribute(elementsMap,"posY")), posZ = tonumber(xmlNodeGetAttribute(elementsMap,"posZ")), rotX = tonumber(xmlNodeGetAttribute(elementsMap,"rotX")) or 0, rotY = tonumber(xmlNodeGetAttribute(elementsMap,"rotY")) or 0, rotZ = tonumber(xmlNodeGetAttribute(elementsMap,"rotZ")) or 0, }) elseif mapTypeNode == "vehicle" then table.insert(cacheRead[executeElement]["vehicles"] ,{ paintjobID = tonumber(xmlNodeGetAttribute(elementsMap,"paintjob")) or 3, interiorID = tonumber(xmlNodeGetAttribute(elementsMap, "interior")) or 0, dimensionID = tonumber(xmlNodeGetAttribute(elementsMap, "dimension")) or 0, modelID = tonumber(xmlNodeGetAttribute(elementsMap,"model")) or 411, plate = tonumber(xmlNodeGetAttribute(elementsMap,"plate")) or "LATIN-SV", posX = tonumber(xmlNodeGetAttribute(elementsMap,"posX")) or 0, posY = tonumber(xmlNodeGetAttribute(elementsMap,"posY")) or 0, posZ = tonumber(xmlNodeGetAttribute(elementsMap,"posZ")) or 0, rotX = tonumber(xmlNodeGetAttribute(elementsMap,"rotX")) or 0, rotY = tonumber(xmlNodeGetAttribute(elementsMap,"rotY")) or 0, rotZ = tonumber(xmlNodeGetAttribute(elementsMap,"rotZ")) or 0, }) elseif mapTypeNode == "ped" then table.insert(cacheRead[executeElement]["peds"] ,{ modelID = tonumber(xmlNodeGetAttribute(elementsMap,"model")) or 0, interiorID = tonumber(xmlNodeGetAttribute(elementsMap, "interior")) or 0, dimensionID = tonumber(xmlNodeGetAttribute(elementsMap, "dimension")) or 0, posX = tonumber(xmlNodeGetAttribute(elementsMap,"posX")) or 0, posY = tonumber(xmlNodeGetAttribute(elementsMap,"posY")) or 0, posZ = tonumber(xmlNodeGetAttribute(elementsMap,"posZ")) or 0, rotZ = tonumber(xmlNodeGetAttribute(elementsMap,"rotZ")) or 0, alpha = tonumber(xmlNodeGetAttribute(elementsMap,"alpha")) or 255, frozen = tonumber(xmlNodeGetAttribute(elementsMap,"frozen")) or "false", }) elseif mapTypeNode == "marker" then table.insert(cacheRead[executeElement]["markers"] ,{ theType = xmlNodeGetAttribute(elementsMap, "type"), interiorID = tonumber(xmlNodeGetAttribute(elementsMap, "interior")) or 0, posX = tonumber(xmlNodeGetAttribute(elementsMap, "posX")), posY = tonumber(xmlNodeGetAttribute(elementsMap, "posY")), posZ = tonumber(xmlNodeGetAttribute(elementsMap, "posZ")), rotX = tonumber(xmlNodeGetAttribute(elementsMap,"rotX")) or 0, rotY = tonumber(xmlNodeGetAttribute(elementsMap,"rotY")) or 0, rotZ = tonumber(xmlNodeGetAttribute(elementsMap,"rotZ")) or 0, size = tonumber(xmlNodeGetAttribute(elementsMap, "size")), color = xmlNodeGetAttribute(elementsMap, "color"), }) end end xmlSaveFile(mapFile) xmlUnloadFile(mapFile) else return false end end end end xmlSaveFile(meta) xmlUnloadFile(meta) outputDebugString('Fueron leidos los datos del mapa ( '..mapName..' ) correctamente' , 0, 0, 255, 0) meta = nil metaTypeData = nil metaMapFileMap = nil mapFile = nil return cacheRead[executeElement] else outputDebugString('Se produjo un error al leer los datos del mapa ( '..mapName..' )' , 0, 255, 0, 0) return false end end
-
-- client function check( attacker, weapon ) local theVehicle = getPedOccupiedVehicle ( getLocalPlayer ) if getElementType ( weapon ) == "Rammed" then triggerServerEvent ( "kill", resourceRoot, attacker ) else end end addEventHandler("onPlayerDamage"", root, check) -- server function kill(attacker) outputChatBox("Collided.", source) killPed(source, attacker) end addEvent( "kill", true ) addEventHandler( "kill", resourceRoot, kill ) -- Bound to this resource only, saves on CPU usage. addCommandHandler("col", kill )-- this is just to test the kill Hi i am trying to make a script that kills player instantly when hit by a car, can anyone pls help me out nevermind my mistake xDDDDD topic close