Jump to content

Tails

Members
  • Posts

    740
  • Joined

  • Days Won

    16

Everything posted by Tails

  1. local players = getElementsByType("player") local sorted = {} for i=1,#players do sorted[i] = {name=getPlayerName(players[i]),money=getPlayerMoney(players[i])} end table.sort(sorted,function(a,b) return a.money < b.money end) -- in draw example: addEventHandler("onClientRender", root, function() local y = y and y + 10 or 0 for i=1,#sorted do dxDrawText("Name: "..sorted[i].name.." Money: "..sorted[i].money, 142, 370 + y, 610, 405, tocolor(34, 220, 60, 255), 1.25, "default", "left", "top", false, false, false, false, false) end end) Hope this helps
  2. @lopexsw, I could teach you some basic lua in real time with Kobra.io if you want so you can make your script. It won't be hard, I will teach you the pure basics which should help you get started more easily. I can even guide you through the process of making this script that you want, as well as teach you some stuff about tables and how to loop through them like Syntrax showed you. I sent you a PM with a discord link so we can arrange when you want to get started. Let me know if you're interested. I think it will be fun
  3. Check your pairs. There's no key called swearFilter in your table.
  4. It might be due to your server's fps limit. By default it's 36, try changing it to 60 in your server config or through the admin panel.
  5. It would be helpful if you told us exactly what it is that you're trying to do and what your code does or doesn't do right now and what bugs you're encountering (/debugscript 3). Also before you go about trying to fix your issue, I recommend you learn how to loop tables in Lua. Here's a great tutorial: https://en.wikibooks.org/wiki/Lua_Programming/Tables
  6. You can draw dx in front of a browser. Check out the wiki page for the dxDraw functions and you'll see there's a postGUI argument. Just set that to true and also make sure it's drawn after the browser.
  7. you can do outputChatBox ( getPlayerName(plr) .. "tried" .. actionText .. "and it didnt work!", root, 255, 0, 0, true ) -- or local name = getPlayerName(plr) outputChatBox ( name .. "tried" .. actionText .. "and it didnt work!", root, 255, 0, 0, true )
  8. As far as geolocation api you can check out my resource I don't know about the other stuff
  9. You need to create a new water surface over the entire world and use set that to 700 instead. https://wiki.multitheftauto.com/wiki/CreateWater Check examples
  10. If you like it to be synced with the server then you're gonna want to get the length of every song before adding them to a server-side playlist/table. Then use those lengths to set a timer to loop through it on the server and trigger the client. If you don't need it synced then you can probably just make use of these events https://wiki.multitheftauto.com/wiki/Client_Scripting_Events#Sound_events. onClientSoundStream, onClientSoundStopped etc. for example onClienSoundStream you can check if something is playing if not you add it to the table, then make another check whether to play it. And on stop you can remove the table entry and play the next one.
  11. Thanks @lordhenry, for all the suggestions! Some of the stuff you mentioned isn't new to us and we've thought about a lot of it before already. We cannot sync it with the audio unfortunately because the audio is coming from the CEF browser and there's no functions or anything to get or read the audio. I agree with a command to open/close the panel so people can bind it to any key they want and removing the F2 bind and adding a close button. Night time doesn't change the server time, it's set locally, however I agree that it might be problematic on servers where the time matters like on rpg servers. We're looking into a shader currently that will darken the room instead of changing the time. The bug when typing text into the browser was already fixed at the start but I've noticed too that it doesn't work all the time. I will look into this. This is a sweet idea and I've thought about it before as well. Maybe in the far future but don't expect anything to happen. I've always wondered why sometimes some random money spawned outside the cinema... now I know. As for the other suggestions, we will take them into consideration. I'm thinking about replacing the entire panel with a new one but I haven't quite decided on it yet. If I am then I will make sure there's no fixed binds and a command for every action and it will take care of unused settings and custom huds as well. Please note that we're pretty busy and that we can't be working on this resource every day. It might take a long time before we can add in any of the suggested features or they might not make it in at all due to lack of time. Please bear with us! Again, thank you for all the suggestions. We appreciate it a lot!
  12. Sorry for the long delay, had to sort out my new computer and stuff. I've added a new curved screen (custom 3d modeled) with new ambilight effects and added volume controls (+/-) on request and also fixed muting. Here's a short clip of the new screen model: https://clips.twitch.tv/sillybilly3/ComfortableArmadilloFailFish And a screenshot here for you all: Hope you enjoy it! And please if you find any bugs, please report them so we can fix them as soon as possible. Download now: Cinema Experience 2.0 @ChrisM @Dutchman101 and @EveryoneElse
  13. The problem must be in closePanelOnLeave() or cleanUp() in c-main.lua. I don't see anything there, it's just doing its job, unless somehow it triggers an onMarkerHit and the screen gets recreated again. I'll have better look later.
  14. @Dutchman101 I wasn't aware of this issue. Does it happen with older versions too? Because this was tested and there were no issues then. Also, does it happen when you're alone or when other players are in the cinema? Please let me know, thank you.
  15. Thanks all! @ChrisM, No, but I took some time and implemented it for you. I'll release an update tomorrow which will include that + something else I'll let you know when you can download it.
  16. Yes, what pa3ck said as well, I should've mentioned that, sorry. This is just the way I prefer to do it usually and it's also faster especially within a render. Usually I'd write something like this: for i=1,#bill do local bill = bill[i] bills[i] = createObject(7911, bill.x, bill.y, bill.z, bill.rotX, bill.rotY, bill.rotZ) setElementCollisionsEnabled(bills[i], false) setElementFrozen(bills[i], true) setObjectScale(bills[i], bill.Scale) end
  17. First loop is wrong. You're not actually storing the object in the table. It should be like this: for i, bill in ipairs(bill) do bills[i] = createObject(7911, bill.x, bill.y, bill.z, bill.rotX, bill.rotY, bill.rotZ) setElementCollisionsEnabled(bills[i], false) setElementFrozen(bills[i], true) setObjectScale(bills[i], bill.Scale) end
  18. Tails

    Cannot see gui

    Remove the function GUI around your code. marker = createMarker(-2050.5, 167.39999, 27.9, "cylinder", 1, 255, 0, 0, 255) local screenW, screenH = guiGetScreenSize() window = guiCreateWindow(10, (screenH - 372) / 2, 836, 372, "GUI", false) guiWindowSetSizable(window, false) closeButton = guiCreateButton(413, 328, 187, 34, "Close", false, window) addEventHandler("onClientMarkerHit", marker, function() guiSetVisible(window, true) showCursor(true) end) addEventHandler("onClientGUIClick", closeButton, function() guiSetVisible(window, false) showCursor(false) end)
  19. Okay, here's a better example: local myGui = {} myGui.label1 = guiCreateLabel(397, 433, 280, 67, "test", false) myGui.label2 = guiCreateLabel(397, 493, 280, 67, "test", false) local languages = { ["german"] = { label1 = "Ich bin hans", label2 = "kekekekkek", }, ["english"] = { label1 = "I am hans", label2 = "hahahahaha", }, } function setGuiLanguage(language) for k,v in pairs(languages[language]) do if myGui[k] then guiSetText(myGui[k],v) end end end addCommandHandler("language", function(_,lang) if languages[lang] then setGuiLanguage(lang) end end )
  20. Unless you really need the data to be private, I'd suggest to just store the data in a table on the client. Isn't it to just change the language of the texts in the gui, something they can already see and read and is loaded in memory? To add to Miika's example: local chosenLanguage = "English" local languages = { ["Germany"] = { ["edit1"] = "German version of text", ["edit2"] = "blablablabla", }, ["English"] = { ["edit1"] = "English version of text", ["edit2"] = "blablablabla", }, } guiSetText(text-element, languages[chosenLanguage]["edit1"]) guiSetText(button-element, languages[chosenLanguage]["edit2"])
  21. Just use my example. It works for what you're doing. No need to get all fancy right away, take it step by step.
  22. That's because the triggerClientEvent is being triggered on all clients. You have to specify the actual client. Try this: triggerClientEvent(client, "nomoney", resourceRoot)
  23. Check 2nd argument in your markerHit func. It's just dimension, you don't really need it. Also the onClientMarkerHit event gets triggered for every client (read the wiki page). So you just need to check that the player (1st argument) is indeed the localPlayer (you) that hit the marker. Also rename the 1st argument or remove this line: local player = getLocalPlayer() . It doesn't work that way. function markerhit(hitPlayer, missionMarker) if hitPlayer == localPlayer then guiSetVisible(missionName, true) fadeCamera(false,1.3) setTimer(fadeCamera,3000,1,true) setTimer(guiSetVisible,5500,1,missionName, false) end end addEventHandler("onClientMarkerHit", missionMarker, markerhit)
  24. Tails

    Table sorting

    Here's some examples: -- sort by first value in table table.sort(myTable,function(a,b) return a[1] < b[1] end) -- sort by second value in table table.sort(myTable,function(a,b) return a[2] < b[2] end) -- sort by named key value in table (if there's any) table.sort(myTable,function(a,b) return a.name < b.name end) Use the last one if you're doing something like this: {name = "David", age = "21"} Hope this helps.
×
×
  • Create New...