SimpleNoob
Members-
Posts
16 -
Joined
-
Last visited
Everything posted by SimpleNoob
-
i did this: function getData() local fileo = fileOpen("test.json") if fileo then local data = fromJSON(fileRead(fileo,fileGetSize(fileo))) local info = unpack(data) for i,v in ipairs(info) do outputConsole(tostring(info[i])) end end end addCommandHandler("getdata",getData) [ [ [ 429, -2004.267578125, -388.42578125, 58.19026947021484, 340.86181640625, 347.5689697265625, 333.8140869140625, false ], [ 429, -2000.91015625, -381.4013671875, 40.339599609375, 240.677490234375, 3.7188720703125, 339.521484375, false ], [ 429, -1999.4091796875, -378.3544921875, 25.79038238525391, 345.78369140625, 4.41650390625, 358.2366943359375, false ] ] ] it only retrieves the first array of the json, how i can get all?
-
Hello, i done a function to save data into a json file, but how i can retrieve that data and save it into an array to each line? This is the code to save data: local veht = {} function saveVehicle(player,cmd,ptarget) local ptarget = ptarget or false local veh = getPedOccupiedVehicle(player) if (veh) then local x,y,z = getElementPosition(veh) local rx,ry,rz = getElementRotation(veh) local id = getElementModel(veh) veht = {["id"] = id, ["x"] = x,["y"] = y,["z"] = z,["rx"] = rx,["ry"] = ry,["rz"] = rz,["ptarget"] = ptarget} local json = toJSON(veht) file = fileOpen("test.json") if file then fileSetPos(file,fileGetSize(file)) fileWrite(file,"\n"..json.."\n") fileClose(file) end end end addCommandHandler("addveh",saveVehicle) and i tried to do a code for test the retrieving but i cant: function getData() local fileo = fileOpen("test.json") if file then local data = fromJSON("id") outputConsole(tostring(tables)) end end addCommandHandler("getdata",getData) how can i retrieve each line into a different array, or load all in one time?
-
Thanks so much! this works
-
but this works to save only one element data for script, exist any method to save all at one time?
-
Hello, how i can save all the element data on the players to the account data when they quit and when they login put again all the element data's? i mean, for avoid the saving on every elementData and do it for all once.
-
Sorry for the double post, how i can get all the data into one child? i have this created "test"> "test2"> "bull"> with this function setFileChild(player,cmd,data) local node = xmlLoadFile("vehicle.xml") local subnode = xmlCreateChild(node,"vehicle") local sucess = xmlNodeSetAttribute(subnode,"vehicletest",data) xmlSaveFile(node) xmlUnloadFile(node) end addCommandHandler("data",setFileChild) how can get all into "vehicle" child and output all?
-
One question, xmlLoadFile dont have only one argument? i mean, in the wiki says that only need the filepath, what is vehicledata?
-
Hello, im working in a vehicle system and i want to save the players vehicle in a file (im thinking on xml or json) and dont remove it when the admin's script restart. My script is getting the players vehicle, but how i can save it into a table and send the table into json? and later to get it and do a loading of that vehicles when the script starts? Im really dont know how to save that vehicles without creating it from 0. Thanks for all and sorry for the bad english :c
-
, yes, that was the problem, i didnt see that , sorry for that
-
but i have this error: and this is the code dxDrawText(""..tostring(getELementData(getLocalPlayer(),"pvpmoney")).."", 1150*sW,530*sH,1150*sW,562*sH,tocolor(0,150,150,255), sH*1, "arial", "center", "center", false, false, true,false,false) where is the problem then?
-
sorry for the double post, but i tested right now, getELementData is a serverside function
-
oh, i didnt think it that way , thanks very much
-
Hello, thanks very much for the help provided by you, my script is working fine but i have a problem, i exported the functions and i want to put the information on a visible dxDrawText, but the functions are serverside, how can i use it and get the money on a client script?
-
With that functions returns nil function test(player) local vipmoneys = getPVPMoney(player) outputChatBox("there is "..tostring(pvpmoneys)) end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),test)
-
Hello, im doing a system of vip money apart of the default gta's money, but i cant export the functions that i done, for example i want to get the number of money that have the target: function getPVPMoney (target) return getElementData (target,"pvpmoney") end later when i use this function, debugscript throws an error saying that expected element not resource-data
