Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Simple0x47 last won the day on January 12 2020

Simple0x47 had the most liked content!

About Simple0x47

  • Birthday 21/02/2001


  • Gang
    I'm not a gangster
  • Location
  • Occupation
  • Interests

Recent Profile Visitors

10,321 profile views

Simple0x47's Achievements


Loc (38/54)



  1. I didn't say servers shutting down are only because of the gamemode they use. The take here was whether or not the open source will help to increase the lifespan of a previously leaked gamemode based server, or decrease it, as low as it may be compared with all the management related decisions and tasks.
  2. That's overloading, mate. No such thing here on Lua, mate. But you could simulate that behavior as @Patrickputs it, and then proceed to redirect the arguments to a specific range of functions. local function OutputText(text) -- code end local function OutputTextToPlayer(text, player) -- code end local function OutputTextToPlayerWithColor(text, player, r, g, b) -- code end -- Patrick's suggestion. function Output(...) -- "magic parameter" for all local args = {...} -- put them into a table local length = #args if length == 1 then -- 1 parameter passed to function local text = args[1] OutputText(text) elseif length == 2 then -- 2 parameter passed to function local text, player = args[1], args[2] OutputTextToPlayer(text, player) elseif length == 5 then -- 5 parameter passed to function local text, player, colorR, colorG, colorB = unpack(args) -- or you can use unpack instead of indexing table one by one OutputTextToPlayerWithColor(text, player, colorR, colorG, colorB) end end
  3. Since the leak of the first versions of OWL, clone RP servers were opened to be closed within a week or two. Now that OWL is open source, will these servers last longer, due to the *now legal scripting support here on MTA Forums*, or will they drop at record speeds? Only time will tell... What are your takes on this?
  4. I'd rather see Python or C# implemented, as alternative scripting, before JS.
  5. No, I've asked you if your building has a LOD texture.
  6. Does your building have any kind of LOD texture? Because if not, just forget about the LOD of the island too.
  7. MTA allows you to customize your chatbox from the settings, but if you want all your players to have certain setting you should proceed by creating your own chat system.
  8. This server still goes strong after all these years! @Einheit-101 epic server!
  9. Well... You've got a variable _nowY which holds: sy - 305 - (47 * 1) But, you use that value hardcoded into the assignment of the pos variable: pos = {interpolateBetween(20 - 80, sy - 305 - (47 * 1), 0, 20, sy - 305 - (47 * 1)... pos = {interpolateBetween(20, sy - 305 - (47 * 1), 0, 20, sy - 305 - (47 * 1)... That's not all! At the end you update the variable nowY, which is not being used anywhere. I'd say you get a grasp of the basics of variables. All that being said, what you must do is make usage of the variable nowY, which must be defined before the start of the for loop, so you have an assigned value for the first notification which will be shown, but for that you must make usage of the variable nowY within those interpolateBetween, so pos may hold an Y value which changes depending on the number of the notification. All that being translated into code results into this: --client function drawnBoxes() _sx, _sy = sx, sy nowY = sy - 305 - (47 * 1) local now = getTickCount() for k,v in ipairs(cache) do local msg = v["msg"] local length = v["length"] local startTime = v["now"] local endTime = v["end"] local state = v["state"] local type = v["type"] local tick = v["tick"] local showtime = v["showtime"] or 8000 local customProg = v["customProg"] local boxSize = 25 local pos, alpha -- = v["pos"], v["alpha"] local r,g,b = unpack(types[type][2]) if not r or not g or not b then getColors(true) end local icon = types[type][1] local timeLine = false local timeLineProg if state == "fadeIn" then local elapsedTime = now - startTime local duration = endTime - startTime local progress = elapsedTime / duration if progress < 1 then pos = {interpolateBetween(20 - 80, nowY, 0, 20, nowY, 0, progress, 'OutQuad')} alpha = {interpolateBetween(0,0,0, 220,255,0, progress, 'OutQuad')} else alpha = {220, 255, 0} pos = {20, nowY, 0} cache[k]["now"] = getTickCount() cache[k]["end"] = getTickCount() + showtime cache[k]["state"] = "timeLineStart" end elseif state == "timeLineStart" then alpha = {220, 255, 0} pos = {20, nowY, 0} local elapsedTime = now - startTime local duration = endTime - startTime local progress = elapsedTime / duration if customProg and customProg[1] and customProg[2] then progress = customProg[2] / customProg[1] -- now / max end timeLine = true timeLineProg = progress if progress >= 1 then cache[k]["now"] = getTickCount() cache[k]["end"] = getTickCount() + 1600 cache[k]["state"] = "fadeOut" end elseif state == "fadeOut" then timeLine = true local now = getTickCount() local elapsedTime = now - startTime local duration = endTime - startTime local progress = elapsedTime / duration pos = {interpolateBetween(20, nowY, 0, 20, nowY, 0, progress, 'OutQuad')} alpha = {interpolateBetween(220, 255,0, 0,0,0, progress, 'OutQuad')} if progress >= 0.95 then table.remove(cache, k) if #cache <= 0 then if renderState then renderState = false --removeEventHandler("onClientRender", root, drawnBoxes) destroyRender("drawnBoxes") end end end end local boxWidth = length + 70 dxDrawRectangle(pos[1], pos[2], boxWidth, 50, tocolor(22, 22, 22, alpha[1]),true) dxDrawText(msg, pos[1] + 55 + 10, pos[2] + 26, 0, 0, tocolor(156, 156, 156, alpha[2]), 0.75, notificationFont, 'left', 'top',false,false,true,true,false) dxDrawText(details[type][1], pos[1] + 55 + 10, pos[2] + 10, 0, 0, tocolor(255, 255, 255, alpha[2]), 0.75, notificationFontBold, 'left', 'top',false,false,true,false,false) dxDrawImage(pos[1] + 10, pos[2] + 10, 30, 30, 'files/notificationIcons/'..details[type][2]..'.png', 0,0,0, tocolor(r, g, b, alpha[2]),true) if timeLine then timeLineSize = interpolateBetween(boxWidth, 0,0, 0, 0,0, timeLineProg or 1, customProg and "Linear" or 'OutQuad') else timeLineSize = boxWidth end dxDrawRectangle(pos[1], pos[2] + 48, timeLineSize, 2, tocolor(r, g, b, alpha[2]),true) nowY = nowY + 35 end end This code will make notifications get out of the screen after certain number of notifications, so you should create certain notification's queue in order to make the excess appear after the first ones are gone.
  10. About why it is faster, pairs tries to get all the keys of one table (which means it doesn't look only for numbers as index). Meanwhile, making usage of a limited number of possible index values leaves you with faster results. Try tables with at least 1000 values in order to see some difference.
  11. Well since your code uses the same logic, here's a more efficient way to do it: local playerElements = getElementsByType( "player" ) local players = {} for i = 1, #playerElements do local player = playerElements[ i ] players[ i ] = { name = getPlayerName(player), alive = getElementData(player,"state") == "alive", points = tonumber( getElementData(player,"ThePoints")) or 0 } end table.sort( players, function( a, b ) return a.points > b.points end )
  12. Interesting. Recently started and already on version 6.01 ?... I suppose another fork of OWL but I hope you guys get your server to the top!
  13. a) Loops indexed by numbers, synchronize element's data as little as possible, think twice before creating a global variable. b) If your shader is correctly implemented it shouldn't suppose a problem for a PC which can run GTA San Andreas.
  14. Since you are talking about 'top value', I suppose you've got a table, whose indexes are numerical, which contains the players. If you draw the text within a loop, which goes through all the elements of the previously mentioned table, you can easily edit the order of the players by assigning them to a different index within the table. In the case you don't have a loop whose indexes are numerical, try to implement one to keep it easy.
  15. Well. You could try with this start: https://www.Lua.org/pil/contents.html
  • Create New...