Jump to content

Flower ☠ Power

Members
  • Posts

    40
  • Joined

  • Last visited

Recent Profile Visitors

1,289 profile views

Flower ☠ Power's Achievements

Rat

Rat (9/54)

0

Reputation

  1. I am so sorry for making you waste your time I figured it out right now and by right now I mean right now at this moment. local x, y = getElementPosition(v[1]) local blipX, blipY = (x + 3000) * (dxD_fullMapRT[3] * fullMapZoom/6000), (y - 3000) * ((-dxD_fullMapRT[4]*fullMapZoom)/6000) local blipX = blipX + (dxD_fullMapRT[3]/2) - (dxD_fullMapRT[3]/2 * fullMapZoom) + xfullMapOffset local blipY = blipY + (dxD_fullMapRT[4]/2) - (dxD_fullMapRT[4]/2 * fullMapZoom) + yfullMapOffset dxDrawImage(blipX - radar_icons[1][2], blipY - radar_icons[1][3], radar_icons[1][4], radar_icons[1][5], radar_icons[1][1], 0, 0, 0, v[5]) This is the correct way to calculate it, the reason why it wasn't working it was because when I was dividing the map width with 6000 I wasn't taking into account that when zoomed in it has to be multiplied with the zoom factor, and then after that it's just adding the same amount of X or Y added in the previously in the zoomed map. I have really thank you for your time and effort you spent trying to help me I really apreciate, thanks buddy.
  2. I guess sometimes you just need to do a better research ?, thanks buddy.
  3. dxD_fullMapRT = {screenW * 0.2677, screenH * 0.0870, screenW * 0.4646, screenH * 0.8259} This are just numbers the first two are x, y positions of where the render target must be in the the screen, then the other two are the size of the render target width and height respectively, all in relative numbers, if u want the exact number well just do the math: 1920 * 0.4646 ~= 892
  4. I think the title is self explainatory but here is a picture of what 'triangle' I am referring to Is it even possible?
  5. That really doesn't matter but here it is local zoomSensitivity = 0.05 function zoomFullMap(button, press) if (button == 'mouse_wheel_up') and (press == true) then fullMapZoom = fullMapZoom + zoomSensitivity elseif (button == 'mouse_wheel_down') and (press == true) then fullMapZoom = fullMapZoom - zoomSensitivity end end addEventHandler("onClientKey", root, zoomFullMap) It just adds or subtracks 0.05 to the fullMapZoom variable depending you scroll down/up, if you want the formula used to zoom in/out the map look at this: dxDrawImage((dxD_fullMapRT[3]/2) - (dxD_fullMapRT[3]/2) * fullMapZoom + xfullMapOffset, (dxD_fullMapRT[4]/2) - (dxD_fullMapRT[4]/2) * fullMapZoom + yfullMapOffset, dxD_fullMapRT[3] * fullMapZoom, dxD_fullMapRT[4] * fullMapZoom, radar_full, 0, 0, 0, -1, false) --Render the big map I just center the map image multiply by the amount of zoom then add offset to move the map
  6. I'm trying to make a custom F11 map but when I zoom in my blips get screwed up because I cannot guess the right formula to calculate their position in the screen when zoomed in. local fullMapZoom = 1 local xfullMapOffset = 0 local yfullMapOffset = 0 function renderFullMap() dxSetRenderTarget(fullMapRender, true) dxDrawImage((dxD_fullMapRT[3]/2) - (dxD_fullMapRT[3]/2) * fullMapZoom + xfullMapOffset, (dxD_fullMapRT[4]/2) - (dxD_fullMapRT[4]/2) * fullMapZoom + yfullMapOffset, dxD_fullMapRT[3] * fullMapZoom, dxD_fullMapRT[4] * fullMapZoom, radar_full, 0, 0, 0, -1, false) --Render the big map for _, v in pairs(nearbyPlayers) do --Loop in a table of players if (v[6] == myDim) then local x, y = getElementPosition(v[1]) -- Players x, y local blipX, blipY = (x + 3000) * (dxD_fullMapRT[3]/6000), (y - 3000) * (-dxD_fullMapRT[4]/6000) local blipX = blipX + (blipX - blipX*fullMapZoom)/2 + xfullMapOffset local blipY = blipY + (blipY - blipY*fullMapZoom)/2 + yfullMapOffset dxDrawImage(blipX - radar_icons[1][2], blipY - radar_icons[1][3], radar_icons[1][4], radar_icons[1][5], radar_icons[1][1], 0, 0, 0, v[5]) end end dxSetRenderTarget() dxDrawImage(dxD_fullMapRT[1], dxD_fullMapRT[2], dxD_fullMapRT[3], dxD_fullMapRT[4], fullMapRender, 0, 0, 0, -1, false) end Look at the small white icon in the map and then when zoomed in it's displaced and I'm really struggling to get the formula to calculate the position on the screen after zoomed in, please help me.
  7. Wow, thanks Noki, I thought u left MTA long ago, I did not expect you would even remember me buddy...
  8. Moderator note: he stopped providing his services, topic locked I've got plenty of experience in scripting and 3ds max modeling, I'm looking for a paid part time job, due to coronavirus I can't work in my real part time job (I'm spanish) so I would be looking for a paid job as: scripter, 3ds max modeler/mapper... My discord: ManeXi#9530 Payments only via PayPal
  9. Well, I haven't shown the complete code in this post, we're talking about 30+ multiplications, anyways thanks for posting that script I didn't know we had something like that, so useful
  10. So today I was making a new HUD for players in dx, due this HUD will be displayed all the time I started thinking about how I can optimize it as maximun as possible... Going from this classic code: local screenW, screenH = guiGetScreenSize() local scaleX, scaleY = screenW/1920, screenH/1080 addEventHandler("onClientRender", root, function() dxDrawText("30/", screenW * 0.7786, screenH * 0.0648, screenW * 0.8380, screenH * 0.1426, tocolor(241, 173, 11, 255), scaleX, scaleY, dxfont0_excelsior_sans, "left", "top", false, false, false, false, false) dxDrawText("9999", screenW * 0.8354, screenH * 0.0657, screenW * 0.8807, screenH * 0.1130, tocolor(241, 173, 11, 255), scaleX, scaleY, dxfont1_excelsior_sans, "left", "top", false, false, false, false, false) end) to this "more optimized" one: local screenW, screenH = guiGetScreenSize() local scaleX, scaleY = screenW/1920, screenH/1080 local hudSizes = { (screenW * 0.7786), (screenH * 0.0648), (screenW * 0.8380), (screenH * 0.1426), (screenW * 0.8354), (screenH * 0.0657), (screenW * 0.8807), (screenH * 0.1130) } addEventHandler("onClientRender", root, function() dxDrawText("30/", hudSizes[1], hudSizes[2], hudSizes[3], hudSizes[4], 0xFFF1AD0B, scaleX, scaleY, dxfont0_excelsior_sans, "left", "top", false, false, false, false, false) dxDrawText("9999", hudSizes[5], hudSizes[6], hudSizes[7], hudSizes[8], 0xFFF1AD0B, scaleX, scaleY, dxfont1_excelsior_sans, "left", "top", false, false, false, false, false) end) As you can see I replaced the multiplications with some variables that represent the calculations (so it doesn't need to multiply the number everytime that "onClientRender" is triggered) and the same goes for the tocolor function. So as far as my understanding goes this would increase the performance, right? or atleast that's my question doing this would have any impact in clients performance? or it's just complicating the code for no reason?
  11. Thanks for the replies, I guess there is no way I can remove that animation and keep players be able to shoot, I'll give a try to make a github post
  12. There are two animations in this game that I want to remove, the elbow block that you do when you're very close to a person and it doesn't let you shoot your weapon, and the animation that doesn't let you shoot when you're very close to a wall. This animations just screw the PvP combat experience and I would like to remove them from my server How can I use engineLoadIFP engineReplaceAnimation In order to remove this animations
  13. The object that loses collision it's not like the old bug where some random objects of the map lose collision because of replacing, because in theory it was fixed and the object doesn't lose the collision the first time you join, then you /reconnect and it loses collision, in order to get the collision back you need to restart your MTA Client, I know it's kinda weird and it might get fixed by replacing the collision of those objects who lost collision, but I would like to keep my scripts as optimized possible so I would like to know if anyone knows an alternative solution to replacing it's collision file.
  14. There are some objects created in the map editor (.map files) that get collisionless after reconnecting, so basically the first time you join in they have collision but after that they get collisionless, if you're wondering what custom objects i'm using here is the table with them: local objects = { -- id, dff, col, txd {3976, "policest02_lan", "policest02_lan"}, {18023, "int_pizzaplace", "int_pizzaplace"}, {5418, "lae711block01", "lae711block01"}, {17700, "pigpenblok1_lae2", "pigpenblok1_lae2"}, {14838, "int_strip_club", "int_strip_club"}, {14785, "gen_otb", "gen_otb"}, {4683, "ladtbuild2_lan2", "ladtbuild2_lan2"}, {5732, "donut01_lawn", "donut01_lawn"}, {18021, "int_din_donut_main", "int_din_donut_main"}, {12853, "sw_gas01", "sw_gas01"}, {17534, "cluckinbell1_lae", "cluckinbell1_lae"}, {5168, "cluckinbell1_las2", "cluckinbell1_las2"}, {5813, "lawnshop1", "lawnshop1"}, {18022, "int_chick_main", "int_chick_main"}, {18030, "gap", "gap"}, {4572, "stolenbuilds11", "stolenbuilds11"}, {4584, "halgroundlan2", "halgroundlan2"}, {18026, "clothes_:~", "clothes_:~"}, {17517, "barberblock1_lae", "barberblock1_lae"}, {5521, "idlewofuk06_lae", "idlewofuk06_lae"}, {18007, "int_barbera12", "int_barbera12"}, {14682, "int_tatooa10", "int_tatooa10"}, {18082, "cj_barber2", "cj_barber2"}, {6095, "offvensp02_law", "offvensp02_law"}, {18045, "mp_ammu01", "mp_ammu01"}, {5106, "roadsbx_las2", "roadsbx_las2"}, {4552, "amubloksun1_lan", "amubloksun1_lan"}, {14665, "int_7_11a40", "int_7_11a40"}, {4022, "foodmart1_lan", "foodmart1_lan"}, {18031, "clothesexl", "clothesexl"}, {6334, "rodeo02_law2", "rodeo02_law2"}, {18008, "int_clothinga01", "int_clothinga01"}, {6385, "rodeo02tr_law2"}, {6351, "rodeo05_law2", "rodeo05_law2"}, {18025, "clothes_sports", "clothes_sports"}, {6353, "sunbils04_law2", "sunbils04_law2"}, {18024, "int_clothe_ship", "int_clothe_ship"}, {5414, "laejeffers02", "laejeffers02"}, {5637, "laealpha5", "laealpha5"}, {5459, "laejeffers01", "laejeffers01"}, {12948, "sw_block01a", "sw_block01a", "sw_block01a"}, {12976, "sw_diner1", "sw_diner1"}, {14655, "trukstp01", "trukstp01"}, {12862, "sw_block03", "sw_block03"}, {5762, "foodmartlawn", "foodmartlawn"}, {14667, "int_7_11a41", "int_7_11a41"}, {5040, "unionliq_las", "unionliq_las", "unionliq_las"}, {13361, "ce_pizza1", "ce_pizza1"}, {12924, "sw_block06", "sw_block06"}, {5140, "snpedtatshp", "snpedtatshp"}, {5853, "sunset21_lawn", "sunset21_lawn"}, {13131, "sw_block05", "sw_block05", "sw_block05"}, {12984, "sw_block11", "sw_block11"}, {18282, "cw_tsblock", "cw_tsblock"}, {18552, ":Os_ammun", ":Os_ammun"}, {18237, ":Ow_dinerwst", ":Ow_dinerwst"}, {18020, "int_6burger_main", "int_6burger_main"}, {18049, "ammu_twofloor", "ammu_twofloor"}, {17515, "scumgym1_lae", "scumgym1_lae"}, {14831, _, "lm_stripbar"}, {14846, _, "int_ppol"}, {5498, _, "laeroad33"}, {5411, _, "laeroadsblk"}, {5166, _, "dkcargohull2bd"}, {5491, _, "laeroad26"}, {5494, _, "laeroad29"}, {5862, _, "road_lawn31"}, {4898, _, "clifftestgrnd"}, {5483, _, "laeroad17"}, {5482, _, "laeroad16"}, {14825, _, "int_boxing07"}, {18053, _, "munation_xtras04"}, {18052, _, "munation_xtras03"}, {1977, _, "vendin3"}, {18051, _, "range_xtras03"}, {18092, _, "ammun3_counter"}, } Help me please
  15. Thanks for the answer and sharing your own experience, I think I might stick to triggerEvent looks like more manual but it seems that it's way cleaner than elementData.
×
×
  • Create New...