Jump to content

Spawn veiculos trabalho por marker


Recommended Posts

----- queria que apenas spawnase quando um trabalhador hit o marker 

carro = createMarker(2146.883, -2289.945, 14.761 -1,"cylinder", 2.0, 255,0,0,80)
desespawncm = createMarker(2151.133, -2290.037, 13.368 -1 , "cylinder",2.0,255,255,255,80)


veh = {}


function spawnviaturaone(thePlayer)
	local vehicle = getPedOccupiedVehicle(thePlayer)
	if isElementWithinMarker(thePlayer, carro) then
		if veh[thePlayer] and isElement(veh[thePlayer]) then destroyElement(veh[thePlayer])
			veh[thePlayer] = nil
		else
		veh[thePlayer] = createVehicle(530, 2153.617, -2287.28, 13.524)
		warpPedIntoVehicle(thePlayer, veh[thePlayer])
		end
	end
end
addEventHandler("onMarkerHit", carro, spawnviaturaone )



function desespawncmm(thePlayer)
	destroyElement(veh[thePlayer])
	destroyElement(thePlayer)
end
addEventHandler("onMarkerHit", desespawncm, desespawncmm)



function Sair_do_Servidor_AirNewSCR ( quitType )
	if isElement ( veh[source] ) then
	    destroyElement ( veh[source] )
	end
end
addEventHandler ( "onPlayerQuit", getRootElement ( ), Sair_do_Servidor_AirNewSCR )
-- client trabalho

--[[



 ################################################
 #                                              #
 #              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, "Rotas", false)
  rotas = guiCreateGridList(x*40, y*40, x*405, y*275, false, myWindow)
  guiWindowSetSizable(myWindow, false)
  guiSetAlpha(rotas, x*0.70)
  guiGridListAddColumn( rotas, "Rotas", x*0.85 )
	
  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, "Carregar", false, myWindow)
end
addEvent("AirNew>JOBEntregadorDeJornal>AbrirPainel<Client", true)
addEventHandler("AirNew>JOBEntregadorDeJornal>AbrirPainel<Client", 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("[ #00FF73Servidor #ffffff] - Selecione Uma Rota",255,255,255,true) return end
			triggerServerEvent("AirNew>request>Startrota>Server>EntregadorDeJornal",localPlayer,localPlayer,nome)	
			if isElement(myWindow) then
				destroyElement(myWindow)
				showCursor(false)
			end			
		end
	end
end
addEventHandler("onClientGUIClick", root,botoes)


function blips(state,x,y,z)
	if state == true then
		if not isElement(blips) then
			blips = createBlip ( x, y, z, 0)
		end
	else
		if isElement(blips) then
			destroyElement(blips)
		end	
	end
end
addEvent("AirNew>JOBEntregadorDeJornal>blips<Client", true)
addEventHandler("AirNew>JOBEntregadorDeJornal>blips<Client", localPlayer, blips)

function DesligarAntiQuedaBike ()  
 setPedCanBeKnockedOffBike ( localPlayer, true )
end
addEvent( "Desligar:AntiQueda", true )
addEventHandler( "Desligar:AntiQueda", localPlayer, DesligarAntiQuedaBike )

function LigarAntiQuedaBike ()  
 setPedCanBeKnockedOffBike ( localPlayer, false )
end
addEvent( "Ligar:AntiQueda", true )
addEventHandler( "Ligar:AntiQueda", localPlayer, LigarAntiQuedaBike )
--server trabalho 

MarkerSafeEntregadorDeJornal = createMarker( 765.68848, -1355.44495, 13.52570, "cylinder", 35, 0, 255, 0, 0)

EntregadorDeJornalPickup = createPickup ( 783.27710, -1327.66260, 13.54688, 3, 1210)
MarkerEntregadorDeJornal = createMarker ( 783.27710, -1327.66260, 13.54688, "cylinder", 1.2, 255, 255, 255, 0 )
attachElements ( MarkerEntregadorDeJornal, EntregadorDeJornalPickup, 0, 0, -1 )
BlipEntregadorDeJornal = createBlipAttachedTo ( MarkerEntregadorDeJornal, 42 )
setBlipVisibleDistance ( BlipEntregadorDeJornal, 150 )

function CancelarSumirPickup ( player )
   cancelEvent()
end
addEventHandler ( "onPickupHit", EntregadorDeJornalPickup, CancelarSumirPickup )

LetraParaMarkers = "k"
cmd1 = "hq"
cmd2 = "profissao"

local HQEntregadorDeJornalBlip = createBlip ( 783.27710, -1327.66260, 13.54688 )
setElementVisibleTo ( HQEntregadorDeJornalBlip, root, false )

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

function VerificarBlipEmprego(player)
  if player then
  acc = getPlayerAccount ( player )
  if isGuestAccount ( acc ) then return end
  setElementVisibleTo ( HQEntregadorDeJornalBlip, player, false )
  end
end

setTimer(
function()
	for i, pl in pairs(getElementsByType("player")) do
		if pl ~= (false or nil) then
		    if getElementData ( pl, "Emprego" ) == "Entregador de Jornal" then return end
			   VerificarBlipEmprego(pl)
		end
	end
end,
3000,0)

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

function ComandoHQ ( source )
    if getElementData ( source, "Emprego" ) == "Entregador de Jornal" then
	if isElementVisibleTo ( HQEntregadorDeJornalBlip, source ) then
	setElementVisibleTo ( HQEntregadorDeJornalBlip, source, false )
	exports.Scripts_Dxmessages:outputDx(source, "Seu Local de Trabalho foi Desmarcado do Mapa!", "info")
	else
	setElementVisibleTo ( HQEntregadorDeJornalBlip, source, true )
	exports.Scripts_Dxmessages:outputDx(source, "Seu Local de Trabalho foi Marcado no Mapa!", "info")
end
end
end
addCommandHandler ( cmd1, ComandoHQ )

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

function AceitarEmprego02 (source)
exports.Scripts_OnMarkerMsgs_:delete(source)
unbindKey ( source, LetraParaMarkers, "down", AceitarEmprego02 )
if getElementData ( source, "AirNew>Encaminhamento" ) == "Entregador de Jornal" then
setElementData ( source, "AirNew>Encaminhamento", false )
setElementData ( source, "Emprego", "Entregador de Jornal" )
exports.Scripts_Dxmessages:outputDx(source, "Você Agora Trabalha de Entregador de Jornal, Para Mais Informações Digite ( /Profissao )", "success")
else
exports.Scripts_Dxmessages:outputDx(source, "Você Precisa Estar Encaminhado da Agencia de Empregos para Trabalhar neste Local!", "error")
end
end

function RecusarEmprego02 (source)
exports.Scripts_OnMarkerMsgs_:delete(source)
unbindKey ( source, LetraParaMarkers, "down", RecusarEmprego02 )
if isElementVisibleTo ( HQEntregadorDeJornalBlip, source ) then
setElementVisibleTo ( HQEntregadorDeJornalBlip, source, false )
end
removeElementData ( source, "Emprego", "Entregador de Jornal" )
exports.Scripts_Dxmessages:outputDx(source, "Você se Demitiu do Emprego de Entregador de Jornal com Sucesso!", "warning")
end

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

function ComandosProf ( ThePlayer )
if getElementData ( ThePlayer, "Emprego" ) == "Entregador de Jornal" then
playSoundFrontEnd ( ThePlayer, 43 )
outputChatBox ( "#F9A631~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #F96031Profissão #F9A631~~~~~~~~~~~~~~~~~~~~~~~~~~~~", ThePlayer, 255, 255, 255, true )
outputChatBox ( "#F96031» #BEE09AComandos da Profissão de Entregador de Jornal", ThePlayer, 255, 255, 255, true )
outputChatBox ( "#F96031» #55D444/HQ #ffffff- #9ABDE0Para Marcar / Desmarcar o seu Local de Trabalho", ThePlayer, 255, 255, 255, true )
outputChatBox ( "#F96031» #55D444/Rotas #ffffff- #9ABDE0Abre a Lista de Rotas Disponiveis Para Trabalhar", ThePlayer, 255, 255, 255, true )
outputChatBox ( "#F96031» #FFD700Entre na Bike e Digite /Rotas Selecione uma Rota e Siga os Checkpoints!", ThePlayer, 255, 255, 255, true )
outputChatBox ( "#F9A631~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #F96031Profissão #F9A631~~~~~~~~~~~~~~~~~~~~~~~~~~~~", ThePlayer, 255, 255, 255, true )
end
end
addCommandHandler(cmd2, ComandosProf )

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

function emarker(marker,md)
	if (md) then
	  if isPedInVehicle ( source ) then return end
		if marker == MarkerEntregadorDeJornal then
		    if getElementData ( source, "Emprego" ) == "Entregador de Jornal" then
			exports.Scripts_OnMarkerMsgs_:create(source,"Aperte 'K' Para se Demitir do Emprego de Entregador de Jornal")
			bindKey ( source, LetraParaMarkers, "down", RecusarEmprego02 )
		else
			exports.Scripts_OnMarkerMsgs_:create(source,"Aperte 'K' Para Aceitar o Emprego de Entregador de Jornal")
			bindKey ( source, LetraParaMarkers, "down", AceitarEmprego02 )
		end
	 end
  end
end
addEventHandler("onPlayerMarkerHit",getRootElement(),emarker)

function lmarker(marker,md)
	if (md) then
		if marker == MarkerEntregadorDeJornal then
			exports.Scripts_OnMarkerMsgs_:delete(source)
			unbindKey ( source, LetraParaMarkers, "down", AceitarEmprego02 )
			unbindKey ( source, LetraParaMarkers, "down", RecusarEmprego02 )
		end
	end
end
addEventHandler("onPlayerMarkerLeave",getRootElement(),lmarker)

function CriarVeiculosComData ()
VeiculosComDataEntregadorDeJornal = {
createVehicle(418, 783.54602, -1334.39611, 13.66790, 0, 0, 90 ),
createVehicle(418, 783.19165, -1339.09948, 13.50201, 0, 0, 90 ),
createVehicle(418, 783.29638, -1343.80102, 13.50254, 0, 0, 90 ),
createVehicle(418, 783.37371, -1348.26196, 13.50224, 0, 0, 90 ),
createVehicle(418, 783.51849, -1352.64526, 13.50811, 0, 0, 90 ),

createVehicle(418, 783.38525, -1357.21313, 13.131029, 0, 0, 90 ),
createVehicle(418, 783.16894, -1361.29101, 13.192735, 0, 0, 90 ),
createVehicle(418, 783.11541, -1365.41711, 13.194348, 0, 0, 90 ),
createVehicle(418, 783.16296, -1369.40722, 13.195641, 0, 0, 90 ),
------ createVehicle(510, 783.16296, -1369.40722, 13.195641, 0, 0, 90 ),

------ createVehicle(418, 785.55151, -1332.39575 -20, 13.54213, 0, 0, 90 ),
------ createVehicle(510, 785.55151, -1332.39575 -22, 13.54213, 0, 0, 90 ),
------ createVehicle(418, 785.55151, -1332.39575 -24, 13.54213, 0, 0, 90 ),
------ createVehicle(510, 785.55151, -1332.39575 -26, 13.54213, 0, 0, 90 ),
------ createVehicle(418, 785.55151, -1332.39575 -28, 13.54213, 0, 0, 90 ),

------ createVehicle(510, 785.55151, -1332.39575 -30, 13.54213, 0, 0, 90 ),
------ createVehicle(418, 785.55151, -1332.39575 -32, 13.54213, 0, 0, 90 ),
------ createVehicle(510, 785.55151, -1332.39575 -34, 13.54213, 0, 0, 90 ),
------ createVehicle(418, 785.55151, -1332.39575 -36, 13.54213, 0, 0, 90 ),
------ createVehicle(510, 785.55151, -1332.39575 -38, 13.54213, 0, 0, 90 ),

------ createVehicle(418, 785.55151, -1332.39575 -40, 13.54213, 0, 0, 90 ),
------ createVehicle(510, 785.55151, -1332.39575 -42, 13.54213, 0, 0, 90 ),
------ createVehicle(418, 785.55151, -1332.39575 -44, 13.54213, 0, 0, 90 ),
------ createVehicle(510, 785.55151, -1332.39575 -46, 13.54213, 0, 0, 90 ),
------ createVehicle(418, 785.55151, -1332.39575 -48, 13.54213, 0, 0, 90 ),

------ createVehicle(510, 785.55151, -1332.39575 -50, 13.54213, 0, 0, 90 ),

}

for i, veh in ipairs(VeiculosComDataEntregadorDeJornal) do
setElementData ( veh, "Emprego", "Entregador de Jornal" )
setVehicleDamageProof(veh,true)
setVehicleColor( veh, 0, 0, 0 )
setVehiclePlateText ( veh, "RPGAMING" )
addEventHandler("onVehicleStartEnter", veh, VerificarEmprego )
--addEventHandler("onVehicleExit", veh, SairDoVeiculosComData )
local tx, ty, tz = getElementPosition(veh)
local rx, ry, rz = getElementRotation(veh)
setVehicleRespawnPosition(veh, tx, ty, tz, rx, ry, rz)
end
end
addEventHandler("onResourceStart", resourceRoot, CriarVeiculosComData )

function VerificarEmprego (thePlayer, seat)
local Jogador = getElementData(thePlayer, "Emprego" )
if seat == 0 then
    if Jogador == "Entregador de Jornal" then
	else
    cancelEvent()
    exports.Scripts_Dxmessages:outputDx(thePlayer, "Esse Veiculo é Exclusivo dos Entregadores de Jornal!", "error")
    end
  end
end

--[[function SairDoVeiculosComData ()
local veh = source
setTimer(function()
  if getVehicleOccupant(veh) == false then
respawnVehicle(veh)
end
end, 30000, 1)
end
addEventHandler ( "onPlayerQuit", getRootElement(), SairDoVeiculosComData ) --]]

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

local rElement = getRootElement()

function respawnVehicles(player, seconds)
    for i, veh in ipairs(VeiculosComDataEntregadorDeJornal) do
        if isEmpty( veh ) then
                respawnVehicle ( veh )
            end
        end
    end
setTimer(respawnVehicles, 60000,0)

function isEmpty( vehicle )
    local passengers = getVehicleMaxPassengers( vehicle )
    if type( passengers ) == 'number' then
        for seat = 0, passengers do
            if getVehicleOccupant( vehicle, seat ) then
                return false
            end
        end
    end
    return true
end

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

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

rotasJORNAL = {
	["Entregas de Jornais - Los Santos (1) - 20 Entregas - $2500"] = {
		{825.184020, -1472.98876, 12.53338}, ------- 993.64386, -1050.08850, 30.72189
		{763.92578, -1564.48425, 13.20226},
		{1248.03588, -1561.93261, 13.21602},
		{1364.48669, -1279.30102, 13.19416},
		{1408.68762, -930.52990, 35.071788},
		{1423.06555, -883.22113, 50.198425},
		{1516.51940, -764.47930, 79.699653},
		{1269.48010, -916.03302, 42.007972},
		{1024.39660, -982.81207, 42.304122},
		{458.39724, -1501.76721, 30.685428},
		{314.51614, -1772.04675, 4.31334},
		{335.31448, -1352.68127, 14.16307},
		{406.65902, -1264.70227, 49.95773},
		{542.10595, -1200.41784, 44.04943},
		{688.54528, -1073.10400, 49.11075},
		{833.98223, -926.041992, 54.89589},
		{895.58306, -921.980895, 42.07406},
		{996.54058, -916.591735, 41.82923},
		{904.05651, -1333.21496, 13.16217},
		{778.05102, -1333.59057, 13.19954},
	},
	["Entregas de Jornais - Los Santos (2) - 20 Entregas - $3250"] = {
		{799.274, -1070.383, 24.087},
		{637.208, -571.723, 15.84},
		{680.38, -481.45, 15.841},
		{236.531, -226.303, 1.081},
		{211.736, -208.112, 1.088},
		{209.682, -67.42, 1.088},
		{254.644, -67.281, 1.086},
		{318.415, -126.088, 1.94},
		{1284.511, 175.263, 19.987},
		{1293.098, 268.087, 19.068},
		{1355.85, 244.474, 19.224},
		{1351.297, 207.086, 19.212},
		{2248.981, 46.128, 25.988},
		{2307.204, 87.946, 25.989},
		{2357.026, 119.875, 26.641},
		{2811.293, -1182.426, 24.949},
		{2854.568, -1345.299, 10.722},
		{2494.49, -1755.65, 13.137},
		{1425.196, -1699.463, 13.041},
		{777.526, -1335.479, 13.538},
	},
}

pay = {
	["Entregas de Jornais - Los Santos (1) - 20 Entregas - $2500"] = 2500,
	["Entregas de Jornais - Los Santos (2) - 20 Entregas - $3250"] = 3250,
}

function ifPlayerEnterOnMarker(markerHit,matchingDimension)
	if isPedInVehicle(source) then
		if markerHit == ppcikJORNAL[source] then
			if (matchingDimension) then
				if isElement(ppcikJORNAL[source]) then
					local rname = getElementData(source,"rtnameJORNAL") or nil
					if rname == nil then return end
					destroyElement(ppcikJORNAL[source])
					triggerClientEvent(source,"AirNew>JOBEntregadorDeJornal>blips<Client",source,false)
					local vh = getPedOccupiedVehicle(source)

					toggleAllControls ( source, false )
					setControlState ( source, "handbrake", true )

					if atualrotnumberJORNAL[source] <= #rotasJORNAL[rname] then
					    exports.Scripts_Dxmessages:outputDx(source, "Entregando Jornais... Aguarde 2 Segundos!", "info")
						setTimer(gerarrota,2500,1,source)
						setTimer(function(source) exports.Scripts_Dxmessages:outputDx(source, "Jornais Entregues, Siga Para o Proximo Checkpoint!", "success") end,2500,1,source)
					elseif atualrotnumberJORNAL[source] == #rotasJORNAL[rname]+1 then
						setElementData(source,"rtnameJornal",rname)
						atualrotnumberJORNAL[source] = 1
						local rec = pay[rname]
						givePlayerMoney(source,tonumber(rec))
						local vh = getPedOccupiedVehicle(source)
						setTimer(function(source) exports.Scripts_Dxmessages:outputDx(source, "Você Recebeu um Valor de $"..rec.." Por Finalizar as Entregas de Jornais!", "success") end,2500,1,source)
						setTimer(function(source) toggleAllControls ( source, true ) end, 2500,1, source )
						setTimer(function(source) setControlState ( source, "handbrake", false ) end, 2500,1, source )
						setElementData(source,"rtnameJornal",nil)
					end


				end

			end
		end
	end
end
addEventHandler("onPlayerMarkerHit",getRootElement(),ifPlayerEnterOnMarker)

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

function VerificarCairBike(player)
  if player then
  acc = getPlayerAccount ( player )
  if isGuestAccount ( acc ) then return end
  local rname = getElementData(player,"rtnameJornal") or nil
  if rname == nil then
  triggerClientEvent ( "Desligar:AntiQueda", player )
  else
  triggerClientEvent ( "Ligar:AntiQueda", player )
  end
 end
end

setTimer(
function()
	for i, pl in pairs(getElementsByType("player")) do
		if pl ~= (false or nil) then
		    if getElementData ( pl, "Emprego" ) == "Entregador de Jornal" then
			   VerificarCairBike(pl)
			end
		end
	end
end,
3000,0)

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

function pickjobJornal(source)
	if not isElement(source) then return end
	local im = isPedInVehicle(source)
	if im == false then return end
	local job = getElementData(source,"Emprego") or false
	if job == "Entregador de Jornal" then
	local vh = getPedOccupiedVehicle(source)
	if isElement(vh) then
		local x,y = getElementPosition(vh)
		local x1,y1 = getElementPosition(source)
		local dist = getDistanceBetweenPoints2D(x,y,x1,y1)
		local isMarkerSafe = isElementWithinMarker(vh,MarkerSafeEntregadorDeJornal)
		local id = getElementModel(vh)
		local seat = getPedOccupiedVehicleSeat(source)
		if dist > 0 then return end
		if id == 418 then
			if seat == 0 then
				if isMarkerSafe == false then return end
				triggerClientEvent(source,"AirNew>JOBEntregadorDeJornal>AbrirPainel<Client",source,rotasJORNAL)
			end
		end
	end
end
end
addCommandHandler("rotas",pickjobJornal)

function receivert(source,rotaname)
	if isElement(ppcikJORNAL[source]) then
		destroyElement(ppcikJORNAL[source])
	end
	triggerClientEvent(source,"AirNew>JOBEntregadorDeJornal>blips<Client",source,false)
	setElementData(source,"rtnameJornal",rotaname)
	atualrotnumberJORNAL[source] = 1
	gerarrota(source)
end
addEvent("AirNew>request>Startrota>Server>EntregadorDeJornal", true)
addEventHandler("AirNew>request>Startrota>Server>EntregadorDeJornal",getRootElement(), receivert)

function gerarrota(source)
	local rname = getElementData(source,"rtnameJornal") or nil
	if rname == nil then return end
	if not isElement(ppcikJORNAL[source]) and isPedInVehicle(source) then
		local vh = getPedOccupiedVehicle(source)
		toggleAllControls ( source, true )
		setControlState ( source, "handbrake", false )
		local id = tonumber(atualrotnumberJORNAL[source])
		local x,y,z = rotasJORNAL[rname][id][1],rotasJORNAL[rname][id][2],rotasJORNAL[rname][id][3]
		ppcikJORNAL[source] = createMarker (x, y,z, "checkpoint", 4, 255, 0, 0, 50,source)
		triggerClientEvent(source,"AirNew>JOBEntregadorDeJornal>blips<Client",source,true,x,y,z)
		atualrotnumberJORNAL[source] = id+1
	end
end

function sair ( quitType )
	if isElement(ppcikJORNAL[source]) then
		destroyElement(ppcikJORNAL[source])
	end
end
addEventHandler ( "onPlayerQuit", getRootElement(), sair )

function SairDaBike ( thePlayer, seat, jacked )
   local rname = getElementData(thePlayer,"rtnameJornal") or nil
   if rname == nil then return end
   canceljobtimer (thePlayer)
   exports.Scripts_Dxmessages:outputDx(thePlayer, "Você Saiu da Van, Entregas Canceladas!", "warning")
end
addEventHandler ( "onVehicleExit", getRootElement(), SairDaBike )

function canceljobtimer(source)
	if isElement(ppcikJORNAL[source]) then
		destroyElement(ppcikJORNAL[source])
	end
	triggerClientEvent(source,"AirNew>JOBEntregadorDeJornal>blips<Client",source,false)
	atualrotnumberJORNAL[source] = 1
	setElementData(source,"rtnameJornal",nil)
end

function canceljobdeath()
	local job = getElementData(source,"Emprego") or false
	if job ~= "Entregador de Jornal" then return end
	local rname = getElementData(source,"rtnameJornal") or nil
	if rname == nil then return end
	canceljobtimer(source)
	exports.Scripts_Dxmessages:outputDx(source, "Você Morreu e Suas Entregas Foram Canceladas!", "warning")
end
addEventHandler( "onPlayerWasted", getRootElement( ),canceljobdeath)

 

Link to comment

# Faça :

local carro = createMarker(2146.883, -2289.945, 14.761 -1,"cylinder", 2.0, 255,0,0,80)
local desespawncm = createMarker(2151.133, -2290.037, 13.368 -1 , "cylinder",2.0,255,255,255,80)

local veh = { }

function spawnviaturaone(thePlayer)
   local job = getElementData(thePlayer,"Emprego") or false  --/> ADD
   if job ~= "Entregador de Jornal" then --/> ADD
      return outputChatBox("Você Precisa Esta no Emprego Para Pegar Este Veiculo", thePlayer, 255, 255, 255, true) --/> ADD
   end --/> ADD

   local vehicle = getPedOccupiedVehicle(thePlayer)
   if isElementWithinMarker(thePlayer, carro) then
      if veh[thePlayer] and isElement(veh[thePlayer]) then 
         destroyElement(veh[thePlayer])
         veh[thePlayer] = nil
      else
         veh[thePlayer] = createVehicle(530, 2153.617, -2287.28, 13.524)
         warpPedIntoVehicle(thePlayer, veh[thePlayer])
      end
   end
end
addEventHandler("onMarkerHit", carro, spawnviaturaone )

function desespawncmm( thePlayer )
   if veh[thePlayer] and isElement(veh[thePlayer]) then --/> ADD
      destroyElement(veh[thePlayer])
   end --/> ADD
end
addEventHandler("onMarkerHit", desespawncm, desespawncmm)

 

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