Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 18/10/17 in all areas

  1. It's not only about elementdata, the case you describe can be a sign that your gamemode/scripts were just coded inefficiently, maybe not by very skilled scripters. You can achieve functionality of the desired script in several ways, using different kind of techniques, and one can be more well-thought out than the other approach. A good scripter won't start writing immediately, but will draw a plan or design an efficient core which he'll work from in that moment to add all functionality. Sometimes it's said; development is 60% planning/thinking it out and 40% actively writing. If you first brainstorm about effective approaches and then pick the most performance friendly one, you'll not easily end up with the problem you are encountering now. @Axel to resolve this I advise looking in performancebrowser (or ingame ''ipb'' default resource) to see which resource is peaking in usage with that amount of players, or just regularly, so you can make a list of culprits. Then take a look at each of those resources and identify the structural problems, so you can improve its code efficiency (you can call this ''duct taping'' already doomed resources, or just rewrite chunks using different and optimized techniques, then re-check on IPB/performance browser with the updated version if those rewritten parts were at the heart of the performance problem.. for some stuff you see in the code you can just know it plays a role in the slowdowns though)
    2 points
  2. ادري بتسوي مود بتسوي صاروخ مثلا , لكن وش الي تبي تسويه
    2 points
  3. Thank you everybody, I managed to make it as accurate as possible by using onClientCursorMove. To answer a few questions: I would drag the scroll bar by comparing the absolute position clicked (by using onClientClick) with the float position returned by getCursorPosition multiplied by the screenHeight. I used math.ceil in order to move the scroll bar if there was even a slight difference to approximate the distance between those two positions to one unit. The "problem" was that sometimes the absolute position clicked and the float multiplied by the scren height would not be the same (even though I haven't moved the cursor yet) perhaps by a few pixels, which ended up moving the scroll bar as if I had moved the cursor. This wasn't a huge problem and I know I could have fixed it by not using math.ceil for any value between 0 and 1, but before trying that I was curious if there was any function/event I missed (and it turns out there was). So thanks again ^^
    1 point
  4. Since the problem comes from dx scrollbar, DGS(a dx lib) can help him to solve the problem and give him a reference.
    1 point
  5. أولاً كلامي ماهو انتقاد بالعكس تحسين من استضافتك .. ثانياً .. في أخطاء .. وش تقصد بصيانة 24 ساعة بهالكلام يعني ماحد يقدر يشتري سيرفر لين ماتنتهي الصيانة .. + ثالثاً: انت ماخذ دومين مجاني وماحد يقدر يثق فيك بسهولة لأزم تاخذ اشياء تخلي العميل يثق فيك اكثر + رابعاً : ياليت لو تراجع موضوع ميكرو وكلامه للحين ماحد اهتم له .. فأتمنى من الجميع مراعاة موضوعه واحترام رأيه وبتوفيق
    1 point
  6. Or try this. onClientCursorMove
    1 point
  7. local scw,sch = guiGetScreenSize() local cursorX,cursorY = getCursorPosition() local absX,absY = cursorX*scw,cursorY*sch Code above will always return correct absolute coordinate. Maybe you have some problem on client click event, because it's dragging.
    1 point
  8. You could easily do query below to get top 10 points SELECT * FROM your_table SORT BY `points` DESC LIMIT 10 Or, you can fetch all data from SQL then store it to LUA table SELECT * FROM `your_table` Every time resource started, and store it to LUA table. addEventHandler("onResourceStart", resourceRoot, function () local Q = dbQuery = (connection, "SELECT * FROM `your_table_here`") local result = dbPoll(Q, -1) points = result end ) Then send it to client using triggerClientEvent And sort it on client side like below. And do iteration to output correct ranking position points = {} -- this table from mysql query table.sort(points, function (a, b) return a.points > b.points end) -- sort table based on their points descending for i, v in pairs(points) do -- Your dx output and coordinate calculation here end And do not forget to update the table for every point change and send it to client, so player get the realtime data.
    1 point
  9. Refer to dgs. https://forum.multitheftauto.com/topic/95964-releasethisdps
    1 point
  10. Something else must be off in your script. For example the way you're drawing the GUI, the positions may be off, or you might have to adjust the mouse pos accordingly. Show us how you're drawing the stuff, in e.x. the positions. Multiplying the positions by the screen size makes it as accurate as it can be. The relative positions that getCursorPosition gives you are just values between 0 and 1, they're fixed they never change. Each pixel you move to will have the same float. It's not a matter of accuracy.
    1 point
  11. إييييسسسس كلأم؟؟
    1 point
  12. ض ، السام معناها أي السم
    1 point
  13. Always a solution: Reduce elementdata updates. Every time you call setElementData(without disabling synchronization), it will send data. (even if the value is the same) I often see people do this: (clientside) addEventHandler("onClientRender", root, function () local data = "random data" setElementData(localPlayer, "key", data) end) He, Frame 1: please update (16 ms later) Frame 2: please update (16 ms later) Frame 3: please update (16 ms later) Etc. Not even a second has past and you almost requested 62 UPDATES! (not sure if there is elementdata reduction clientside, but I don't think so) Which is IDIOTIC! (for the ones who do this, please go in your microwave) Which should/could be done like this: addEventHandler("onClientRender", root, function () local data = "random data" if data ~= getElementData(localPlayer, "key") then setElementData(localPlayer, "key", data) end end) Or this: (serverside) -- element could be a team for key, data in ipairs(example) do setElementData(element, "score", getElementData(element, "score") + 1) end Updating the score to 20? = Tell all clients/players 20x > "I have grown 1 more!" Which is stupid. Should/could be done like this. local score = getElementData(element, "score") or 0 for key, data in ipairs(example) do score = score + 1 end setElementData(element, "score", score)
    1 point
  14. Back in the past there was a website that could convert maps created with the official in game map editor to a corresponding Lua script. Unfortunately tho that website appears to be down by now, so I've created my own converter using some regular expressions to find properties in a map file and generate a corresponding Lua script. Here's how it looks: So why would you convert your maps to Lua then? well there are many reasons, for instance: Reduce file size, converted Lua files is around 20% the size of it's corresponding map file. Ability to use the local cache, obviously a good thing since players won't have to download your maps every time they connect. Easy to customize, only one line needs to be changed to make all objects double sided, breakable etc.. (optional) Attach a discrete blip to each map object so that players can see where custom mappings exist. Since it uses regular expressions it will try to convert any input, no matter if the syntax is right or wrong. All properties from your map files are supported including, position (x,y,z), rotation (x,y,z), interior, dimension, breakable objects, double sided objects, blips and removal of world objects. The site is encrypted with SSL/TLS and nothing is logged or saved to prevent anyone from stealing your valuable maps. Here's the link to the site: https://lua.wuss.pw/
    1 point
  15. الفلوس تلعب بالنفوس ومن غيرها نغوص في وهم الدروس ونتعب ونحوس حسبي الله على الفلوس
    1 point
  16. Yo me llevo bastante bien con DayZ, así que a mi me interesa.
    1 point
  17. A mi me interesa, si quieres conversamos por privado.
    1 point
×
×
  • Create New...