Jump to content

[HELP] Markers


Dimos7

Recommended Posts

data = {
    -- Free: { x, y, z [, rz=0, sx=x, sy=y, sz=y ] }
    ['Free'] = {
        { 1538.88, -1686.07, 13.55, 90  },
        { 1188.35, -1331.75, 13.56 },
        { 2034.61, -1437.47, 17.32, 140 },
        { 1374.35, 416.79, 19.78, 68.7 }, 
        { 1624.37, 1817.87, 10.82 },
        { 2578.49, 1978.19, 10.82, -90 },
        { -331.47, 1063.28, 19.74, -90 },
        { -1504.19, 2533.95, 55.69, 90 },
        { -2641.08, 620.4, 14.45, 90 },
        { -2206.39, -2299.49, 30.63, 324 },
        { -1568.97, 653.7, 7.19, 180 },
        { 2242.02, 26.46, 26.44 },
		{ 1682.8000488281, -2248.1999511719, 13. },
		{ -1404.3000488281, -314.10000610352, 13.9 },	
		{ 1714.5, 1471.5, 10.5 },
		{ 2219.5, 2441.3000488281, 10.5 },
    },
    ---- END OF FREE -- Start of Jobs --
	
	-- { job, x, y, z, { r, g, b } [, rz=0, sx=x, sy=y, sz=y ] }
	['Jobs'] = {
		{ "Criminal", 2138.91, -1727.17, 13.54, { 255, 50, 50 }, -90 },
		{ "Criminal", 1619.44, -1515.73, 13.58, { 255, 50, 50 }, 180 },
		{ "Criminal", -1850.41, 587.29, 35.16, { 255, 50, 50 }, 0 },
		{ "Criminal", -2530.29, -602.73, 132.56, { 255, 50, 50 }, 180 },
		{ "Criminal", 1995.12, 2298.61, 10.81, { 255, 50, 50 }, 90 },
		{ "Criminal", 2449.5, 1328.18, 10.82, { 255, 50, 50 }, 0 },
		{ "Criminal", 2130.48, 887.71, 10.81, { 255, 50, 50 }, 0 },		
		
		{ "Mechanic", 2283.34, -2350.81, 13.55, { 255, 255, 0 }, 41.5 },
		{ "Mechanic", -1705.72, 389.96, 7.18, { 255, 255, 0 }, 230.3 },
		{ "Mechanic", 1657.99, 2195.29, 10.82, { 255, 255, 0 }, 90 },
		
		{ "Medic", 1179.02, -1339.01, 13.86, { 0, 255, 255 }, -90 },
		{ "Medic", 1179.02, -1309, 13.86, { 0, 255, 255 }, -90 },
		{ "Medic",  1590.05, 1820.54, 10.82, { 0, 255, 255 }, 0 },
		
		{ "Police Officer", 1555.09, -1610.62, 13.38, { 0, 100, 255 }, 180 },
		{ "Police Officer", 1565, -1610.62, 13.38, { 0, 100, 255 }, 180 },
		{ "Police Officer", 1575, -1610.62, 13.38, { 0, 100, 255 }, 180 },
		{ "Police Officer", -1612.39, 674.73, 7.19, { 0, 100, 255 }, 180 },
		{ "Police Officer", -1606, 674.73, 7.19, { 0, 100, 255 }, 180 },
		{ "Police Officer", -1600.5, 674.73, 7.19, { 0, 100, 255 }, 180 },
		{ "Police Officer", -1594.2, 674.73, 7.19, { 0, 100, 255 }, 180 },
		{ "Police Officer", -1587.7, 674.73, 7.19, { 0, 100, 255 }, 180 },
		{ "Police Officer", 2251.78, 2477.21, 10.82, { 0, 100, 255 }, 180 },
		{ "Police Officer", 2256.34, 2477.21, 10.82, { 0, 100, 255 }, 180 },
		{ "Police Officer", 2259.96, 2477.21, 10.82, { 0, 100, 255 }, 180 },
		{ "Police Officer", 2269.49, 2477.21, 10.82, { 0, 100, 255 }, 180 },
		{ "Police Officer", 2273.05, 2477.21, 10.82, { 0, 100, 255 }, 180 },
		{ "Police Officer", 2277.39, 2477.21, 10.82, { 0, 100, 255 }, 180 },
		{ "Police Officer", 2281.58, 2477.21, 10.82, { 0, 100, 255 }, 180 },
		
		{ "Military", 3314.8999023438, -1960.9000244141, 27.3, { 0, 128, 0 }, 90 },
		{ "Military", 3309, -1963.3000488281, 11.3, { 0, 128, 0 }, 90 },
		{ "Military", 3466.8000488281, -1863.5999755859, 25.3, { 0, 128, 0 }, 180 },
		{ "Military", 2251.89, 2442.97, 10.82, { 0, 128, 0 }, 180 },	
		
		{ "ZETAS", -2073.06, 1466.9, 13.05, { 0, 0, 0 }, 180 },	
		{ "ZETAS", -2178.06, 1450.22, 20.09, { 0, 0, 0 }, 90 },			
		
		{ "SWAT", 861.39605712891, -1984.6593017578, 12.620330047607, { 0, 0, 255 }, 0 },	
		{ "SWAT", 905.19989013672, -2053.8337402344, 35.600001525879, { 0, 0, 255 }, 90 },
		{ "SWAT", 904.6220703125, -1957.6130371094, 45.528125, { 0, 0, 255 }, 0 },
		{ "SWAT", 2260.11, 2442.97, 10.82, { 0, 0, 255 }, 0 },

		{ "Terrorists", -70.295547485352, -1758.0194091797, 10.0921878814697, { 255, 140, 0 }, -90 },
		{ "Terrorists", -97.74853515625, -1836.6586914063, 4.0843750953674, { 255, 140, 0 }, -90 },				
		
		{ "Pilot", 1983.21, -2301.92, 13.55, { 255, 255, 0 }, 90 },
		{ "Pilot", -1243.48, -26.32, 14.15, { 255, 255, 0 }, 131 },
		{ "Pilot", -1257.59, -12.07, 14.15, { 255, 255, 0 }, 131 },
		{ "Pilot",1638.02, 1548.39, 10.8, { 255, 255, 0 }, 50 },
		
		{ "Stunter", 1945.67, -1378, 18.58, { 200, 200, 0 }, 90 },
	}
	
}

jobSettings = {
	["Military"] = {
		group = "Military"
	},
	["SWAT"] = {
		group = "SWAT"
	},
	["Terrorists"] = {
		group = "Terrorists"
	},
	["ZETAS"] = {
		group = "ZETAS"
	}	
}

JobVehicles = {
	['Free'] = { 412, 457, 468 },
	['Criminal'] = { 522, 459 },
	['Terrorists'] = { 522, 411, 470, 433, 432, 425, 520 },
	['Mechanic'] = { 525 },
	['Police Officer'] = { 596, 597, 598, 599, 560 },
	['Military'] = { 522, 411, 470, 433, 432, 425, 520 },
	['ZETAS'] = { 411, 546, 522, 506, 603, 519 },	
	['SWAT'] = { 522, 411, 470, 433, 432, 425, 520 },	
	['Medic'] = { 416 },
	['Fisherman'] = { 453 },
	['Detective'] = { 596, 597, 598, 599, 560 },
	['Pilot'] = { 519, 513 },
	['Stunter'] = { 481 }
}

VipVehicles = { 
	[0] = { }, -- None
	[1] = { 522 }, -- Bronze
	[2] = { 522, 560 }, -- Silver
	[3] = { 522, 560, 546, 411 }, -- gold
	[4] = { 522, 560, 546, 411 } -- diamond
}



local sx, sy  = guiGetScreenSize ( )
local rsx, rsy = sx / 1280, sy / 1024
local window = guiCreateWindow( ( sx / 2 - ( rsx*354 ) / 2 ), ( sy / 2 - (rsy*400) / 2 ), (rsx*354), (rsy*400), "Spawners", false)
local vehList = guiCreateGridList((rsx*9), (rsy*26), (rsx*335), (rsy*315), false, window)
local btnSpawn = guiCreateButton((rsx*13), (rsy*346), (rsx*149), (rsy*43), "Spawn", false, window)
local btnClose = guiCreateButton((rsx*195), (rsy*346), (rsx*149), (rsy*43), "Cancel", false, window)
guiWindowSetSizable(window, false)
guiSetVisible ( window, false )
guiGridListAddColumn(vehList, "Vehicle", 0.9)
local marker = nil
addEvent ( "NGSpawners:ShowClientSpawner", true )
addEventHandler ( "NGSpawners:ShowClientSpawner", root, function ( cars, mrker )
	if ( wasEventCancelled ( ) ) then	
		return
	end
	
	if ( not guiGetVisible ( window ) ) then 
		bindKey ( "space", "down", spawnClickingFunctions )
		showCursor ( true )
		guiSetVisible ( window, true )
		guiGridListClear ( vehList )
		addEventHandler ( 'onClientMarkerLeave', mrker, closeWindow )
		marker = mrker
		job = getElementData ( marker, "NGVehicles:JobRestriction" )
		guiGridListSetItemText ( vehList, guiGridListAddRow ( vehList ), 1, "Free Vehicles", true, true )
		for i, v in ipairs ( cars ) do
			local name = getVehicleNameFromModel ( v )
			local row = guiGridListAddRow ( vehList )
			guiGridListSetItemText ( vehList, row, 1, name, false, false )
			guiGridListSetItemData ( vehList, row, 1, v )
		end
		
		if ( exports.NGVIP:isPlayerVIP ( ) ) then
			local level = exports.NGVIP:getVipLevelFromName ( getElementData ( localPlayer, "VIP" ) )
			if ( level and level > 0 and VipVehicles [ level ] and #VipVehicles [ level ] > 0 ) then
				guiGridListSetItemText ( vehList, guiGridListAddRow ( vehList ), 1, "VIP Vehicles", true, true )
				for i, v in pairs ( VipVehicles [ level ] ) do
					local name = getVehicleNameFromModel ( v )
					local row = guiGridListAddRow ( vehList )
					guiGridListSetItemText ( vehList, row, 1, name, false, false )
					guiGridListSetItemData ( vehList, row, 1, v )
				end
			end
		end
		
		guiGridListSetSelectedItem ( vehList, 0, 1 )
		addEventHandler ( "onClientGUIClick", btnSpawn, spawnClickingFunctions )
		addEventHandler ( "onClientGUIClick", btnClose, spawnClickingFunctions )
	end
end )


function spawnClickingFunctions ( )
	if ( source == btnClose ) then
		closeWindow ( localPlayer )
	elseif ( source == btnSpawn ) or getKeyState( "space" ) == true then
		local row, col = guiGridListGetSelectedItem ( vehList )
		if ( row == -1 ) then
			return exports['NGMessages']:sendClientMessage ( "Select a vehicle to be spawn.", 255, 255, 0 )
		end
		
		local id = guiGridListGetItemData ( vehList, row, 1 )
		triggerServerEvent ( "NGSpawners:spawnVehicle", localPlayer, id, marker, true )
		closeWindow ( localPlayer )
	end
end 

function closeWindow ( p )
	if ( not p or p == localPlayer ) then
		removeEventHandler ( 'onClientMarkerLeave', marker, closeWindow )
		marker = nil
		guiSetVisible ( window, false )
		showCursor ( false )
		guiGridListClear ( vehList )
		removeEventHandler ( "onClientGUIClick", btnSpawn, spawnClickingFunctions )
		removeEventHandler ( "onClientGUIClick", btnClose, spawnClickingFunctions )
		unbindKey ( "space", "down", spawnClickingFunctions )
	end
end
addEvent ( "NGSpawners:CloseWindow", true )
addEventHandler ( "NGSpawners:CloseWindow", root, closeWindow )

I want to make some militrary marker to only have plane and helicopter and other have the other vehicles isElementWithMarker need name for marker?

Link to comment

If you add the job Military Airborne and alter the current Military job into Military Groundforce or anything else... it will be easy.

You will set normal vehicles to ground units and planes to airborne unit.

There is many other ways.. but this on is ez. If you dont wish to change Military name just say so amd I will give you another way.

Link to comment

I think he wants to make spawners for air and ground for the same group or job.

It supposed to show for him now like this:

NRG

Sultan

Infernus

Intruder

Hydra

Hunter

He needs to make 2 markers for the same group or job like this

Marker 1 Ground:

NRG

Sultan

Infernus

Intruder

Marker 2 Air:

Hydra

Hunter

I am having same problem, so yeah

 

 

Edited by AserOsama
Link to comment
  • 2 weeks later...

To explain more, this spawners (Markers) are placed at Garages, Helicopter (H which helicopters land on) and Airports, now the problem that I am facing is at all these spawners (markers) I have Cars, Bikes, Planes and Helicopters, That means that I am going to have Planes and Helicopters in garages, Cars and bikes in Airports and (H sign) which will cause alot of problems and bugs. I need to add for example in Garages Infernus and NRG, in Airports Hydra and in (H sign) Maverick, but it now shows in all this places like this: Infernus, NRG, Hydra and Maverick. 

Edited by AserOsama
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...