-
Posts
285 -
Joined
-
Last visited
Everything posted by dugasz1
-
No but it should work as far as i know. Sometime it loads it.
-
At line 4 xmlLoadFile return with false. Like it's not found the file but it's there. So the rootNode variable become false.
-
:xml stands for the path of the xml resource. So the file is in the xml resource's root directory.
-
Hello guys! I have a weir issu (or just i don't see what is the problem) So i wanted to write a script which saves a table. But if i call my saveTable method it doesn't load the xml file just create one then overwrite it. And i don't have a clue why... function open( path, version ) --outputDebugString("XML: open called", 1) outputDebugString(rootNode, 1) rootNode = xmlLoadFile(path) outputDebugString(rootNode, 1) if (not rootNode) then outputDebugString(path) rootNode = xmlCreateFile(path, "root") xmlNodeSetAttribute(rootNode, "version", version) xmlCreateChild(rootNode, "tables") outputDebugString("XML: rootNode created", 2) else outputDebugString("XML: rootNode exist",2) local _version = xmlNodeGetAttribute (rootNode, "version") if(tostring(version) ~= _version) then close() outputDebugString("XML: Deleted",2) fileDelete(path) open(path, version) end end end function close( ) xmlSaveFile (rootNode) xmlUnloadFile (rootNode) rootNode = nil outputDebugString("XML: Save and Unload") end function saveTable (path, table, name, version) open(path, version) outputDebugString(rootNode) local tableNode = xmlCreateChildIfNotExist(xmlFindChild(rootNode, "tables", 0), name) outputDebugString(rootNode) saveTableRecursive(path, table, name, tableNode) outputDebugString(rootNode) close() outputDebugString("XML: Table lementve") end function saveTableRecursive (path, table, name, node) for k,v in pairs(table) do local vType = type(v) if (vType == "table") then local newNode = xmlCreateChild(node, k) outputDebugString("XML: Table recurssive") saveTableRecursive (path, v, name, newNode) elseif( (vType == "string") or (vType == "number") or (vType == "boolean") ) then local insertValue = xmlCreateChild(node, k) xmlNodeSetAttribute(insertValue, "type", vType) xmlNodeSetValue(insertValue, tostring(v)) else outputDebugString("XML: Not supported type: "..vType, 1) end end end function xmlCreateChildIfNotExist(parentNode, tagName) local child = xmlFindChild(parentNode, tagName, 0) if not child then child = xmlCreateChild(parentNode, tagName) end return child end local asd = { {x=2, y=5, width=100, height = 200}, {x=44, y=50, width=100, height = 30}, ["test"] = {x=2, y = 5, width = 100, height = false}, } saveTable(":xml/test1.xml", asd, "tesztTable", "1.0") saveTable(":xml/test1.xml", asd, "tesztTable2", "1.0") It fails on line 4. rootNode will be false. What do i do wrong or it is a known issue? PS.: If a got to the file open it and delete a few rows it founds it somewhy.
-
It sounds great. I don't have problem with the streaming yet (I use the default SA map but an inprovement would be great like for example on costume race or DD maps. If i get it right and the streaming is the resason if an object load too late.) I mostly interested in the id limit, new objects, vehicles etc.
-
Hello guys! I don't know much about shadders but is it possible to blur a box on the screen with x pixel width , y pixel height and k pixel border-radius? And if it's possible, can you explain me or send an example (or a shadder file)?
-
Yes it looks like it's predefined and this is the only avaible function in it (yet, i guess) Source: https://wiki.multitheftauto.com/wiki/CEF_Tutorial (6 Lua <==> Javascript communication) The remaing guestion is it fast enough on slow PCs too?
-
Thank you i appreciate you'r answer. Well yes i meant that. Making the look in HTML and css and interact with JS and Lua. Yes a saw that resource it helps to know how to do it but not to understand it. There is a function he/she use in js to communicate with lua: mta.triggerEvent but where is this mta class (i guess it's a class) come from? What can it do?
-
Hello guys. I'm writing a costume GUI system with dx functions but it is possible with a browser too. What do you guys think which way should i do? Which has better performance? My dx GUI is simple (recentagle shaped) but if i make it with browser i would make a more fancy GUI (I mean curved border, nice animations with HTML5 or maybe responsive with media queries) MTA can handle this on a slow PC too? And can someone link some docs or examples about this JavaScript <-> Lua communication? How i JS call a Lua func or Lua a JS func?
-
I don't know is it driveable but my experience with it that you can't enter it (with enter). It's bulletproof (zero damage) and it's not moveable (like it's freezed). Looks like it's just an object if it's created on client side.
- 8 replies
-
- warppedintovehicle
- player
-
(and 1 more)
Tagged with:
-
Hello! Is it possible to make callbacks through resource without exports ? Like: resource1: function addCallback(theFunc) --Somehow store the func for later end function callCallback() --Call the callback when it's needed end resource2: function callback() --Callback handle something end exports.resource1:addCallback(callback) --Added the callback Any tip or solution?
-
player and i variable isn't defined in line 30. Use localPlayer instead player draw it in a for.
-
Happy to hear that. Thanks you !
-
Hello everybody! It's just kindy a suggestion but don't know where to put this topic. So, is the forum lua highlither avaible somewhere? It would be usefull for the community in my opinion (or at least for me ). (Sorry i'm blind.. Site/Forum/IRC/Mantis/Wiki related. Can someone please move it? I can't delete it )
-
Well sorry but then i don't understand what you managed to do.
-
I don't get it what do you want to do exactly and how the groups are created. Randomly or somehow. But if it sure there will be a X somewhere in your groups then you have to just serch for the max value. ( In your examples there was always an x in the groups) local groups = { {1,3,4}, {3,4,5}, {1,2,4}, {1,2,5}, {2,3,5} } function getGroupX (t) --Which is the highest value of groups local x = false --return false if table is empty for _,row in pairs(t) do for _,number in pairs(row) do if(x == false) then x = number elseif(number > x) then x = number end end end return x end getGroupX(groups) --will return with 5
-
~~server~~ function getinfo() local result = mysql_query(handler, "SELECT * FROM account WHERE mtaserial='"..getPlayerSerial(source).."'") numRows = mysql_num_rows ( result ) if numRows == 1 then if (result) then while true do local data = mysql_fetch_assoc(result) if (not data) then break end email = tostring(data["email"]) --Dunno why you need the email but i trigged it to the client tooo surname = tostring(data["surname"]) outputChatBox( "Surname: ".. surname ) --Check what is in your database what we sand to the client triggerClientEvent(source, "selectt", getRootElement(), email, surname) end mysql_free_result(result) else end end end ~~client~~ function show (email, surname) if ( ( source == playerstable ) ) then if ( guiGridListGetSelectedItem( playerstable ) ~= -1 ) then guiSetText ( accountnamelabel, "AccountName : "..surname.."" ) end end end addEvent("selectt",true) addEventHandler("selectt",getRootElement(),show) I don't know how your database looks like. PS.: sql modele is not recommended to use rather use MTA SQL_functions