Jump to content

Flower ☠ Power

Members
  • Posts

    40
  • Joined

  • Last visited

Everything posted by Flower ☠ Power

  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.
  16. As far as I understood TriggerEvent would take more RAM (more code store while is executing) and more Bandwidth, while Element Data would be more CPU intensive, right?
  17. I've got a performance question, let's put the hypotetical case where I want to make players showing bubbles like "writting..." when they're typing in the chat, I don't have any issue making a script like that but my question is about performance, now let's say that to sync this information with other players I use setElementData, then every player in the server "knows" who's writting, but the problem is that everyone his mother knows how CPU intensive SetElementData can be if it's constantly triggering. In the other hand let's say that to make a more optimized system, I first get in the client side like all the players in a radious of 100 units then make a table with all the players in this radious, send it via TriggerServerEvent, then send back the information to the players in the table using the first optional argument of triggerClientEvent. Which would perform better, and more important how CPU intensive is sending tables via TriggerServerEvent?
  18. Hello there, first of all a little bit of context: I'm scripting my own server and right now I use MTA's default account data system to storage it's very simple to use and for simple stuff like player kills, money... it's really easy and confortable to use, but when we're talking about storaging about bigger data like maybe the clothes that he's wearing if he has CJ skin I have to start doing tricks with toJSON in order to storage it as string and then back it up as a table... Overall I don't have any issue, but now with more complex stuff like group system I'm seriously thinking about making my own custom MySQL data storage system. Now my questions are more specifically about performance, how good is MTA default acc storage system? does a custom one with MySQL perform better? and ultimately the most important is it worthy making a whole new storage system for your own server or should stick to the default one (or maybe mix them)?
  19. There is a bug on my server where right after logging for some reason other players that are already logged they see you hard sliding, does anyone know why this is happening? is kinda awkward and it seems to get fixed when the player just dies: https://youtu.be/CXTP11_g7ws
  20. That's the center of the screen this doesn't mean it's where your aim sight it is, I have tested using GetScreenFromWorldPosition and it seems it's not the same, I shoot at the center of the enemy ped and return it's position with getElementPosition(source) and in hypothetical case that if screen center would be the center of your aim sight wouldn't be the same or very similiar? addEventHandler("onClientRender", root, function() for _, v in pairs(getElementsByType("player")) do local x, y, z = getElementPosition(v) local okX, okY = getScreenFromWorldPosition(x, y, z) if (okX ~= false) and (okY ~= false) then dxDrawRectangle(okX - 4, okY - 4, 4, 4) end end end) I have drawn a little rectangle in the center of every player to see where is the exact center and I can conclude that the aim sight position IS NOT the center of the screen.
  21. Which is the screen X and the Y when I aim, of my weapon sight? is it the center of the screen? or how do I get it
  22. Server IP: 94.23.196.29:22003 or mta.gtirpg.net:22003
  23. This is a video i made some months ago in a MTA Server that doesn't exist anymore. I expect enjoying the video since you won't be able to enjoy a server that doesn't exist anymore JAJAJAJA
  24. WTF? No badly i'm not scripter and it's not easy to script man i see this script client side in (C:\Program Files (x86)\MTA San Andreas 1.3\mods\deathmatch\resources\pl-Syncro) and it have got like 1500+ lines this script it's ultra advance scripting man it's not easy to script and what i'm suggesting it's much more better than the actual "Bullet Sync" because it fixes the laggers advantages and basically skinhackers will be obsoleted. If you don't want to do it then pay a scripter to do it for you. These "ultra advanced" scripts are not made for free nor there is any other way to get them. Either you buy it or you do it yourself. You can't possibly expect the MTA developers to treat each suggestion as priority, especially because they don't get paid for what they do and MTA is considered a personal project when applying for a job or studies, besides reverse engineering is against EULA of GTA, so that can be taken as a minus point despite all the hard programming work. Oh really great i give idea to fix peoples annoying lag and you say me that i have to pay to fix lag in MTA :fp: me i try to help and you dummies answer me with sh!t, it seems that you dummies doesn't understand that i made this suggestion for everybody selfish idiot if lag and skinhack are fixed in whole MTA it isn't amazing and great?
  25. WTF? No badly i'm not scripter and it's not easy to script man i see this script client side in (C:\Program Files (x86)\MTA San Andreas 1.3\mods\deathmatch\resources\pl-Syncro) and it have got like 1500+ lines this script it's ultra advance scripting man it's not easy to script and what i'm suggesting it's much more better than the actual "Bullet Sync" because it fixes the laggers advantages and basically skinhackers will be obsoleted.
×
×
  • Create New...