Jump to content

Search the Community

Showing results for tags 'petrolero'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

Found 1 result

  1. Necesito ayuda con este script de trabajo para Petrolero. El trabajo consiste en que después de aceptar el trabajo en la agencia y en el punto de lugar. Agarrar un Camión, ingresar a una plataforma, seleccionar el destino o ruta, luego de eso se te añade el tráiler atrás del camión y llevarlo a una gasolinera dejar la carga y que te pague al dejarla. Hasta ahí todo bien y funciona, excepto el pago. cuando dejas la carga no da el dinero, tampoco sale la alerta de haberla entregado. Lo compare con la mayoría de los scripts de trabajos que si pagan y no logro encontrar el fallo. ¿Alguien me podría decir que es lo que esta mal? dejo el client y server, el meta y mapeo que tienen estan bien y funcionando. los paneles para elegir rutas tambien. Solo el final del recorrido es lo que no da el pago.... NOTA: el script original esta en portugues, yo voy traduciendo al español solo los dxDrawText, outputChatBox y los comandos por escrito, este es el client ↓↓↓↓↓↓ 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, "Cerrar", false, myWindow) escolher = guiCreateButton(x*42, y*334, x*168, y*35, "Cargar", false, myWindow) end addEvent("JOBUS>AbrirPainel<Client", true) addEventHandler("JOBUS>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 exports.Script_Textos:createNewDxMessage('Seleccione una ruta para cargar su camión!', 255, 255, 255) return end triggerServerEvent("request>Startrota>Server",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 ) end else if isElement(blips) then destroyElement(blips) end end end addEvent("JOBUS>blips<Client", true) addEventHandler("JOBUS>blips<Client", localPlayer, blips) -------------------------------------------------------------------- local g_screenX, g_screenY = guiGetScreenSize(); local gScale = 0.3; local gAlphaDistance = 25; local gMaxDistance = 50; local gTextAlpha = 120; local gTextSize = 0.7; local gAlphaDiff = gMaxDistance - gAlphaDistance; gScale = 1 / gScale * 800 / g_screenY; local gMaxScaleCurve = { { 0, 0 }, { 3, 3 }, { 13, 5 } }; local gTextScaleCurve = { { 0, 0.8 }, { 0.8, 1.2 }, { 99, 99 } }; local gTextAlphaCurve = { { 0, 0 }, { 25, 100 }, { 120, 190 }, { 255, 190 } }; local x = 269.73334 local y = 1415.76489 local z = 10 addEventHandler("onClientRender",getRootElement(), function() local px,py,pz = getElementPosition(getLocalPlayer()) local distance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) if distance <= 50 then local sx,sy = getScreenFromWorldPosition ( x, y, z+0.95, 0.06 ) if not sx then return end local scale = 1 / ( gScale * ( distance / gMaxDistance ) ); local alpha = ( ( distance - gAlphaDistance ) / gAlphaDiff ); alpha = ( alpha < 0 ) and gTextAlpha or gTextAlpha - ( alpha * gTextAlpha ); scale = math.evalCurve( gMaxScaleCurve, scale ); local textscale = math.evalCurve( gTextScaleCurve, scale ); local textalpha = math.evalCurve( gTextAlphaCurve, alpha ); dxDrawText ( ">>Entrada del Area de Cargamento>>", sx, sy - 30, sx, sy - 30, tocolor ( 0, 0, 0, textalpha ), textscale * gTextSize, "arial", "center", "bottom", false, false, false, true ); dxDrawText ( ">>Entrada del Area de Cargamento>>", sx -2, sy - 30 -2, sx -1, sy - 30 -2, tocolor ( 255, 0, 0, textalpha ), textscale * gTextSize, "arial", "center", "bottom", false, false, false, true ); end end ) local x = 269.34631 local y = 1393.52222 local z = 10 addEventHandler("onClientRender",getRootElement(), function() local px,py,pz = getElementPosition(getLocalPlayer()) local distance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) if distance <= 50 then local sx,sy = getScreenFromWorldPosition ( x, y, z+0.95, 0.06 ) if not sx then return end local scale = 1 / ( gScale * ( distance / gMaxDistance ) ); local alpha = ( ( distance - gAlphaDistance ) / gAlphaDiff ); alpha = ( alpha < 0 ) and gTextAlpha or gTextAlpha - ( alpha * gTextAlpha ); scale = math.evalCurve( gMaxScaleCurve, scale ); local textscale = math.evalCurve( gTextScaleCurve, scale ); local textalpha = math.evalCurve( gTextAlphaCurve, alpha ); dxDrawText ( "<<Salida del Area de Cargamento<<", sx, sy - 30, sx, sy - 30, tocolor ( 0, 0, 0, textalpha ), textscale * gTextSize, "arial", "center", "bottom", false, false, false, true ); dxDrawText ( "<<Salida del Area de Cargamento<<", sx -2, sy - 30 -2, sx -1, sy - 30 -2, tocolor ( 255, 0, 0, textalpha ), textscale * gTextSize, "arial", "center", "bottom", false, false, false, true ); end end ) local x = 192.2998046875 local y = 1400.599609375 local z = 10 addEventHandler("onClientRender",getRootElement(), function() local px,py,pz = getElementPosition(getLocalPlayer()) local distance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) if distance <= 50 then local sx,sy = getScreenFromWorldPosition ( x, y, z+0.95, 0.06 ) if not sx then return end local scale = 1 / ( gScale * ( distance / gMaxDistance ) ); local alpha = ( ( distance - gAlphaDistance ) / gAlphaDiff ); alpha = ( alpha < 0 ) and gTextAlpha or gTextAlpha - ( alpha * gTextAlpha ); scale = math.evalCurve( gMaxScaleCurve, scale ); local textscale = math.evalCurve( gTextScaleCurve, scale ); local textalpha = math.evalCurve( gTextAlphaCurve, alpha ); dxDrawText ( "Area del Cargamento", sx, sy - 30, sx, sy - 30, tocolor ( 0, 0, 0, textalpha ), textscale * gTextSize, "arial", "center", "bottom", false, false, false, true ); dxDrawText ( "Area del Cargamento", sx -2, sy - 30 -2, sx -1, sy - 30 -2, tocolor ( 8, 114, 246, textalpha ), textscale * gTextSize, "arial", "center", "bottom", false, false, false, true ); end end ) function math.evalCurve( curve, input ) if input < curve[ 1 ][ 1 ] then return curve[ 1 ][ 2 ]; end for idx = 2, #curve do if input < curve[ idx ][ 1 ] then local x1 = curve[ idx - 1 ][ 1 ]; local y1 = curve[ idx - 1 ][ 2 ]; local x2 = curve[ idx ][ 1 ]; local y2 = curve[ idx ][ 2 ]; local alpha = ( input - x1 ) / ( x2 - x1 ); return math.lerp( y1, y2, alpha ); end end return curve[ #curve ][ 2 ]; end function math.lerp( from, to, alpha ) return from + ( to-from ) * alpha; end -------------------------------------------------------------------- y este es el server ↓↓↓↓↓ PetroleiroPickup = createPickup ( 283.75128, 1432.13159, 10.79398, 3, 1210) MarkerPetroleiro = createMarker ( 283.75128, 1432.13159, 10.79398, "cylinder", 1.2, 255, 255, 255, 0 ) attachElements ( MarkerPetroleiro, PetroleiroPickup, 0, 0, -1 ) BlipPetroleiro = createBlipAttachedTo ( MarkerPetroleiro, 42 ) setBlipVisibleDistance ( BlipPetroleiro, 150 ) safe = createMarker ( 192.2998046875, 1400.599609375, 9, "cylinder", 11, 0, 255, 0, 0) function CancelarSumirPickup ( player ) cancelEvent() end addEventHandler ( "onPickupHit", PetroleiroPickup, CancelarSumirPickup ) -------------------------------------------------------------------- LetraParaMarkers = "k" cmd1 = "hq" cmd2 = "profesion" -------------------------------------------------------------------- local HQPetroleiroBlip = createBlip ( 270.59879, 1409.27441, 10.46635 ) setElementVisibleTo ( HQPetroleiroBlip, root, false ) -------------------------------------------------------------------- function VerificarBlipEmprego(player) if player then acc = getPlayerAccount ( player ) if isGuestAccount ( acc ) then return end setElementVisibleTo ( HQPetroleiroBlip, player, false ) end end setTimer( function() for i, pl in pairs(getElementsByType("player")) do if pl ~= (false or nil) then if getElementData ( pl, "Emprego" ) == "Petroleiro" then return end VerificarBlipEmprego(pl) end end end, 3000,0) -------------------------------------------------------------------- function ComandoHQ ( source ) if getElementData ( source, "Emprego" ) == "Petroleiro" then if isElementVisibleTo ( HQPetroleiroBlip, source ) then setElementVisibleTo ( HQPetroleiroBlip, source, false ) exports.Scripts_Dxmessages:outputDx(source, "Su lugar de trabajo ha sido deseleccionado del mapa!", "info") else setElementVisibleTo ( HQPetroleiroBlip, source, true ) exports.Scripts_Dxmessages:outputDx(source, "Su lugar de trabajo ha sido marcado en el 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" ) == "Petroleiro" then setElementData ( source, "AirNew>Encaminhamento", false ) setElementData ( source, "Emprego", "Petroleiro" ) exports.Scripts_Dxmessages:outputDx(source, "Ahora trabaja como trabajador petrolero, para obtener más información escriba (/profesión )", "success") else exports.Scripts_Dxmessages:outputDx(source, "Debe ser derivado de la Agencia de Empleo para trabajar en este lugar!", "error") end end function RecusarEmprego02 (source) exports.Scripts_OnMarkerMsgs_:delete(source) unbindKey ( source, LetraParaMarkers, "down", RecusarEmprego02 ) if isElementVisibleTo ( HQPetroleiroBlip, source ) then setElementVisibleTo ( HQPetroleiroBlip, source, false ) end removeElementData ( source, "Emprego", "Petroleiro" ) exports.Scripts_Dxmessages:outputDx(source, "Usted renunció exitosamente al trabajo de petrolero!", "warning") end -------------------------------------------------------------------- function ComandosProf ( ThePlayer ) if getElementData ( ThePlayer, "Emprego" ) == "Petroleiro" then playSoundFrontEnd ( ThePlayer, 43 ) outputChatBox ( "#F9A631~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #F96031Profesion #F9A631~~~~~~~~~~~~~~~~~~~~~~~~~~~~", ThePlayer, 255, 255, 255, true ) outputChatBox ( "#F96031» #BEE09AComandos de la profesión de petrolero", ThePlayer, 255, 255, 255, true ) outputChatBox ( "#F96031» #55D444/HQ #ffffff- #9ABDE0Para marcar / desmarcar su lugar de trabajo", ThePlayer, 255, 255, 255, true ) outputChatBox ( "#F96031» #FFD700Sube al camión y conduce hasta el área de carga.", ThePlayer, 255, 255, 255, true ) outputChatBox ( "#F96031» #FFD700DEBES IR POR LA ENTRADA DE LA DERECHA, POSICIONAR EN LA PLATAFORMA AMARILLA DEL MEDIO.", ThePlayer, 255, 255, 255, true ) outputChatBox ( "#F96031» #FFD700En el área de carga presione la letra 'K' para seleccionar la carga", ThePlayer, 255, 255, 255, true ) outputChatBox ( "#F96031» #FFD700Y SALIR POR EL OTRO LADO PARA INICIAR EL VIAJE.", ThePlayer, 255, 255, 255, true ) outputChatBox ( "#F9A631~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #F96031Profesion #F9A631~~~~~~~~~~~~~~~~~~~~~~~~~~~~", ThePlayer, 255, 255, 255, true ) end end addCommandHandler(cmd2, ComandosProf ) -------------------------------------------------------------------- function emarker(marker,md) if (md) then if not isPedInVehicle ( source ) then if marker == MarkerPetroleiro then if getElementData ( source, "Emprego" ) == "Petroleiro" then exports.Scripts_OnMarkerMsgs_:create(source,"Presione 'K' para renunciar al trabajo de petrolero") bindKey ( source, LetraParaMarkers, "down", RecusarEmprego02 ) else exports.Scripts_OnMarkerMsgs_:create(source,"Presione 'K' para aceptar el trabajo de aceite") bindKey ( source, LetraParaMarkers, "down", AceitarEmprego02 ) end end end local seat = getPedOccupiedVehicleSeat ( source ) if seat == 0 then if marker == safe then bindKey ( source, LetraParaMarkers, "down", pickjobonbus ) exports.Scripts_OnMarkerMsgs_:create(source,"Presione 'K' para cargar su camión") end if marker == ppcik[source] then bindKey ( source, LetraParaMarkers, "down", ifPlayerEnterOnMarker ) exports.Scripts_OnMarkerMsgs_:create(source,"Presione 'K' para descargar su camión") end end end end addEventHandler("onPlayerMarkerHit",getRootElement(),emarker) function lmarker(marker,md) if (md) then if marker == MarkerPetroleiro then exports.Scripts_OnMarkerMsgs_:delete(source) unbindKey ( source, LetraParaMarkers, "down", AceitarEmprego02 ) unbindKey ( source, LetraParaMarkers, "down", RecusarEmprego02 ) end if marker == safe then unbindKey ( source, LetraParaMarkers, "down", pickjobonbus ) exports.Scripts_OnMarkerMsgs_:delete(source) end if marker == ppcik[source] then unbindKey ( source, LetraParaMarkers, "down", ifPlayerEnterOnMarker ) exports.Scripts_OnMarkerMsgs_:delete(source) end end end addEventHandler("onPlayerMarkerLeave",getRootElement(),lmarker) -------------------------------------------------------------------- atualrotnumber = {} ppcik = {} blips = {} -------------------------------------------------------------------- rotas = { ["Puesto de Fort Carson - $7000"] = { {70.36392, 1218.65625, 18.81190}, }, ["Puesto de Bone County - $9000"] = { {612.14429, 1695.00281, 6.99219}, }, ["Puesto de Tierra Robada - $14000"] = { {-1477.12805, 1863.58386, 32.63281}, }, ["Puesto de Tierra Robada II - $14500"] = { {-1328.97241, 2672.06689, 50.06250}, }, ["Puesto de Redsands West - $13500"] = { {1595.82605, 2198.85205, 10.82031}, }, ["Puesto de Spinybed - $29000"] = { {2147.65674, 2747.65161, 10.82031}, }, ["Puesto de The Emerald Isle - $16000"] = { {2202.37598, 2474.13965, 10.82031}, }, ["Puesto de Las Venturas - $14000"] = { {2639.75928, 1106.16931, 10.82031}, }, ["Puesto de Las Venturas II - $13000"] = { {2115.28882, 920.22015, 10.82031}, }, ["Puesto de Montgomery - $16000"] = { {1382.29285, 460.14056, 20.34520}, }, ["Puesto de Dillimore - $17500"] = { {654.96869, -559.74841, 16.50149}, }, ["Puesto de Temple - $28500"] = { {1004.65613, -936.75317, 42.32813}, }, ["Puesto de Idlewood - $32000"] = { {1942.37158, -1772.88501, 13.64063}, }, ["Puesto de Flint County - $39500"] = { {-93.53500, -1174.47327, 2.28485}, }, ["Puesto de Whetstone - $59000"] = { {-1605.74585, -2714.55273, 48.53347}, }, ["Puesto de Angel Pine - $53050"] = { {-2244.26880, -2561.07104, 31.92188}, }, ["Puesto de Juniper Hallow - $45000"] = { {-2410.03662, 976.18658, 45.42539}, }, ["Puesto de Easter Basin - $39200"] = { {-1675.65918, 413.23929, 7.17969}, }, } -------------------------------------------------------------------- pay={ ["Puesto de Fort Carson - $700"] = 7000, ["Puesto de Bone County - $900"] = 9000, ["Puesto de Tierra Robada - $1400"] = 14000, ["Puesto de Tierra Robada II - $1450"] = 14500, ["Puesto de Redsands West - $1350"] = 13500, ["Puesto de Spinybed - $2900"] = 29000, ["Puesto de The Emerald Isle - $1600"] = 16000, ["Puesto de Las Venturas - $1400"] = 14000, ["Puesto de Las Venturas II - $1300"] = 13000, ["Puesto de Montgomery - $1600"] = 16000, ["Puesto de Dillimore - $1750"] = 17500, ["Puesto de Temple - $2850"] = 28500, ["Puesto de Idlewood - $3200"] = 32000, ["Puesto de Flint County - $3950"] = 39500, ["Puesto de Whetstone - $5900"] = 54000, ["Puesto de Angel Pine - $5350"] = 53500, ["Puesto de Juniper Hallow - $4500"] = 45000, ["Puesto de Easter Basin - $3920"] = 39200, } -------------------------------------------------------------------- function receivert(source,rotaname) if isElement(ppcik[source]) then destroyElement(ppcik[source]) end triggerClientEvent(source,"JOBUS>blips<Client",source,false) setElementData(source,"rtname",rotaname) atualrotnumber[source] = 1 gerarrota(source) end addEvent("request>Startrota>Server", true) addEventHandler("request>Startrota>Server",getRootElement(), receivert) -------------------------------------------------------------------- function ifPlayerEnterOnMarker ( source ) if isPedInVehicle(source) then if not isElementWithinMarker(source, ppcik[source]) then return end if isElement(ppcik[source]) then local vh = getPedOccupiedVehicle(source) local id = getElementModel(vh) if id == 514 then if ( getVehicleTowedByVehicle ( vh ) == CargaPet[source] ) then local rname = getElementData(source,"rtname") or nil if rname == nil then return end destroyElement(ppcik[source]) triggerClientEvent(source,"JOBUS>blips<Client",source,false) if atualrotnumber[source] <= #rotas[rname] then gerarrota(source) elseif atualrotnumber[source] == #rotas[rname]+1 then setElementData(source,"rtname",rname) atualrotnumber[source] = 1 local rec = pay[rname] givePlayerMoney(source,tonumber(rec)) local vh = getPedOccupiedVehicle(source) destroyElement ( CargaPet[source] ) setElementData(source,"rtname",nil) exports.Scripts_Dxmessages:outputDx(source, "Su carga se descargó y recibió $"..rec.." Por su servicio!", "success") unbindKey ( source, LetraParaMarkers, "down", ifPlayerEnterOnMarker ) exports.Scripts_OnMarkerMsgs_:delete(source) end else exports.Scripts_Dxmessages:outputDx(source, "No puede descargar su camión sin su carga!", "error") end end end end end -------------------------------------------------------------------- function pickjobonbus(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 == false or job == nil then exports.Scripts_Dxmessages:outputDx(source, "No es un petrolero, por lo que no puede usar este comando!", "error") return end if job == "Petroleiro" 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 issafe = isElementWithinMarker(vh,safe) local id = getElementModel(vh) local seat = getPedOccupiedVehicleSeat(source) if dist > 0 then return end if id == 514 then if seat == 0 then local speedX, speedY, speedZ = getElementVelocity ( vh ) local actualSpeed = (speedX^2 + speedY^2 + speedZ^2)^(0.5) local KMH = math.floor(actualSpeed*180) if KMH >= 1 then exports.Scripts_Dxmessages:outputDx(source, "Detener el camión para cargar!", "warning") return end if issafe == false then return end unbindKey ( source, LetraParaMarkers, "down", pickjobonbus ) exports.Scripts_OnMarkerMsgs_:delete(source) triggerClientEvent(source,"JOBUS>AbrirPainel<Client",source,rotas) end end end end end -------------------------------------------------------------------- --[[function setPlayerBlipColor( thePlayer , r, g, b ,a) if not a then a = 255 end local blips = getElementsByType( "blip" ) for k, theBlip in ipairs( blips ) do if getElementAttachedTo( theBlip ) == thePlayer then setBlipColor ( theBlip, r, g, b ,a ) end end end --]] CargaPet = {} function gerarrota(source) local rname = getElementData(source,"rtname") or nil if rname == nil then return end if not isElement(ppcik[source]) and isPedInVehicle(source) then local vh = getPedOccupiedVehicle(source) local id = tonumber(atualrotnumber[source]) local x,y,z = rotas[rname][id][1],rotas[rname][id][2],rotas[rname][id][3] ppcik[source] = createMarker (x, y,z, "checkpoint", 5, 255, 0, 0, 50,source) triggerClientEvent(source,"JOBUS>blips<Client",source,true,x,y,z) atualrotnumber[source] = id+1 local vh = getPedOccupiedVehicle(source) local xe,ye,ze = getElementPosition ( source ) if CargaPet[source] and isElement( CargaPet[source] ) then destroyElement ( CargaPet[source] ) CargaPet[source] = nil end CargaPet[source] = createVehicle ( 584, xe,ye,ze +15 ) setTimer ( attachTrailerToVehicle, 50, 1, vh, CargaPet[source] ) setTimer ( attachTrailerToVehicle, 1000, 1, vh, CargaPet[source] ) setTimer ( attachTrailerToVehicle, 5000, 1, vh, CargaPet[source] ) exports.Scripts_Dxmessages:outputDx(source, "Su camion fue cargado, siga el ícono marcado en el mapa para descargar su carga!", "info") end end -------------------------------------------------------------------- function sair ( quitType ) if isElement(ppcik[source]) then destroyElement(ppcik[source]) end end addEventHandler ( "onPlayerQuit", getRootElement(), sair ) -------------------------------------------------------------------- function removeHelmetOnExit ( thePlayer, seat, jacked ) local job = getElementData(thePlayer,"Emprego") or false if job ~= "Petroleiro" then return end local rname = getElementData(thePlayer,"rtname") or nil if rname == nil then return end if ( getElementModel ( source ) == 514 ) then canceljobtimer (thePlayer) end end addEventHandler ( "onVehicleExit", getRootElement(), removeHelmetOnExit ) -------------------------------------------------------------------- function SairDoCaminhao ( thePlayer, seat, jacked ) local rname = getElementData(thePlayer,"rtname") or nil if rname == nil then return end canceljobtimer (thePlayer) exports.Scripts_Dxmessages:outputDx(thePlayer, "Te bajaste del camión y tu carga fue destruida!", "warning") end addEventHandler ( "onVehicleExit", getRootElement(), SairDoCaminhao ) -------------------------------------------------------------------- function canceljobtimer(source) if isElement(ppcik[source]) then destroyElement(ppcik[source]) end triggerClientEvent(source,"JOBUS>blips<Client",source,false) atualrotnumber[source] = 1 setElementData(source,"rtname",nil) if isElement( CargaPet[source] ) then destroyElement ( CargaPet[source] ) end end -------------------------------------------------------------------- function canceljobdeath() local job = getElementData(source,"Emprego") or false if job ~= "Petroleiro" then return end local rname = getElementData(source,"rtname") or nil if rname == nil then return end canceljobtimer(source) DestruirPetroleiroVeiculo(source) exports.Scripts_Dxmessages:outputDx(source, "Moriste y tu carga fue destruida!", "warning") end addEventHandler( "onPlayerWasted", getRootElement( ),canceljobdeath) -------------------------------------------------------------------- function CriarVeiculosComData () VeiculosComDataPetroleiro = { createVehicle(514, 282.71198, 1389.41418, 12.35385, 0, 0, 90 ), createVehicle(514, 282.71198, 1384.41418, 12.35385, 0, 0, 90 ), createVehicle(514, 282.71198, 1379.41418, 12.35385, 0, 0, 90 ), createVehicle(514, 282.71198, 1374.41418, 12.35385, 0, 0, 90 ), createVehicle(514, 282.71198, 1369.41418, 12.35385, 0, 0, 90 ), createVehicle(514, 282.71198, 1364.41418, 12.35385, 0, 0, 90 ), createVehicle(514, 282.71198, 1359.41418, 12.35385, 0, 0, 90 ), createVehicle(514, 282.71198, 1354.41418, 12.35385, 0, 0, 90 ), createVehicle(514, 282.71198, 1349.41418, 12.35385, 0, 0, 90 ), createVehicle(514, 282.71198, 1344.41418, 12.35385, 0, 0, 90 ), createVehicle(514, 282.71198, 1339.41418, 12.35385, 0, 0, 90 ), } for i, veh in ipairs(VeiculosComDataPetroleiro) do setElementData ( veh, "Emprego", "Petroleiro" ) 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 == "Petroleiro" then else cancelEvent() exports.Scripts_Dxmessages:outputDx(thePlayer, "Este vehículo es exclusivo para petroleros!", "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(VeiculosComDataPetroleiro) 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 --------------------------------------------------------------------
×
×
  • Create New...