Jump to content

Tails

Members
  • Posts

    742
  • Joined

  • Days Won

    16

Everything posted by Tails

  1. @kleinmarquez Ah, yeah. That's the downside of replacing objects in MTA. If you want you could change the objects ids though but you have to go and find an id that you want to replace. You can use the map editor to check the ids on objects in the world. Unpack the zip file and browse to the map folder and open TheCinema.map file with a text editor. Then replace the ids that you see in the first image. Then browse to the screen folder and open up screen.lua and change the ids to the ones you put in the in the map file. (see second image) Hope this helps. Sorry for any inconvenience.
  2. You can attach objects to players with attachElements
  3. local screenW, screenH = guiGetScreenSize() local countdown function initTimer() if not isTimer(countdown) then -- make sure you can only start it once countdown = setTimer(countdownFin, 5000, 1) end end addCommandHandler("asd", initTimer, false, false) function countdownFin() removeEventHandler("onClientRender", root, eventszamlalas) end function eventszamlalas() local x = getTimerDetails(countdown) local timeLeft = math.ceil(x/1000) dxDrawLine((screenW * 0.4111) - 1, (screenH * 0.1244) - 1, (screenW * 0.4111) - 1, screenH * 0.1589, tocolor(254, 254, 254, 255), 1, false) dxDrawLine(screenW * 0.6118, (screenH * 0.1244) - 1, (screenW * 0.4111) - 1, (screenH * 0.1244) - 1, tocolor(254, 254, 254, 255), 1, false) dxDrawLine((screenW * 0.4111) - 1, screenH * 0.1589, screenW * 0.6118, screenH * 0.1589, tocolor(254, 254, 254, 255), 1, false) dxDrawLine(screenW * 0.6118, screenH * 0.1589, screenW * 0.6118, (screenH * 0.1244) - 1, tocolor(254, 254, 254, 255), 1, false) dxDrawRectangle(screenW * 0.4111, screenH * 0.1244, screenW * 0.2007, screenH * 0.0344, tocolor(0, 0, 0, 161), false) dxDrawText("Az event elkezdődött! Vége: "..convertSecondsToMinutes(timeLeft), screenW * 0.4118, screenH * 0.1244, screenW * 0.6118, screenH * 0.1589, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) end function convertSecondsToMinutes(sec) local temp = sec/60 local temp2 = (math.floor(temp)) local temp3 = sec-(temp2*60) if string.len(temp3) < 2 then temp3 = "0"..tostring(temp3) end return tostring(temp2)..":"..tostring(temp3) end Does now. Try it
  4. @Necktrox Getting connected, authorized and everything. Everything's set up correctly but the bot's not joining my discord channel. Am I missing something?
  5. Did you use setTimer() ? If so you can just do local secs = getTimerDetails(theTimer)/1000 https://wiki.multitheftauto.com/wiki/GetTimerDetails
  6. Tails

    cancelEvent

    addEventHandler ( "onClientChatMessage", root, function ( text ) if string.find(text, "login:") then cancelEvent() end end) Are you trying to block a message from being outputted from the default login system or from a script? I'm not sure if you can but normally the above example should work.
  7. It looks good but personally I think it's annoying to have to switch back and forth between the different tabs every time. I prefer to see the warnings and errors in one place at the same time. Some suggestions... Add a tab that shows any type of message Combine identical messages to avoid spam
  8. You have to set its interior. For example: setElementInterior(sound, 1)
  9. Thanks @Apocalypso! Lots of bugs I hear =[ While we don't currently have time to work on this project we definitely appreciate you reporting these bugs! I've had a new version laying around for quite a while, unsure if I'll finish it anytime soon but I will make sure these bugs will have been completely fixed when I finish it. Thanks again!
  10. I hope this is what the OP is looking for function getTopScores() local scores = {} for plr, v in pairs(exampleTable) do table.insert(scores, {name = getPlayerName(plr), kills = v.kills} end table.sort(scores, function(a, b) return a.kill > b.kill end) return scores end local scores = getTopScores() outputChatBox("Top scorer is "..scores[1].name.." with "..scores[1].kills.." kills!") It creates a list with the names and kills of each player in your table then sorts it by the kills. Then you can output the first one in the list or all of them put them in a grid list or something. To avoid that you should just create a new table. Hope this helps everyone
  11. Tails

    eventhandler

    @3laa33 I think he wants it toggled. Your example will throw an error because it's trying to remove a handler that doesn't yet exist.
  12. Tails

    eventhandler

    No, yours is just the opposite. You want a bool that says IsPanelVisible, if it is then remove the handler. We know the panel is not visible at the start so we do local isContactOpened = false then onClick we check, is it opened? if it's not then we add the handler to show the panel and vice versa. Nice try though
  13. Tails

    eventhandler

    local isContactOpened = false addEventHandler("onClientClick", root, function(key, state, cx, cy) if key == "left" and state == "down" then if isCursorInBox(screenW * 0.4729, screenH * 0.3130, screenW * 0.0953, screenH * 0.0269) then if isContactOpened then removeEventHandler("onClientRender",getRootElement(),contactBTN) isContactOpened = false else addEventHandler("onClientRender",getRootElement(),contactBTN) isContactOpened = true end end end end) You're welcome.
  14. Yeah, I just replaced the positions table with the sorted one, and then removed the first position. If you want to reuse the positions you could instead of removing the position, add use new variable that stores the current position index. Then every time you hit a marker you add 1 to it till you get to the end then you reset it.
  15. Oops an error. It was too late to edit it. for i=1, #sorted do positions[i] = v.pos end -- should be for i=1, #sorted do positions[i] = sorted[i].pos end
  16. Try this (untested) function getPosNearPlr(plr) local sorted = {} local x, y, z = getElementPosition(plr) for i, v in ipairs(positions) do local d = getDistanceBetweenPoints3D(x, y, z, v[1], v[2], v[3]) sorted[i] = {pos = v, dist = d} end table.sort(sorted, function(a, b) return a.dist < b.dist end) for i=1, #sorted do positions[i] = v.pos end table.remove(positions, 1) return sorted[1].pos end local pos = getPosNearPlr(localPlayer)
  17. Tell us exactly what you're trying to do. We need more information. It looks like you're trying to place a marker at the nearest position to the player? I can write you an example but it might not be what you want.
  18. Tails

    dxDrawImage

    You need to render it on screen for every frame with this event: addEventHandler("onClientRender", root, function() dxDrawImage (x/2, y/2, 500, 500, "assets/death.png") end)
  19. Tails

    Complie

    He's trying to compile his code... not share it with the world.
  20. Tails

    God mode

    https://wiki.multitheftauto.com/wiki/Damage_Types
  21. You don't need an expert scriptor for a simple freeroam with simple fun scripts. Just spend some time looking at other scripts and create your own. It's really easy. Check out this wiki page: https://wiki.multitheftauto.com/wiki/Scripting_Introduction If you have any scripting related questions, feel free to post them here.
  22. Tails

    Grid List Help

    Because what you're doing is, for every row loop through all the rows in the gridlist and set the table value to each of them. what you want to do is do it all in a single loop and maybe redo your table. Maybe something like this: local vehs = { {model = 411, mod = 4, price = 12000}, -- 1 {model = 411, mod = 4, price = 12000}, -- 2 etc.. } for i, v in pairs (vehs) do local row = guiGridListAddRow ( GUIEditor.gridlist[1], getVehicleNameFromModel(v.model), v.mod, v.price) guiGridListSetItemData ( GUIEditor.gridlist[1], row, 1, v.model) end Also in 1.5.2 or so, they introduced an alternative easier way to set the text of a row for each column, the syntax is like this: int guiGridListAddRow ( element gridList, int/string itemText1, int/string itemText2, ... ) where itemText1 is for column 1 and itemText2 for column 2 and so on.
  23. A small example code would be nice. I don't see any way why guiStaticImageLoadImage won't work. Instead of destroying and recreating the gui try toggle their visiblity: guiSetVisible(element, not guiGetVisible(element))
×
×
  • Create New...