Jump to content

Duvida em script Ammunation!


Recommended Posts

Fiz um painel da Ammunation, Utilizando o GuiEditor dai eu fiz as funções tudo certinho. So que eu não sei faser oque vai acontecer quando a pessoa escolher uma coisa da lista ele vai procurar a função e vai faze-la eu não se faser allguem me ajuda?

 

Foto.png

 

Client: 

--[[



 ################################################
 #                                              #
 #              Script Criado Por               #
 #           FACEBOOK.COM/AIRNEWSCR             #
 #                                              #
 #                                              #
 ################################################



--]]

--------------------------------------------------------------------

local screenW,screenH = guiGetScreenSize()
local resW, resH = 1366,768
local x, y = (screenW/resW), (screenH/resH)

--------------------------------------------------------------------

function Window(rnames)
  if isElement(myWindow) then return end
  local screenW, screenH = guiGetScreenSize()
  myWindow = guiCreateWindow((screenW - x*485) / 2, (screenH - y*404) / 2, x*485, y*404, "Loja - Ammunation", false)
  rotas = guiCreateGridList(x*40, y*40, x*405, y*275, false, myWindow)
  guiWindowSetSizable(myWindow, false)
  guiGridListAddColumn( rotas, "Armas", x*2 )
	
  for k,v in pairs(rnames) do
   row =  guiGridListAddRow ( rotas )
   guiGridListSetItemText ( rotas, row, 1,  tostring(k), false, false )
  end
	
  showCursor(true)
	
  fechar = guiCreateButton(x*275, y*334, x*168, y*35, "Fechar", false, myWindow)
  escolher = guiCreateButton(x*42, y*334, x*168, y*35, "Comprar", false, myWindow)
end
addEvent("abrirAmmunation", true)
addEventHandler("abrirAmmunation", localPlayer, Window)

function botoes(bt,state)
	if state == "up" and bt == "left" then
		if source == fechar then
			if isElement(myWindow) then
				destroyElement(myWindow)
				showCursor(false)
			end
		end
		if source == escolher then
			local selectedItemx = guiGridListGetSelectedItem(rotas)
			local nome = guiGridListGetItemText(rotas, selectedItemx, 1)
			if nome == nil then outputChatBox("#FF0000[AMMUNATION] #FFFFFFSelecione uma opção!",255,255,255,true) return end
			triggerServerEvent("ComprarArma",localPlayer,localPlayer,nome)	
			if isElement(myWindow) then
				destroyElement(myWindow)
				showCursor(false)
			end			
		end
	end
end
addEventHandler("onClientGUIClick", root,botoes)

 

Server

 

markerWeapon = createMarker(314.1630859375,-133.7568359375,999.6015625 -0.90, "cylinder", 1.0, 255, 0, 0, 255)
setElementInterior ( markerWeapon, 7 )

atualrotnumberJORNAL = {}
ppcikJORNAL = {}
blips = {}

rotasJORNAL = {
	["Deagle - R$ 150.000"] = {
	},
	["Pistola - R$ 150.000"] = {
	},
}

function pickjobJornal(source)
				triggerClientEvent(source,"abrirAmmunation",source,rotasJORNAL)
end
addEventHandler("onMarkerHit", markerWeapon, pickjobJornal)


local entrarInterior = createMarker(1368.3994140625,-1279.7177734375,13.546875 -0.90, 'cylinder', 1.0, 255, 0, 0, 255 ) -- Local onde o marker de entrada ira ser criado.
local sairInterior = createMarker(315.73046875,-143.4611328125,999.6015625 -0.90, 'cylinder', 1.0, 255, 0, 0, 255 ) -- Local onde o marker de saida ira ser criado.
setElementInterior ( sairInterior, 7 ) -- Interior ID  
--/--
function entrarLocal ( hitElement, matchingDimension )
    if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then -- Se o elemento que colidir for um player e não estiver em um veículo então:
        setElementPosition(hitElement, 315.94140625,-142.625,999.6015625) -- Posição Do Interior
        setElementInterior ( hitElement, 7 ) -- Interior ID
    end
end
addEventHandler( "onMarkerHit", entrarInterior , entrarLocal ) 
--/--
function sairLocal ( hitElement, matchingDimension )
    if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then  -- Se o elemento que colidir for um player e não estiver em um veículo então:  
        setElementPosition(hitElement, 1366.392578125,-1279.69921875,13.546875) -- Posição Do Interior
        setElementInterior ( hitElement, 0 ) -- Interior ID  
    end
end
addEventHandler( "onMarkerHit", sairInterior , sairLocal ) 

 

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