Jump to content

Patrick

Moderators
  • Posts

    1,143
  • Joined

  • Last visited

  • Days Won

    42

Everything posted by Patrick

  1. If the "coordinate" extends beyond the size of the image, it starts from the beginning. You need to make sure you can't go over the total size of the image with scrolling.
  2. Patrick

    [HELP] F11 Map

    for _, area in ipairs(getElementsByType('radararea')) do local areaX, areaY = getElementPosition(area) local sizeX, sizeY = getRadarAreaSize(area) local dx = (((areaX*mapH)/6000)+(mapH/2))+((Width/2)-(mapH/2)) local dy = mapH - (((areaY*mapH)/6000)+(mapH/2))+((Height-mapH)/2) local dendx = ((((areaX+sizeX)*mapH)/6000)+(mapH/2))+((Width/2)-(mapH/2)) local dendy = mapH - ((((areaY+sizeY)*mapH)/6000)+(mapH/2))+((Height-mapH)/2) local red,green,blue,alpha = getRadarAreaColor(area) dxDrawRectangle(dx, dy, dendx-dx, dendy-dy, tocolor(red,green,blue,alpha)) end Should look like something like that, based on the blip's one.
  3. Wrong language, moved to Spanish section.
  4. Welcome! Here are some excellent resources to learn the basics of Lua scripting: - https://wiki.multitheftauto.com/wiki/Main_Page - https://wiki.multitheftauto.com/wiki/Scripting_Introduction - https://www.lua.org/manual/5.1/ - https://wiki.multitheftauto.com/wiki/Category:Tutorials - https://forum.multitheftauto.com/topic/34453-manuals - https://forum.multitheftauto.com/topic/64228-the-ultimate-lua-tutorial/ - https://forum.multitheftauto.com/topic/121619-lua-for-absolute-beginners - https://forum.multitheftauto.com/topic/95654-tut-debugging/ - https://forum.multitheftauto.com/topic/114541-tut-events/ - https://forum.multitheftauto.com/topic/117472-tut-scaling-dx/ Videos: https://www.youtube.com/watch?v=Goqj5knKLQM&list=PLY2OlbN3OoCgTGO7kzQfIKPj4tJbYOgSR Good luck!
  5. It isn't a matrix, 6-7-8th arguments are rx, ry, rz .
  6. You can disable shooting with toggleControl. toggleControl("fire", false)
  7. Hi. You have to unpack values first, because now you pass only a table to createObject. function just_a_function() -- get the values from table local model, x, y, z, rx, ry, rz = narrows[1][1], narrows[1][2], narrows[1][3], narrows[1][4], narrows[1][5], narrows[1][6], narrows[1][7] createObject(model, x, y, z, rx, ry, rz) -- or you can use 'unpack' local model, x, y, z, rx, ry, rz = unpack(narrows[2]) createObject(model, x, y, z, rx, ry, rz) end
  8. Hi. Okay, so there are 3 problems with your code, what I can see now. 1) You have to use every dxDraw... functions inside a render event (onClientRender), because when you call these functions, the image visible only for 1 frame. 2) On client-side 3rd parameter of addEventHandler is missing, the attached function. 3) On server-side your triggerClientEvent is bad, because now you send this trigger to every(!) clients, you have the define "sendTo" parameter, it's root (everyone) by default. Should look something like this: -- CLIENT function phoneRender() dxDrawImage(540, 290, 281, 512, "images/phone.png") end function openPhone() addEventHandler("onClientRender", root, phoneRender) end addEvent("openPhone", true) addEventHandler("openPhone", root, openPhone) -- how to stop render: function closePhone() removeEventHandler("onClientRender", root, phoneRender) end -- SERVER -- only the trigger -- send this trigger only to "player", who entered the command triggerClientEvent(player, "openPhone", root) Here you can read about events: https://forum.multitheftauto.com/topic/114541-tut-events/
  9. Hi. You have to use onClientObjectDamage, check the example on wiki.
  10. Hi. Wrong language, moved to Portuguese section. But you can block macros with MTA AC, see here: https://wiki.multitheftauto.com/wiki/Anti-cheat_guide Enable SD #31
  11. No, just works more like attachElements. Yeah, I know. Because there is no event for that. But dimension change should work.
  12. Hi. A solution if you give weight to items, so 1 weight = 1% chance. local totalWeight = 100 -- SUM of weights -- IMPORTANT, add items in ascending order by weights local choices = { {"Second item", 15}, {"Third item", 15}, {"First item", 70}, } function getRandomChoice() local randomWeight = math.random(totalWeight) -- get a random weight (between 1-100) -- loop trough table, and find which item is at the random weight. (for example, at the 20th position is "Third item") for i, choice in ipairs(choices) do if randomWeight <= choice[2] then return choice[1] end randomWeight = randomWeight - choice[2] end end I hope you understand it, but there is a video, it's C# but maybe helps: https://www.youtube.com/watch?v=OUlxP4rZap0
  13. Probably fixed, can you test with latest version please?
  14. Of couse it's not normal, but are you sure it is pAttach's fault? I didn't experience similar bug.
  15. I uploaded a new version of pAttach (1.1), please use that version if you do it. I ran all tests again with the latest versions of resources, you can find new results in my thread. And there is a typo in your resource (version 1.4), m_rad is not defined. I defined it for myself to run the tests.
  16. Sorry for late response, I rewrote most of code, I'm using new table structure, and I fixed bug what Santi reported before (I hope). I ran all tests again with the latest versions of resources, you can find new results in updated Performance Comparison table.
  17. Thanks for the report, I'll check it out. Can you tell me more info about how you use it? How attach/deatach it to player, and when?
  18. Try to use this sdk, or check how it works: https://gitlab.com/OwlGamingCommunity/mta-python-sdk
  19. Sure, I ran again every tests with yours.
  20. Wrong language, moved to Portuguese section.
×
×
  • Create New...