majqq

Members
  • Content Count

    405
  • Joined

  • Last visited

Community Reputation

84 Popular

4 Followers

About majqq

  • Rank
    Thug

Recent Profile Visitors

999 profile views
  1. majqq

    Trigger/tables

    Does triggerEvent have a big performance impact on same side? Need to ask, because i thought about separating some parts of code on certain files.
  2. It worked, thanks again I need to ask about moment when server prepare string with function dbPrepareString, this is the moment when table is created/re-created. I was thinking it's possible that due of timing this will be executed at same time, so data for another player wouldn't save (script re-creates tables). Not sure if it's only my imagination.
  3. What's purpose for elementdata here? Can you send full code? Maybe mistake is somewhere else.
  4. It is, but i couldn't help you. I prefer simple GUI.
  5. majqq

    Server optimization

    You might check that: https://springrts.com/wiki/Lua_Performance Loops, localize variables, unpack, and much more. I don't recommend to use ipairs at all. Int loop is much faster.
  6. dx ~= gui This doesn't work as it is in your code, example code with toggle on/off. local screenW, screenH = guiGetScreenSize() local enabled = true function renderPanel() if enabled then dxDrawRectangle(screenW * 0.3324, screenH * 0.2799, screenW * 0.3609, screenH * 0.3581, tocolor(0, 0, 0, 205), false) dxDrawRectangle(screenW * 0.6428, screenH * 0.2513, screenW * 0.0483, screenH * 0.0208, tocolor(254, 23, 23, 205), false) dxDrawText("Close", screenW * 0.6420, screenH * 0.2513, screenW * 0.6911, screenH * 0.2721, tocolor(255, 255, 255, 205), 1.00, "default", "center", "top", false, false, false, false, false) end end addEventHandler("onClientRender", getRootElement(), renderPanel) function openPanel() enabled = not enabled end addCommandHandler("openpanel", openPanel)
  7. Thanks, but what if i would need to use WHERE to check if serial is matching with a player?
  8. Also, i need to ask about that, it's possible to obtain data from 2 tables in one query? In my case `Players` and `Items`?
  9. Not sure if it's related to your case, but IIYAMA showed me how this could be done for onClientVehicleDamage. For important details, you would need to wait for his answer. In my case: Instead of triggering each hit, damage would be saved in table and after certain time, timer would execute triggerServerEvent, after data is cleared. This is called buffer/data reduction (probably?), as far i know. So, basically you reduce triggerServerEvent calls and you save bandwith. This might be helpful, it's also IIYAMA code local sendingDelay = 100 -- ms local fps = 60 local timeSlice = 1000/fps local dataReduction = sendingDelay/timeSlice print("~"..(dataReduction - 1 ).." x times LESS per "..sendingDelay.."ms") https://www.Lua.org/cgi-bin/demo edit: great timing
  10. iprint result: And i've also check that in SQLite Browser.
  11. I used dbPrepareString in other way (adding items only by modyfing table), could you check if everything is correct? Looks like table and columns created normally. local query_table = {} query_table[#query_table + 1] = dbPrepareString(serverTable.db, "CREATE TABLE IF NOT EXISTS `Items` (`Serial`, ") for i = 1, #serverTable.config.save_items do local item = serverTable.config.save_items[i] local check_index = i == #serverTable.config.save_items and ")" or ", " query_table[#query_table + 1] = dbPrepareString(serverTable.db, "`"..item.."` INT"..check_index) end dbExec(serverTable.db, table.concat(query_table))
  12. Thanks! Could you suggest some community scripts which are using SQLite in good way. I would prefer to learn more from script itself.
  13. It is possible to create 2-3 tables using dbExec once?
  14. Oh. I will experiment more soon. @IIYAMA thanks for sharing this site, i've just noticed that it contains a lot of SQL Stuff which would help me in learning