Jump to content

Map


Recommended Posts

I'll give you the code of my OWN freeroam (it's a resource made totally from scratch, not an Arc_'s edit) since i don't use this resource, made it for fun when i was bored.

sanAndreasMapWindow = guiCreateWindow(167,8,691,742,"Select destination",false) 
guiSetVisible(sanAndreasMapWindow, false) 
guiWindowSetSizable(sanAndreasMapWindow, false) 
imgMap = guiCreateStaticImage(9,41,673,649,"images/map.png",false,sanAndreasMapWindow) 
closeMapWindow = guiCreateButton(301,702,108,30,"Close",false,sanAndreasMapWindow) 
  
function mapPositionSet(x, y) 
  local ele = getLocalPlayer() 
  local vehicle = getPedOccupiedVehicle ( getLocalPlayer() ) 
  local z_add = 1.5 
  if (vehicle) then 
  ele = vehicle 
  z_add = 3.0 
  end 
  local knockoff_old = canPedBeKnockedOffBike(getLocalPlayer()) 
  setPedCanBeKnockedOffBike(getLocalPlayer(), false) 
  setElementPosition(ele, x, y, 600.0) 
  setElementVelocity(ele, 0, 0, 0) 
  fadeCamera(false, 0) 
  setTimer(fadeCamera, 800, 1, true, 1.0) 
  setTimer( 
  function() 
  local z = getGroundPosition(x, y, 600.0) 
  local waterlvl = getWaterLevel(x, y, 0.0) 
  local waterlvl2 = getWaterLevel(x, y, 50.0) 
  if (waterlvl2) then 
  waterlvl = waterlvl2 
  end 
  if (waterlvl) then 
  if (z < waterlvl) then 
  z = waterlvl 
  end 
  end 
  setPedCanBeKnockedOffBike(getLocalPlayer(), knockoff_old) 
  setElementVelocity(ele, 0, 0, 0) 
  setElementPosition(ele, x, y, z+z_add) 
  setElementInterior(ele,0) 
  if (vehicle) then 
  setVehicleTurnVelocity(vehicle, 0, 0, 0) 
  setElementRotation(vehicle, 0, 0, 270) 
  end 
  end 
  ,800, 1) 
end 
  
function onImageClick(button, state, absoluteX, absoluteY) 
    local wndPosX, wndPosY = guiGetPosition(sanAndreasMapWindow, false) 
    local imgX, imgY = guiGetPosition(imgMap, false) 
    local imgSizeX, imgSizeY = guiGetSize(imgMap, false) 
    local relPosX = (absoluteX-wndPosX-imgX+0.5)/imgSizeX - 0.5 
    local relPosY = 0.5 - (absoluteY-wndPosY-imgY+0.5)/imgSizeY   
    mapPositionSet(relPosX*6000, relPosY*6000) 
    guiSetVisible(sanAndreasMapWindow,false) 
end 
addEventHandler("onClientGUIClick", imgMap, onImageClick, false) 
  
function closeTheMap() 
guiSetVisible(sanAndreasMapWindow,false) 
end 
addEventHandler("onClientGUIClick", closeMapWindow, closeTheMap, false) 

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...