Jump to content

Problem position map


OrbTanT

Recommended Posts

Hello guys, problem to calculate mouse click with real map position in the world gta

https://prnt.sc/rk608u

?

 
  1. local screenx, screeny = guiGetScreenSize()
  2. local sx, sy = (screenx/1920), (screeny/1080)
  3. loadstring(exports.dgs:dgsImportFunction())()
  4. local blip = nil
  5. local blip2 = nil
  6. local width = 700
  7. local height = 700
  8. GangMarcar = dgsCreateWindow((screenx - sx*720)/2, (screeny - sy*810)/2, sx*720, sy*810, "MARQUE UM DESTINO PARA SUA GANG", false, tocolor(0, 0, 0, 255), sy*50, nil, tocolor(0, 255, 255, 150), nil, tocolor(0, 0, 0, 150), sy*5, true)
  9. dgsWindowSetMovable(GangMarcar, false)
  10. dgsWindowSetSizable(GangMarcar, false)
  11. dgsSetVisible(GangMarcar, false)
  12.  
  13. GangMarcarMap = dgsCreateImage(sx*10, sy*10, width, width, "Images/radar.jpg", false, GangMarcar, tocolor(255,255,255,255))
  14. GangMarcarLabel0 = dgsCreateLabel(sx*10, sy*10, sx*480, sy*20, "BOTÃO DIREITO DO MOUSE PRA TIRAR", false, GangCriar, tocolor(255, 255, 0, 255), sy*1.5, sy*1.5, sy*1.5, sy*1.5, tocolor(0, 0, 0, 255), "right", "center")
  15. GangMarcarSair = dgsCreateButton(sx*610, sy*720, sx*100, sy*30, "SAIR", false, GangMarcar, tocolor(0, 0, 0, 255), sy*1.5, sy*1.5, nil, nil, nil, tocolor(255, 77, 77, 150), tocolor(255, 0, 0, 150), tocolor(255, 61, 153, 150))
  16.  
  17. addEventHandler("onDgsMouseClick", getRootElement(), function(button, state, absoluteX, absoluteY)
  18. if (button == "left" and state == "down") then
  19. if (source == GangMarcarMap) then
  20. local x = absoluteX*6000 - 3000
  21. local y = 3000 - absoluteY*6000
  22. if not (blip) then
  23. createBlip(x, y, 0, 41)
  24. setElementPosition(localPlayer, x, y, 0)
  25. end
  26. elseif (source == GangMarcarSair) then
  27. dgsSetVisible(GangMarcar, false)
  28. dgsSetEnabled(Gang, true)
  29. end
  30. elseif (button == "right" and state == "down") then
  31. if (blip) then
  32. destroyElement(blip)
  33. end
  34. end
  35. end)
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...