• Content Count

  • Joined

  • Last visited

Community Reputation

1 Neutral

About syrasia

  • Rank
  1. The thing is, that this would work, but as my gui text increases (and this will get by far over 10000 strings because of a chat system for npc's) this would get messy. Also I want user to be able to modify the language files, because this way someone cloud implement french or polish for example. And adding to a table in the files would limit me, as I will have multiple resources with the same text later. (Unnecessary redundancy) Therefore a external script in my helper resource will do the job. Now I just want to know the finest solution for a huge amount of data. Is xml still okay for this task? Edit: The language script in the helper resource will do the job of replacing the strings in the gui elements! Not the gui script them self. I already have the basic figured out. What I want to know is more or less, if xml has limits for greater file sizes, if there are drawbacks and if there are alternatives for dynamic (user modifiable) data storage.
  2. Hi there, again I am put before a headache. I want my script (well, only the gui in particular) to be multilingual. At the moment this is only German and English, so no big deal. I give every gui-element a "text-id", and in the sql database i have saved the sentences for German and English respectively. Now, if the client needs a string for a gui element, he request it from the server in the given language. So far so good, but requesting a string over and over again just wastes bandwidth and cpu as hell. And a bit of delay (client request - sql query - server answer - guiSetText). To get rid of this inconvenience I want to safe the already loaded string in a file local on the client, but I don't trust xml to be the best choice for large data storage. I should add; I only read the file once at client startup and store the stings in a table and just for addition of new loaded strings the xml gets updated. No constant access to the xml! And I just thought: the Update can be done at logout? Do scripts finish all given code on unload? Thanks in advance for your help!
  3. Oh well, after a very long annoying evening, where I tried to fix it (sometimes it still overwrites the file), I decided to swap to sql. I even read it some times, that one shouldn't use xml, as ist slow and not good for data storage, but I was to lazy to get int sql. Surprisingly I got into sql query's logic fast and have to say, well I don't need any xml (at the moment) anymore, so this is more or less solved. Still thank you for your help, friends.
  4. Wait, did I maybe misunderstand setElementData? I thought, it is called by the client every time he "changes" like moving or entering a car and so on. Is setElementData only called, if a script calls it? Because I will never use setElementData, as I don't have any use for it. Everything I need can be done with normal functions calls and data for players is stored in tables (easier to access, use and change). Pleas enlighten me on this. And about call from triggerServerEvent: That I already understood and I am already taking care of wrong/bad arguments.
  5. @dugasz1 I think this may be the soulution, becasue I use the date as the node name. Okay, i will change this then somehow.
  6. Alright, and it still overwrites the file. Where is my mistake? xmlErrorLog = nil function systemInit( ) xmlRootNode = xmlLoadFile( "errors.xml" ) if xmlRootNode == false then outputServerLog ( "-----creation of new error file-----" ) xmlRootNode = xmlCreateFile( "errors.xml", "errors" ) end xmlSaveFile( xmlRootNode ) xmlErrorLog = xmlRootNode end addEventHandler( "onResourceStart", getResourceRootElement(), systemInit )
  7. Hi there, I want to make my server as safe as I can. So it is only logic, that I heed the advice from the wiki: Script security Well, the second part (with checking the validness of client and arguments) is very easy for me to do. But for the first part, I can only assume it works, but can't test it, as I don't have a hacked client. I don't want a real hacked client, but still, I would like to test, if a rouge client would get catched and reported by my script security (I only changed the "oputputConsole" to a error report system I already have implemented). With best regards, another MTA:SA freak.
  8. Okay guys, I found my error in the error script.... I somehow was creating a new xml file every time. Don't ask how, I just done it. After changing the script a bit, it works. Sorry to boter you for nothing.
  9. Hi there, I am trying to implement a error system, and i am stuck on the problem, that xmlCreateChild overwrites the old node and so i cant get an error-list. Here is the Code: [lua]--------------------------------------------------Fehler in XML speichern-------------------------------------------------- function registerError( errorType, errorDescription ) local xmlErrorLog = xmlLoadFile( "errorLog.xml" ) if xmlErrorLog == false then xmlErrorLog = xmlCreateFile( "errorLog.xml", "errors" ) end local time = getRealTime( ) -- Die Zeit des Fehlers local timeString = "" .. time["year"]+1900 .. "." .. time["month"]+1 .. "." .. time["monthday"] .. "-" .. time["hour"] .. "." .. time["minute"] .. "." .. time["second"] local xmlNewError = xmlCreateChild( xmlErrorLog, timeString ) xmlNodeSetAttribute( xmlNewError, "type", errorType ) xmlNodeSetAttribute( xmlNewError, "description", errorDescription ) xmlSaveFile( xmlErrorLog ) xmlUnloadFile( xmlErrorLog ) end addEvent( "registerError" ) addEventHandler( "registerError", root, registerError )[/lua] The node should have been the timestamp, as the "new" node needs a new name, but it doesnt work (old nodes get overwriten). Edit: and somehow the [lua] [/lua] code syntax does not work? Sorry for that too!
  10. Okay, that was it for real? ........... F*** me, sorry! Now I know what happend: In an other script it worked. Here it didnt: if u have the bracked, it will get called once. No problem with "onResourceStart", right? But with repeating events ist not so nice. Changed it. Well I would say thank you mate! Aaaaaaand this is solved!
  11. Hi there, I am in the process to script a tooltip. Everything works fine, but I have a problem with the addEventHandler: addEventHandler ( "onClientMouseMove", getRootElement( ), tooltipHandler( ) ) addEventHandler( "onClientMouseMove", getRootElement( ), function ( x, y ) tooltipHandler(x,y) end ) The first one does NOT work while the second one works normal. What I am missing? Why does the second one work, but the first one not?
  12. Okay, thanks for the info/tipp xeon, I looked in the oope_client wiki and found out, that the getPostion() seems to be not aviable for cliend side. The link is realy healpfull. BTW: oop is enabled with true in meta.xml So this is solved, ty
  13. Hi there, I am trying to use OOP where ever i can to learn it. More or less. Nothing special: function f4_get_pos( button, press ) if button == "F4" and (press) then --local x, y, z = getElementPosition(localPlayer) <--This way it works, but no oop local x, y, z = localPlayer:getPosition() <-- throws the error outputChatBox(x) outputChatBox(y) outputChatBox(z) end end addEventHandler("onClientKey", getRootElement(), f4_get_pos) And this is the /debugscript 3 message: attempt to index golbal 'localPlayer' (a userdata value) How do i use oop right in this case? Do i miss somthing? Have a N.I.C.E. day ^^