Jump to content

Map and Radar Customization


XeroXipher

Recommended Posts

Hey guys... I post for help almost everyday and I do feel bad about that... I want to be able to stand on my feet and hopefully after I figure this out I'll be able to focus on things I'm good at.
I downloaded this resource on the MTA SA Community (Resources).
It is a Square Minimap (Radar) and F11 Full Screen Map.

These are pictures of my Server based around the Map so far:
Picture of MTA SA with Minimap (Radar)
Picture of MTA SA with F11 Map (Full Size Map)

I did manage to get the ShowCursor() function to work and it works well, but to move Left (Press Left Button) Right (Press Right Button) Up (Press Up Button) Down (Press Down Button) I need to actually use the Buttons and can't use the Mouse.
ZoomIn is (num_add)
ZoomOut is (num_sub)

I tried to add a keybind for ZoomIn/ZoomOut but it didn't work...
Can someone show me how to Keybind a Function within the F11 Map (Like Zoom In / Out, Grab Map with Mouse and Move it)

This is my code so far:

 

--[[----------------------------------------------------
-- client script main
-- @author Banex
-- @update 24/03/2016 
----------------------------------------------------]]-- 

function onClientResourceStart()	
	map = Map.new():init()
	map:setBounds(x*30,y*30,x*1306,y*708)
	map:setAlpha(200)

	radar = Map.new():init()
	radar:setBounds(x*20, y*560, x*281, y*193)
	radar:setStyle(2)
	radar:setAlpha(200)
	radar:setBlipSize(x*24)
	radar:setVisible(true)

	map.Switch = function()
		toggleCursor() 
		mapKeys()
		map:setVisible(not map:isVisible())
		radar:setVisible(not map:isVisible())
		showChat(not map:isVisible())
	end
	
	bindKey('F11', 'down', map.Switch)
	setPlayerHudComponentVisible("radar",false)
	toggleControl("radar",false)
	
end

function toggleCursor()
    local cursorState = isCursorShowing() -- Retrieve the state of the player's cursor
    local cursorStateOpposite = not cursorState -- The logical opposite of the cursor state
  	showCursor(cursorStateOpposite) -- Setting the new cursor state
end

function mapKeys()
	bindKey("mouse_wheel_up", "down", radar_zoom_in) --This doesn't work
	bindKey("mouse_wheel_down", "down", radar_zoom_out) --And This doesn't work
end

addEventHandler("onClientResourceStart",resourceRoot,onClientResourceStart)

function onClientResourceStop()
	setPlayerHudComponentVisible("radar",true)
	toggleControl("radar",true)
end
addEventHandler("onClientResourceStop",resourceRoot,onClientResourceStop)

I'll stop blowing up this forum after this question has been resolved xD

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