-
Posts
1,143 -
Joined
-
Last visited
-
Days Won
42
Everything posted by Patrick
-
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.
-
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.
-
Szia,
- 2 replies
-
- admintitle.
- adminnick
-
(and 3 more)
Tagged with:
-
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!
-
-
Welcome
-
You can disable shooting with toggleControl. toggleControl("fire", false)
-
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
-
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/
-
Hi. You have to use onClientObjectDamage, check the example on wiki.
-
Whichever you want.
-
[HELP] Macros de mouse gamer e teclados
Patrick replied to 777's topic in Ajudas relacionadas ao MTA:SA (Cliente/Servidor)
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 -
No, just works more like attachElements. Yeah, I know. Because there is no event for that. But dimension change should work.
-
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
-
Probably fixed, can you test with latest version please?
-
Of couse it's not normal, but are you sure it is pAttach's fault? I didn't experience similar bug.
-
Yeah, I modified it.
-
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.
-
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?
-
Sure, I ran again every tests with yours.
-
Wrong language, moved to Portuguese section.