Holympo Posted September 4, 2019 Posted September 4, 2019 Eu tenho o emprego mecanico e uber quem e do mecanico e uber nao recebe a notificaçao de alguem precisa e queria que eles recebessem notificaçao e quando pegam emprego ficassem com tag no painel p -------------------------------------------------------------------- setElementData( localPlayer, "Chamado:Mecanico", false ) setElementData(localPlayer,"cliente:mecanico",nil) -------------------------------------------------------------------- function localizarMecanico(cn,name) local jobMecanico = getElementData(localPlayer,"Emprego") or false --if type(jobMecanico) == "boolean" then if jobMecanico == "Mecanico" then if type(name) == "string" then local player = getPlayerFromPartialName(name) if isElement(player) then if isElement(testeMecanico) then destroyElement(testeMecanico) end if getElementData ( player, "Chamado:Mecanico" ) == true then testeMecanico = createBlipAttachedTo(player,61,2,255,255,255,255,0,999999) exports.Scripts_Dxmessages:createNotification("O Jogador "..getPlayerName(player).." Foi Localizado!, Para Deslocalizar Digite /Deslocalizar", "success") else exports.Scripts_Dxmessages:createNotification("O Jogador "..getPlayerName(player).." Não Solicitou por um Mecânico!", "error") end else exports.Scripts_Dxmessages:createNotification("O Jogador Não Foi Encontrado!", "error") end else exports.Scripts_Dxmessages:createNotification("Digite /Localizar Nick", "warning") end end --end end addCommandHandler("localizar",localizarMecanico) -------------------------------------------------------------------- function deslocalizar(cn,name) if isElement(testeMecanico) then destroyElement(testeMecanico) exports.Scripts_Dxmessages:createNotification("O Jogador foi Deslocalizado com Sucesso!", "success") end end addCommandHandler("deslocalizar",deslocalizar) -------------------------------------------------------------------- function QuebradoMec ( ) exports.Scripts_Dxmessages:createNotification("Esse Veiculo Esta Quebrado, Chame Por um Mecanico digitando /Mecanicos", "warning") end addEvent( "Mecanico>Quebrado", true ) addEventHandler( "Mecanico>Quebrado", localPlayer, QuebradoMec ) -------------------------------------------------------------------- function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end -------------------------------------------------------------------- function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end -------------------------------------------------------------------- addEventHandler("onVehicleDamage", getRootElement(),function(loss) if getElementType ( source ) == "vehicle" then if not isVehicleDamageProof(source) then local HP = getElementHealth(source)-loss if HP <= 350 then HP = 350 setElementHealth(source,350) setVehicleEngineState(source,false) setVehicleDamageProof(source,true) if isVehicleBlown(source) then fixVehicle(source) setElementHealth(source,350) setVehicleDamageProof(source,true) end end end end end) -------------------------------------------------------------------- function DesligarAndLigar ( playerSource ) if math.floor ( getElementHealth( source ) + 0.5 ) > 350 then setVehicleDamageProof( source, false ) -- Não Quebrado else setVehicleEngineState( source, false ) -- Quebrado triggerClientEvent ( "Mecanico>Quebrado", playerSource ) end end addEventHandler ( "onVehicleEnter", root, DesligarAndLigar ) -------------------------------------------------------------------- function MecanicoVem(source) for i, player in ipairs(getElementsByType("player")) do local uj = getElementData(player, "Emprego" ) or false --if type(uj) == "boolean" then if uj == "Mecanico" then exports.Scripts_Dxmessages:createNotification(player, "O Jogador "..getPlayerName(source).." Chamou Por um Mecanico! Digite /Localizar "..getPlayerName(source), "warning") end --end end end addCommandHandler(cmd4,MecanicoVem) -------------------------------------------------------------------- function ComandoMecanico ( ThePlayer ) exports.Scripts_Dxmessages:outputDx(ThePlayer, "Os Mecanicos Foram Avisados, Aguarde no Local!", "warning") setElementData ( ThePlayer, "Chamado:Mecanico", true ) setTimer ( function() removeElementData ( ThePlayer, "Chamado:Mecanico" ) end, 60000, 1 ) end addCommandHandler(cmd4, ComandoMecanico ) --------------------------------------------------------------------
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now