Jump to content

Patrick

Moderators
  • Posts

    1,141
  • Joined

  • Last visited

  • Days Won

    42

Everything posted by Patrick

  1. Wrong language, moved to Portuguese section.
  2. You can't run it locally because of security reasons. I think these flags are available, but I'm not sure: Obfuscate (level 1, 2 and 3) -e1 -e2 -e3 Output file name -o <filename> I have a basic compiler what use this api, you can compile more with it at once. Download: http://skycore.hu/download/file.php?name=hierarchy_luac_compiler.rar Video: https://streamable.com/ucn7hb
  3. It's not enough information. Any error in debugscript? Here is an unnecessary "
  4. I told you before, learn Lua basics please before you ask in this section! Some mistake what I suddenly found
  5. Sadly you can't rotate colshapes, you should create a colshape polygon, with createColPolygon.
  6. Have you any level-system yet?
  7. Wrong language, moved to Programação em Lua.
  8. Hi! Sadly you can't catch player's element like that. thePlayer is not a "magic" variable, event's argument list is predetermined, you can find it on wiki. Here you can see, this event is pass only one variable, at first place. You need to do an own restart function/command, with: addCommandHandler and restartResource And print your own notification when someone use this command.
  9. I can't "just fix plz file". It is a scripting section, you need to know Lua basics, if you want to ask here. So please learn a little, before your next question.
  10. Just download what I sent, It's a done html-login-panel. - Download - Extract - Paste folder to resources - Type refresh to console, if server already running - Type start <resource name> to console, to start it By the way, use html and javascript in MTA is not not the easiest thing for beginners. You should check how this resource works, and try to edit it. Some link in this topic https://wiki.multitheftauto.com/wiki/CreateBrowser https://wiki.multitheftauto.com/wiki/ExecuteBrowserJavascript https://wiki.multitheftauto.com/wiki/Resource_Web_Access
  11. Only between this 3 color? local random_number = math.random(1, 3) -- pick a random number between [1, 3] local r, g, b if random_number == 1 then r, g, b = 255, 0, 0 elseif random_number == 2 then r, g, b = 0, 255, 0 elseif random_number == 3 then r, g, b = 0, 0, 255 end createMarker(0, 0, 3, "cylinder", 2, r, g, b)
  12. https://community.multitheftauto.com/index.php?p=resources&s=details&id=12905
  13. Give 'Admin' rights to this resource. https://wiki.multitheftauto.com/wiki/Access_Control_List <group name="Admin"> ... <object name="resource.loginsystemprofessional_v01" /> </group>
  14. Please learn Lua basics before you ask in this section, it's indispensable! Some Lua tutorial for beginners: https://forum.multitheftauto.com/topic/121619-Lua-for-absolute-beginners https://forum.multitheftauto.com/topic/64228-the-ultimate-Lua-tutorial/ https://forum.multitheftauto.com/topic/95654-tut-debugging/
  15. It depends on the resource, what you use. You just need to modify the text.
  16. https://community.multitheftauto.com/index.php?p=resources&s=details&id=10065
  17. Hi, It's possible. If you are using voice resource, the function is available by default, you just need to add the commands. Open the voice/sPlayerMuting.Lua and paste these commands to the end of the file: addCommandHandler("voicemute", function(player, cmd, targetname) -- some admin right check ... local target = getPlayerFromPartialName(targetname) if not target then return outputChatBox("[VOICEMUTE] * Player not found! ("..targetname..")", player) end setPlayerVoiceMuted(target, true) outputChatBox("[VOICEMUTE] * Player muted! ("..targetname..")", player) end) addCommandHandler("voiceunmute", function(player, cmd, targetname) -- some admin right check ... local target = getPlayerFromPartialName(targetname) if not target then return outputChatBox("[VOICEMUTE] * Player not found! ("..targetname..")", player) end setPlayerVoiceMuted(target, false) outputChatBox("[VOICEMUTE] * Player unmuted! ("..targetname..")", player) end) -- https://wiki.multitheftauto.com/wiki/GetPlayerFromPartialName function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end * You need to complete the code with admin rights check.
  18. Exactly. (and when you remove a children, you need to remove it from parent's table too)
  19. Enough to store parent of elements. And when you destroy an element, you need to check every other element. (if checked element's parent is equals to destroyed element, you need to delete it too) For example, if you destroy window. local dxelements = {} function destroy(id) -- destroy -> id -- loop trough all other dxelements for id2, data in pairs(dxelements) do if data.parent == id then -- checked element's parent equals to destroyed element -- destroy this dxelement too destroy(id2) end end end Steps: - Delete window - Start to check other elements which parent is window. -> Delete tab. - Start to check other elements which parent is tab. -> Delete button. - Start to check other elements which parent is button. -> Not found. -> Done. Or you can store childrens of element, and then you don't need to check every other element, because you already know the childrens.
  20. @DNaumov Here it is, I hope you understand this. Feel free to ask. local screen = Vector2( guiGetScreenSize() ) local scr = Vector2( screen.x/1920, screen.y/1080 ) circle2 = dxCreateTexture('assets/circle2.png','dxt1') fileDelete ('assets/circle2.png') -- Slice rotation ranges local slices = { {0, 70, "1st"}, {71, 143, "2nd"}, {144, 216, "3rd"}, {217, 290, "4th"}, {291, 360, "5th"}, } function getActiveSlice(rot) rot = math.floor(rot) for i = 1, #slices do if rot >= slices[i][1] and rot <= slices[i][2] then -- cursor is between this slice range return slices[i][3] end end return false end function drawRadial() dxDrawImage(741*scr.x,320*scr.y,438*scr.x,439*scr.y,'assets/circle.png',0,0,0,tocolor(30,30,30,160)) local cx, cy = getCursorPosition() local cx, cy = cx * screen.x, cy * screen.y -- cursor absolute position local rot = findRotation(cx, cy, screen.x/2, screen.y/2) -- get rotation difference between center of the menu and cursor local active = getActiveSlice(rot) -- get active button if active == "1st" then dxDrawImage(741*scr.x,317*scr.y,438*scr.x,439*scr.y,circle2,1,0,0,tocolor(30,30,30,160)) elseif active == "2nd" then dxDrawImage(745*scr.x,319*scr.y,438*scr.x,439*scr.y,circle2,73,0,0,tocolor(30,30,30,160)) elseif active == "3rd" then dxDrawImage(745*scr.x,322*scr.y,438*scr.x,439*scr.y,circle2,145,0,0,tocolor(30,30,30,160)) elseif active == "4th" then dxDrawImage(741*scr.x,325*scr.y,438*scr.x,439*scr.y,circle2,217,0,0,tocolor(30,30,30,160)) elseif active == "5th" then dxDrawImage(737*scr.x,322*scr.y,438*scr.x,439*scr.y,circle2,289,0,0,tocolor(30,30,30,160)) end dxDrawBorderedText('МЕНЮ ТРАНСПОРТА',845*scr.x,264*scr.y,845*scr.x,264*scr.y,tocolor(255,255,255,255),1,font1s) dxDrawBorderedText('BANSHEE',920*scr.x,290*scr.y,845*scr.x,264*scr.y,tocolor(175,175,175,255),0.8,font1s) dxDrawText('Починить',998*scr.x,425*scr.y,998*scr.x,425*scr.y,tocolor(109,109,109,255),1,font2s) dxDrawText('Перевернуть',1030*scr.x,572*scr.y,998*scr.x,425*scr.y,tocolor(109,109,109,255),1,font2s) dxDrawText('Заглушить\nдвигатель',930*scr.x,910*scr.y,998*scr.x,425*scr.y,tocolor(109,109,109,255),1,font2s,'center','center') dxDrawText('Включить\nгабариты',660*scr.x,745*scr.y,998*scr.x,425*scr.y,tocolor(109,109,109,255),1,font2s,'center','center') dxDrawText('Запереть двери',795*scr.x,425*scr.y,998*scr.x,425*scr.y,tocolor(109,109,109,255),1,font2s) dxDrawImage(901*scr.x,480*scr.y,117*scr.x,119*scr.y,'assets/circle.png',0,0,0,tocolor(10,10,10,255)) end addEventHandler('onClientRender',root,drawRadial) -- detect button press addEventHandler("onClientClick", root, function(button, state) if button == "left" and state == "up" then local cx, cy = getCursorPosition() local cx, cy = cx * screen.x, cy * screen.y -- cursor absolute position local rot = findRotation(cx, cy, screen.x/2, screen.y/2) -- get rotation difference between center of the menu and cursor local active = getActiveSlice(rot) -- get active button if active then if active == "1st" then outputChatBox("You pressed the first button! (Починить)") end end end end)
  21. @DNaumov Paste the full code*
  22. Example on https://wiki.multitheftauto.com/wiki/DxDrawCircle
  23. Maybe, paste here your current code, and upload the image what you use.
×
×
  • Create New...