Jump to content

[AJUDA ]Level em Profissão


Recommended Posts

Olá galera tudo bem? estou com uma dúvida, alguem poderia por gentileza ajudar?

Estou usando o emprego de "Entregador de Jornais" do AirNew, no entanto eu retirei o script da agencia, o player entra no emprego direto no local de trabalho!

Eu queria que quando ele fosse pegar o emprego (BindKey = k) houvesse uma restrição por level (Lv 5), (mod level já instalado), no caso uma mensagem dizendo que ele não tem level suficiente

como proceder? Desde já obrigado!

Client-Side

--[[



 ################################################
 #                                              #
 #              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, "JORNALEIRO", false)
  rotas = guiCreateGridList(x*20, y*40, x*450, y*275, false, myWindow)
  guiWindowSetSizable(myWindow, false)
  guiSetAlpha(rotas, x*0.70)
  guiGridListAddColumn( rotas, "Rotas", x*1.20 )
	
  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, "Iniciar", 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("[ #00FF73Brasil Virtual #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-Side

MarkerSafeEntregadorDeJornal = createMarker( 1417.9403076172, -1687.3420410156, 13.546875, "cylinder", 35, 0, 255, 0, 0)

EntregadorDeJornalPickup = createPickup ( 1412.0852050781, -1699.9636230469, 13.539485931396, 3, 1239)
MarkerEntregadorDeJornal = createMarker ( 1412.0852050781, -1699.9636230469, 13.539485931396, "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 ( 1417.9403076172, -1687.3420410156, 13.546875 )
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" ) == "Jornaleiro" then return end
			   VerificarBlipEmprego(pl)
		end
	end
end,
3000,0)

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

function ComandoHQ ( source )
    if getElementData ( source, "Emprego" ) == "Jornaleiro" 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 )
setElementData ( source, "Emprego", "Jornaleiro" )
exports.Scripts_Dxmessages:outputDx(source, "Você Agora Trabalha de Jornaleiro, Para Mais Informações Digite ( /Profissao )", "success")
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", "Jornaleiro" )
exports.Scripts_Dxmessages:outputDx(source, "Você se Demitiu do Emprego de Jornaleiro com Sucesso!", "warning")
end

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

function ComandosProf ( ThePlayer )
if getElementData ( ThePlayer, "Emprego" ) == "Jornaleiro" then
playSoundFrontEnd ( ThePlayer, 43 )
outputChatBox ( "#DF3A01~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #EFFBEFJORNALEIRO #DF3A01~~~~~~~~~~~~~~~~~~~~~~~~~~~~", ThePlayer, 255, 255, 255, true )
outputChatBox ( "#DF3A01» #EFFBEFComandos da Profissão de Jornaleiro:", ThePlayer, 255, 255, 255, true )
outputChatBox ( "#DF3A01» #DF3A01/hq #ffffff- #EFFBEFPara Marcar ou Desmarcar a sede do seu Local de Trabalho", ThePlayer, 255, 255, 255, true )
outputChatBox ( "#DF3A01» #DF3A01/entregarjornais #ffffff- #EFFBEFAbre a Lista de Rotas Disponiveis Para Trabalhar", ThePlayer, 255, 255, 255, true )
outputChatBox ( "#DF3A01» #EFFBEFMonte na Bicicleta e Digite #DF3A01/entregarjornais", ThePlayer, 255, 255, 255, true )
outputChatBox ( "#DF3A01» #EFFBEFSelecione uma rota de entrega e Siga os checkpoints no Mapa (F11)", ThePlayer, 255, 255, 255, true )
outputChatBox ( "#DF3A01» #EFFBEFQuando concluir as entregas você receberá uma #DBA901comissão", ThePlayer, 255, 255, 255, true )
outputChatBox ( "#DF3A01~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #EFFBEFJORNALEIRO #DF3A01~~~~~~~~~~~~~~~~~~~~~~~~~~~~", 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" ) == "Jornaleiro" then
			exports.Scripts_OnMarkerMsgs_:create(source,"Aperte 'K' Para se Demitir do Emprego de Jornaleiro")
			bindKey ( source, LetraParaMarkers, "down", RecusarEmprego02 )
		else
			exports.Scripts_OnMarkerMsgs_:create(source,"Aperte 'K' Para Aceitar o Emprego de Jornaleiro")
			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(510, 1417.8991699219, -1694.3439941406, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +4, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +6, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +2, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +8, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +10, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +12, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +14, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +16, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +18, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +20, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 -2, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +22, 13.0, 0, 0, 270 ),

}

for i, veh in ipairs(VeiculosComDataEntregadorDeJornal) do
setElementData ( veh, "Emprego", "Jornaleiro" )
setVehicleDamageProof(veh,true)
setVehicleColor( veh, 255, 255, 255 )
setVehiclePlateText ( veh, "BRV" )
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 == "Jornaleiro" then	
	else
    cancelEvent()
    exports.Scripts_Dxmessages:outputDx(thePlayer, "Esse Veiculo é Exclusivo dos Jornaleiros!", "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 = {
	["Los Santos - Favelas - 20 Entregas - Comissão: $300"] = {
		{1429.9464111328, -1905.8059082031, 13.773780822754},
		{1375.8276367188, -1918.4099121094, 19.122716903687},
		{1270.9599609375, -1902.0228271484, 28.374183654785},
		{1309.2713623047, -1961.1942138672, 29.166717529297},
		{1405.7294921875, -2045.7346191406, 54.065727233887},
		{1301.8836669922, -2048.9123535156, 58.464176177979},
		{1244.1116943359, -2053.9213867188, 59.876438140869},
		{1279.3021240234, -2031.7036132813, 58.958137512207},
		{1133.7977294922, -2025.0975341797, 69.000610351563},
		{1134.2821044922, -2098.537109375, 71.074172973633},
		{1092.1948242188, -2125.5886230469, 67.255599975586},
		{1045.2015380859, -2186.7719726563, 40.421051025391},
		{1161.7659912109, -2165.134765625, 64.786643981934},
		{1188.5417480469, -2331.0920410156, 14.28927230835},
		{1229.0968017578, -2203.7377929688, 37.594787597656},
		{1347.48828125, -2103.5290527344, 46.227912902832},
		{1411.4415283203, -2085.2429199219, 43.614170074463},
		{1452.4599609375, -2092.7153320313, 35.114093780518},
		{1480.2470703125, -2023.3793945313, 31.805692672729},
		{1515.3037109375, -2010.2598876953, 28.44634437561},
	},
	["Los Santos - Ganton/Temple - 20 Entregas - Comissão: $200"] = {
		{2494.3081054688, -1684.810546875, 12.510766983032},
		{2512.0192871094, -1689.4036865234, 13.544955253601},
		{2511.7531738281, -1651.3133544922, 13.91447353363},
		{2409.0688476563, -1671.6916503906, 13.580268859863},
		{2362.8149414063, -1646.5299072266, 13.53059387207},
		{2389.9978027344, -1717.0043945313, 13.60608291626},
		{2504.3889160156, -1788.6654052734, 13.555590629578},
		{2609.7587890625, -1849.3317871094, 3.2896952629089},
		{2560.2180175781, -1802.0985107422, 1.640625},
		{2521.1306152344, -1917.3314208984, 13.589694976807},
		{2419.9372558594, -1914.8271484375, 13.546899795532},
		{2437.5512695313, -1790.1809082031, 13.554225921631},
		{2324.8544921875, -1796.3190917969, 13.546875},
		{2155.7231445313, -1700.7188720703, 15.0859375},
		{2141.8076171875, -1607.6066894531, 14.187998771667},
		{2072.1538085938, -1628.64453125, 13.546875},
		{2069.1791992188, -1731.5767822266, 13.87615776062},
		{1985.9375, -1718.9539794922, 15.969563484192},
		{1961.2664794922, -1562.8210449219, 13.609630584717},
		{1863.8009033203, -1599.7763671875, 13.868625640869},
	},
	["Los Santos - Richman - 20 Entregas - Comissão: $100"] = {
		{230.03106689453, -1400.8328857422, 51.590793609619},
		{260.44561767578, -1363.5102539063, 53.109375},
		{167.86294555664, -1344.1441650391, 69.553092956543},
		{290.69464111328, -1331.0395507813, 53.444843292236},
		{356.9423828125, -1275.7287597656, 53.829723358154},
		{422.85809326172, -1262.6413574219, 51.580940246582},
		{633.45733642578, -1119.3950195313, 45.719078063965},
		{696.92242431641, -1058.3994140625, 49.402328491211},
		{724.82531738281, -994.73333740234, 52.623596191406},
		{790.10278320313, -844.86358642578, 60.641288757324},
		{832.16638183594, -858.89892578125, 69.921875},
		{837.51416015625, -891.27130126953, 68.768898010254},
		{930.03179931641, -852.59350585938, 93.500045776367},
		{977.28454589844, -826.35040283203, 96.275825500488},
		{1029.8919677734, -807.95526123047, 101.8515625},
		{1092.6324462891, -798.84069824219, 107.41916656494},
		{1107.7619628906, -731.60491943359, 100.61921691895},
		{1242.3199462891, -745.32543945313, 94.904930114746},
		{1356.48828125, -616.41851806641, 109.1328125},
		{1496.6713867188, -697.98297119141, 94.75},
	},
}

pay = {
	["Los Santos - Favelas - 20 Entregas - Comissão: $300"] = 300,
	["Los Santos - Ganton/Temple - 20 Entregas - Comissão: $200"] = 200,
	["Los Santos - Richman - 20 Entregas - Comissão: $100"] = 100,
}

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 Sua Comissão 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" ) == "Jornaleiro" 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 == "Jornaleiro" 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 == 510 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("entregarjornais",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 Bike, 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 ~= "Jornaleiro" 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

Possivelmente:

 

MarkerSafeEntregadorDeJornal = createMarker( 1417.9403076172, -1687.3420410156, 13.546875, "cylinder", 35, 0, 255, 0, 0)

EntregadorDeJornalPickup = createPickup ( 1412.0852050781, -1699.9636230469, 13.539485931396, 3, 1239)
MarkerEntregadorDeJornal = createMarker ( 1412.0852050781, -1699.9636230469, 13.539485931396, "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 ( 1417.9403076172, -1687.3420410156, 13.546875 )
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" ) == "Jornaleiro" then return end
			   VerificarBlipEmprego(pl)
		end
	end
end,
3000,0)

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

function ComandoHQ ( source )
    if getElementData ( source, "Emprego" ) == "Jornaleiro" 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)
  local level = getElementData(source,"Level") or 0
  if tonumber(level) > 4 then
exports.Scripts_OnMarkerMsgs_:delete(source)
unbindKey ( source, LetraParaMarkers, "down", AceitarEmprego02 )
setElementData ( source, "Emprego", "Jornaleiro" )
exports.Scripts_Dxmessages:outputDx(source, "Você Agora Trabalha de Jornaleiro, Para Mais Informações Digite ( /Profissao )", "success")
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", "Jornaleiro" )
exports.Scripts_Dxmessages:outputDx(source, "Você se Demitiu do Emprego de Jornaleiro com Sucesso!", "warning")
end

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

function ComandosProf ( ThePlayer )
if getElementData ( ThePlayer, "Emprego" ) == "Jornaleiro" then
playSoundFrontEnd ( ThePlayer, 43 )
outputChatBox ( "#DF3A01~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #EFFBEFJORNALEIRO #DF3A01~~~~~~~~~~~~~~~~~~~~~~~~~~~~", ThePlayer, 255, 255, 255, true )
outputChatBox ( "#DF3A01» #EFFBEFComandos da Profissão de Jornaleiro:", ThePlayer, 255, 255, 255, true )
outputChatBox ( "#DF3A01» #DF3A01/hq #ffffff- #EFFBEFPara Marcar ou Desmarcar a sede do seu Local de Trabalho", ThePlayer, 255, 255, 255, true )
outputChatBox ( "#DF3A01» #DF3A01/entregarjornais #ffffff- #EFFBEFAbre a Lista de Rotas Disponiveis Para Trabalhar", ThePlayer, 255, 255, 255, true )
outputChatBox ( "#DF3A01» #EFFBEFMonte na Bicicleta e Digite #DF3A01/entregarjornais", ThePlayer, 255, 255, 255, true )
outputChatBox ( "#DF3A01» #EFFBEFSelecione uma rota de entrega e Siga os checkpoints no Mapa (F11)", ThePlayer, 255, 255, 255, true )
outputChatBox ( "#DF3A01» #EFFBEFQuando concluir as entregas você receberá uma #DBA901comissão", ThePlayer, 255, 255, 255, true )
outputChatBox ( "#DF3A01~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #EFFBEFJORNALEIRO #DF3A01~~~~~~~~~~~~~~~~~~~~~~~~~~~~", 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" ) == "Jornaleiro" then
			exports.Scripts_OnMarkerMsgs_:create(source,"Aperte 'K' Para se Demitir do Emprego de Jornaleiro")
			bindKey ( source, LetraParaMarkers, "down", RecusarEmprego02 )
		else
			exports.Scripts_OnMarkerMsgs_:create(source,"Aperte 'K' Para Aceitar o Emprego de Jornaleiro")
			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(510, 1417.8991699219, -1694.3439941406, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +4, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +6, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +2, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +8, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +10, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +12, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +14, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +16, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +18, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +20, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 -2, 13.0, 0, 0, 270 ),
createVehicle(510, 1417.8991699219, -1694.3439941406 +22, 13.0, 0, 0, 270 ),

}

for i, veh in ipairs(VeiculosComDataEntregadorDeJornal) do
setElementData ( veh, "Emprego", "Jornaleiro" )
setVehicleDamageProof(veh,true)
setVehicleColor( veh, 255, 255, 255 )
setVehiclePlateText ( veh, "BRV" )
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 == "Jornaleiro" then	
	else
    cancelEvent()
    exports.Scripts_Dxmessages:outputDx(thePlayer, "Esse Veiculo é Exclusivo dos Jornaleiros!", "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 = {
	["Los Santos - Favelas - 20 Entregas - Comissão: $300"] = {
		{1429.9464111328, -1905.8059082031, 13.773780822754},
		{1375.8276367188, -1918.4099121094, 19.122716903687},
		{1270.9599609375, -1902.0228271484, 28.374183654785},
		{1309.2713623047, -1961.1942138672, 29.166717529297},
		{1405.7294921875, -2045.7346191406, 54.065727233887},
		{1301.8836669922, -2048.9123535156, 58.464176177979},
		{1244.1116943359, -2053.9213867188, 59.876438140869},
		{1279.3021240234, -2031.7036132813, 58.958137512207},
		{1133.7977294922, -2025.0975341797, 69.000610351563},
		{1134.2821044922, -2098.537109375, 71.074172973633},
		{1092.1948242188, -2125.5886230469, 67.255599975586},
		{1045.2015380859, -2186.7719726563, 40.421051025391},
		{1161.7659912109, -2165.134765625, 64.786643981934},
		{1188.5417480469, -2331.0920410156, 14.28927230835},
		{1229.0968017578, -2203.7377929688, 37.594787597656},
		{1347.48828125, -2103.5290527344, 46.227912902832},
		{1411.4415283203, -2085.2429199219, 43.614170074463},
		{1452.4599609375, -2092.7153320313, 35.114093780518},
		{1480.2470703125, -2023.3793945313, 31.805692672729},
		{1515.3037109375, -2010.2598876953, 28.44634437561},
	},
	["Los Santos - Ganton/Temple - 20 Entregas - Comissão: $200"] = {
		{2494.3081054688, -1684.810546875, 12.510766983032},
		{2512.0192871094, -1689.4036865234, 13.544955253601},
		{2511.7531738281, -1651.3133544922, 13.91447353363},
		{2409.0688476563, -1671.6916503906, 13.580268859863},
		{2362.8149414063, -1646.5299072266, 13.53059387207},
		{2389.9978027344, -1717.0043945313, 13.60608291626},
		{2504.3889160156, -1788.6654052734, 13.555590629578},
		{2609.7587890625, -1849.3317871094, 3.2896952629089},
		{2560.2180175781, -1802.0985107422, 1.640625},
		{2521.1306152344, -1917.3314208984, 13.589694976807},
		{2419.9372558594, -1914.8271484375, 13.546899795532},
		{2437.5512695313, -1790.1809082031, 13.554225921631},
		{2324.8544921875, -1796.3190917969, 13.546875},
		{2155.7231445313, -1700.7188720703, 15.0859375},
		{2141.8076171875, -1607.6066894531, 14.187998771667},
		{2072.1538085938, -1628.64453125, 13.546875},
		{2069.1791992188, -1731.5767822266, 13.87615776062},
		{1985.9375, -1718.9539794922, 15.969563484192},
		{1961.2664794922, -1562.8210449219, 13.609630584717},
		{1863.8009033203, -1599.7763671875, 13.868625640869},
	},
	["Los Santos - Richman - 20 Entregas - Comissão: $100"] = {
		{230.03106689453, -1400.8328857422, 51.590793609619},
		{260.44561767578, -1363.5102539063, 53.109375},
		{167.86294555664, -1344.1441650391, 69.553092956543},
		{290.69464111328, -1331.0395507813, 53.444843292236},
		{356.9423828125, -1275.7287597656, 53.829723358154},
		{422.85809326172, -1262.6413574219, 51.580940246582},
		{633.45733642578, -1119.3950195313, 45.719078063965},
		{696.92242431641, -1058.3994140625, 49.402328491211},
		{724.82531738281, -994.73333740234, 52.623596191406},
		{790.10278320313, -844.86358642578, 60.641288757324},
		{832.16638183594, -858.89892578125, 69.921875},
		{837.51416015625, -891.27130126953, 68.768898010254},
		{930.03179931641, -852.59350585938, 93.500045776367},
		{977.28454589844, -826.35040283203, 96.275825500488},
		{1029.8919677734, -807.95526123047, 101.8515625},
		{1092.6324462891, -798.84069824219, 107.41916656494},
		{1107.7619628906, -731.60491943359, 100.61921691895},
		{1242.3199462891, -745.32543945313, 94.904930114746},
		{1356.48828125, -616.41851806641, 109.1328125},
		{1496.6713867188, -697.98297119141, 94.75},
	},
}

pay = {
	["Los Santos - Favelas - 20 Entregas - Comissão: $300"] = 300,
	["Los Santos - Ganton/Temple - 20 Entregas - Comissão: $200"] = 200,
	["Los Santos - Richman - 20 Entregas - Comissão: $100"] = 100,
}

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 Sua Comissão 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" ) == "Jornaleiro" 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 == "Jornaleiro" 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 == 510 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("entregarjornais",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 Bike, 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 ~= "Jornaleiro" 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)

 

 

(Linha 59-60)

Edited by ~#BlackSCR
  • Like 1
Link to comment
1 hour ago, ~#BlackSCR said:

Possivelmente:

 


MarkerSafeEntregadorDeJornal = createMarker( 1417.9403076172, -1687.3420410156, 13.546875, "cylinder", 35, 0, 255, 0, 0)EntregadorDeJornalPickup = createPickup ( 1412.0852050781, -1699.9636230469, 13.539485931396, 3, 1239)MarkerEntregadorDeJornal = createMarker ( 1412.0852050781, -1699.9636230469, 13.539485931396, "cylinder", 1.2, 255, 255, 255, 0 )attachElements ( MarkerEntregadorDeJornal, EntregadorDeJornalPickup, 0, 0, -1 )BlipEntregadorDeJornal = createBlipAttachedTo ( MarkerEntregadorDeJornal, 42 )setBlipVisibleDistance ( BlipEntregadorDeJornal, 150 )function CancelarSumirPickup ( player )   cancelEvent()endaddEventHandler ( "onPickupHit", EntregadorDeJornalPickup, CancelarSumirPickup )LetraParaMarkers = "k"cmd1 = "hq"cmd2 = "profissao"local HQEntregadorDeJornalBlip = createBlip ( 1417.9403076172, -1687.3420410156, 13.546875 )setElementVisibleTo ( HQEntregadorDeJornalBlip, root, false )--------------------------------------------------------------------function VerificarBlipEmprego(player)  if player then  acc = getPlayerAccount ( player )  if isGuestAccount ( acc ) then return end  setElementVisibleTo ( HQEntregadorDeJornalBlip, player, false )  endendsetTimer(function()	for i, pl in pairs(getElementsByType("player")) do		if pl ~= (false or nil) then		    if getElementData ( pl, "Emprego" ) == "Jornaleiro" then return end			   VerificarBlipEmprego(pl)		end	endend,3000,0)--------------------------------------------------------------------function ComandoHQ ( source )    if getElementData ( source, "Emprego" ) == "Jornaleiro" 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")endend	end    addCommandHandler ( cmd1, ComandoHQ )--------------------------------------------------------------------function AceitarEmprego02 (source)  local level = getElementData(source,"Level") or 0  if tonumber(level) > 4 thenexports.Scripts_OnMarkerMsgs_:delete(source)unbindKey ( source, LetraParaMarkers, "down", AceitarEmprego02 )setElementData ( source, "Emprego", "Jornaleiro" )exports.Scripts_Dxmessages:outputDx(source, "Você Agora Trabalha de Jornaleiro, Para Mais Informações Digite ( /Profissao )", "success")end  endfunction RecusarEmprego02 (source)exports.Scripts_OnMarkerMsgs_:delete(source)unbindKey ( source, LetraParaMarkers, "down", RecusarEmprego02 )if isElementVisibleTo ( HQEntregadorDeJornalBlip, source ) thensetElementVisibleTo ( HQEntregadorDeJornalBlip, source, false )endremoveElementData ( source, "Emprego", "Jornaleiro" )exports.Scripts_Dxmessages:outputDx(source, "Você se Demitiu do Emprego de Jornaleiro com Sucesso!", "warning")end--------------------------------------------------------------------function ComandosProf ( ThePlayer )if getElementData ( ThePlayer, "Emprego" ) == "Jornaleiro" thenplaySoundFrontEnd ( ThePlayer, 43 )outputChatBox ( "#DF3A01~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #EFFBEFJORNALEIRO #DF3A01~~~~~~~~~~~~~~~~~~~~~~~~~~~~", ThePlayer, 255, 255, 255, true )outputChatBox ( "#DF3A01» #EFFBEFComandos da Profissão de Jornaleiro:", ThePlayer, 255, 255, 255, true )outputChatBox ( "#DF3A01» #DF3A01/hq #ffffff- #EFFBEFPara Marcar ou Desmarcar a sede do seu Local de Trabalho", ThePlayer, 255, 255, 255, true )outputChatBox ( "#DF3A01» #DF3A01/entregarjornais #ffffff- #EFFBEFAbre a Lista de Rotas Disponiveis Para Trabalhar", ThePlayer, 255, 255, 255, true )outputChatBox ( "#DF3A01» #EFFBEFMonte na Bicicleta e Digite #DF3A01/entregarjornais", ThePlayer, 255, 255, 255, true )outputChatBox ( "#DF3A01» #EFFBEFSelecione uma rota de entrega e Siga os checkpoints no Mapa (F11)", ThePlayer, 255, 255, 255, true )outputChatBox ( "#DF3A01» #EFFBEFQuando concluir as entregas você receberá uma #DBA901comissão", ThePlayer, 255, 255, 255, true )outputChatBox ( "#DF3A01~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #EFFBEFJORNALEIRO #DF3A01~~~~~~~~~~~~~~~~~~~~~~~~~~~~", ThePlayer, 255, 255, 255, true )endendaddCommandHandler(cmd2, ComandosProf )--------------------------------------------------------------------function emarker(marker,md) 	if (md) then	  if isPedInVehicle ( source ) then return end		if marker == MarkerEntregadorDeJornal then		    if getElementData ( source, "Emprego" ) == "Jornaleiro" then			exports.Scripts_OnMarkerMsgs_:create(source,"Aperte 'K' Para se Demitir do Emprego de Jornaleiro")			bindKey ( source, LetraParaMarkers, "down", RecusarEmprego02 )		else			exports.Scripts_OnMarkerMsgs_:create(source,"Aperte 'K' Para Aceitar o Emprego de Jornaleiro")			bindKey ( source, LetraParaMarkers, "down", AceitarEmprego02 )		end	 end  end	endaddEventHandler("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	endendaddEventHandler("onPlayerMarkerLeave",getRootElement(),lmarker)function CriarVeiculosComData ()VeiculosComDataEntregadorDeJornal = {createVehicle(510, 1417.8991699219, -1694.3439941406, 13.0, 0, 0, 270 ),createVehicle(510, 1417.8991699219, -1694.3439941406 +4, 13.0, 0, 0, 270 ),createVehicle(510, 1417.8991699219, -1694.3439941406 +6, 13.0, 0, 0, 270 ),createVehicle(510, 1417.8991699219, -1694.3439941406 +2, 13.0, 0, 0, 270 ),createVehicle(510, 1417.8991699219, -1694.3439941406 +8, 13.0, 0, 0, 270 ),createVehicle(510, 1417.8991699219, -1694.3439941406 +10, 13.0, 0, 0, 270 ),createVehicle(510, 1417.8991699219, -1694.3439941406 +12, 13.0, 0, 0, 270 ),createVehicle(510, 1417.8991699219, -1694.3439941406 +14, 13.0, 0, 0, 270 ),createVehicle(510, 1417.8991699219, -1694.3439941406 +16, 13.0, 0, 0, 270 ),createVehicle(510, 1417.8991699219, -1694.3439941406 +18, 13.0, 0, 0, 270 ),createVehicle(510, 1417.8991699219, -1694.3439941406 +20, 13.0, 0, 0, 270 ),createVehicle(510, 1417.8991699219, -1694.3439941406 -2, 13.0, 0, 0, 270 ),createVehicle(510, 1417.8991699219, -1694.3439941406 +22, 13.0, 0, 0, 270 ),}for i, veh in ipairs(VeiculosComDataEntregadorDeJornal) dosetElementData ( veh, "Emprego", "Jornaleiro" )setVehicleDamageProof(veh,true)setVehicleColor( veh, 255, 255, 255 )setVehiclePlateText ( veh, "BRV" )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)endendaddEventHandler("onResourceStart", resourceRoot, CriarVeiculosComData )function VerificarEmprego (thePlayer, seat)local Jogador = getElementData(thePlayer, "Emprego" )if seat == 0 then    if Jogador == "Jornaleiro" then		else    cancelEvent()    exports.Scripts_Dxmessages:outputDx(thePlayer, "Esse Veiculo é Exclusivo dos Jornaleiros!", "error")    end  endend--[[function SairDoVeiculosComData ()local veh = sourcesetTimer(function()  if getVehicleOccupant(veh) == false thenrespawnVehicle(veh)endend, 30000, 1)endaddEventHandler ( "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     endsetTimer(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 = {	["Los Santos - Favelas - 20 Entregas - Comissão: $300"] = {		{1429.9464111328, -1905.8059082031, 13.773780822754},		{1375.8276367188, -1918.4099121094, 19.122716903687},		{1270.9599609375, -1902.0228271484, 28.374183654785},		{1309.2713623047, -1961.1942138672, 29.166717529297},		{1405.7294921875, -2045.7346191406, 54.065727233887},		{1301.8836669922, -2048.9123535156, 58.464176177979},		{1244.1116943359, -2053.9213867188, 59.876438140869},		{1279.3021240234, -2031.7036132813, 58.958137512207},		{1133.7977294922, -2025.0975341797, 69.000610351563},		{1134.2821044922, -2098.537109375, 71.074172973633},		{1092.1948242188, -2125.5886230469, 67.255599975586},		{1045.2015380859, -2186.7719726563, 40.421051025391},		{1161.7659912109, -2165.134765625, 64.786643981934},		{1188.5417480469, -2331.0920410156, 14.28927230835},		{1229.0968017578, -2203.7377929688, 37.594787597656},		{1347.48828125, -2103.5290527344, 46.227912902832},		{1411.4415283203, -2085.2429199219, 43.614170074463},		{1452.4599609375, -2092.7153320313, 35.114093780518},		{1480.2470703125, -2023.3793945313, 31.805692672729},		{1515.3037109375, -2010.2598876953, 28.44634437561},	},	["Los Santos - Ganton/Temple - 20 Entregas - Comissão: $200"] = {		{2494.3081054688, -1684.810546875, 12.510766983032},		{2512.0192871094, -1689.4036865234, 13.544955253601},		{2511.7531738281, -1651.3133544922, 13.91447353363},		{2409.0688476563, -1671.6916503906, 13.580268859863},		{2362.8149414063, -1646.5299072266, 13.53059387207},		{2389.9978027344, -1717.0043945313, 13.60608291626},		{2504.3889160156, -1788.6654052734, 13.555590629578},		{2609.7587890625, -1849.3317871094, 3.2896952629089},		{2560.2180175781, -1802.0985107422, 1.640625},		{2521.1306152344, -1917.3314208984, 13.589694976807},		{2419.9372558594, -1914.8271484375, 13.546899795532},		{2437.5512695313, -1790.1809082031, 13.554225921631},		{2324.8544921875, -1796.3190917969, 13.546875},		{2155.7231445313, -1700.7188720703, 15.0859375},		{2141.8076171875, -1607.6066894531, 14.187998771667},		{2072.1538085938, -1628.64453125, 13.546875},		{2069.1791992188, -1731.5767822266, 13.87615776062},		{1985.9375, -1718.9539794922, 15.969563484192},		{1961.2664794922, -1562.8210449219, 13.609630584717},		{1863.8009033203, -1599.7763671875, 13.868625640869},	},	["Los Santos - Richman - 20 Entregas - Comissão: $100"] = {		{230.03106689453, -1400.8328857422, 51.590793609619},		{260.44561767578, -1363.5102539063, 53.109375},		{167.86294555664, -1344.1441650391, 69.553092956543},		{290.69464111328, -1331.0395507813, 53.444843292236},		{356.9423828125, -1275.7287597656, 53.829723358154},		{422.85809326172, -1262.6413574219, 51.580940246582},		{633.45733642578, -1119.3950195313, 45.719078063965},		{696.92242431641, -1058.3994140625, 49.402328491211},		{724.82531738281, -994.73333740234, 52.623596191406},		{790.10278320313, -844.86358642578, 60.641288757324},		{832.16638183594, -858.89892578125, 69.921875},		{837.51416015625, -891.27130126953, 68.768898010254},		{930.03179931641, -852.59350585938, 93.500045776367},		{977.28454589844, -826.35040283203, 96.275825500488},		{1029.8919677734, -807.95526123047, 101.8515625},		{1092.6324462891, -798.84069824219, 107.41916656494},		{1107.7619628906, -731.60491943359, 100.61921691895},		{1242.3199462891, -745.32543945313, 94.904930114746},		{1356.48828125, -616.41851806641, 109.1328125},		{1496.6713867188, -697.98297119141, 94.75},	},}pay = {	["Los Santos - Favelas - 20 Entregas - Comissão: $300"] = 300,	["Los Santos - Ganton/Temple - 20 Entregas - Comissão: $200"] = 200,	["Los Santos - Richman - 20 Entregas - Comissão: $100"] = 100,}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 Sua Comissão 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	endendaddEventHandler("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		endsetTimer(function()	for i, pl in pairs(getElementsByType("player")) do		if pl ~= (false or nil) then		    if getElementData ( pl, "Emprego" ) == "Jornaleiro" then			   VerificarCairBike(pl)			end		end	endend,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 == "Jornaleiro" 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 == 510 then					if seat == 0 then				if isMarkerSafe == false then return end				triggerClientEvent(source,"AirNew>JOBEntregadorDeJornal>AbrirPainel<Client",source,rotasJORNAL)			end		end	endendendaddCommandHandler("entregarjornais",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)endaddEvent("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	endendfunction sair ( quitType )	if isElement(ppcikJORNAL[source]) then		destroyElement(ppcikJORNAL[source])	endendaddEventHandler ( "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 Bike, Entregas Canceladas!", "warning")endaddEventHandler ( "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)	endfunction canceljobdeath()	local job = getElementData(source,"Emprego") or false	if job ~= "Jornaleiro" 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)

 

 

(Linha 59-60)

Perfeito! Funcionou ❤️❤️ 

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