Jump to content

[AJUDA] Systema De Mecanico Bugado


Recommended Posts

Olá Galera beleza estou aqui com um systema de Mecanico simples que estou querendo usa em meu servidor porem eu tentando resolve o erro dele não esta localizando o player nem reparando o carro única coisa que esta fazendo é abrindo painel aceita trabalho dai pega skin cancela tira skin cria veiculo pega o carro único problema é reparar localiza e deslocalizar

Se possível pode me amostra onde foi o erro também ira me ajuda muito a saber o que estava acontecendo !

server.lua

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

local MecanicoMarker = createMarker ( 169.30359, -1818.79614, 4.56875 -1, "cylinder", 1.2, 255, 0, 0, 95 )
local BlipMecanicoMarker = createBlipAttachedTo ( MecanicoMarker, 27 )
setBlipVisibleDistance( BlipMecanicoMarker, 150)

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

function AbrirPainelMecanico ( source )
if not isPedInVehicle ( source ) then
triggerClientEvent (source, "Abrir:PainelMecanico", root)
end
end
addEventHandler ( "onMarkerHit", MecanicoMarker, AbrirPainelMecanico )

function FecharPainelMecanico ( source )
triggerClientEvent (source, "Fechar:PainelMecanico", root)
end
addEventHandler ("onMarkerLeave", MecanicoMarker, FecharPainelMecanico )

function DemitirSeMecanico ( )
 setElementModel ( source, 0 )
end
addEvent( "Mecanico>Demitirse", true )
addEventHandler( "Mecanico>Demitirse", root, DemitirSeMecanico )

function AceitarMecanico ( )
 setElementModel ( source, 50 )
end
addEvent( "Mecanico>Aceitar", true )
addEventHandler( "Mecanico>Aceitar", root, AceitarMecanico )

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

canceltimer={}
function fix(source,cmd,pname)
	if getElementData(source,"mecanico") == true then
		local cliente = getPlayerFromPartialName(pname)
		if isElement(cliente) then
			if cliente == source then outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFVocê não Pode Oferecer Reparos Para Você Mesmo",source, 255, 255, 255, true ) return end
			if isPedInVehicle(cliente) then
				local seat = getPedOccupiedVehicleSeat(cliente)
				if seat == 0 then
					local mecanico = getElementData(cliente,"cliente:mecanico")
					if isElement(mecanico) then
						outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador "..getPlayerName(cliente).." #FFFFFFJa Esta Sendo Atendido Por um Mecanico",source, 255, 255, 255, true )
					else
						local cx,cy,cz = getElementPosition(cliente)
						local x,y,z = getElementPosition(source)
						local dist = getDistanceBetweenPoints3D(x,y,z,cx,cy,cz)
						if dist <= 7 then
							local cmoney = getPlayerMoney(cliente)
							if cmoney >= 500 then
								setElementData(cliente,"cliente:mecanico",source)
								
								outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFVocê Ofereceu Serviços Para O Jogador #ffffff"..getPlayerName(cliente).."",source, 255, 255, 255, true )
								
								outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFO Mecanico "..getPlayerName(source).." #ffffffQuer Reparar seu Veiculo Por $500",cliente, 255, 255, 255, true )
								outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFDigite /Aceitar ou /Recusar",cliente, 255, 255, 255, true )
								canceltimer[cliente] = setTimer(cancelfix,10000,1,cliente)
							else
								outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador "..getPlayerName(cliente).." #ffffffNão tem Dinheiro Suficiente",source, 255, 255, 255, true )
							end
						end
					end
				else
					outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador "..getPlayerName(cliente).." #FFFFFFNão é o Motorista do Veiculo",source, 255, 255, 255, true )
				end
			else
				outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador "..getPlayerName(cliente).." #FFFFFFNão Esta em um Veiculo",source, 255, 255, 255, true )			
			end
		else
		    outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFJogador Não Encontrado",source, 255, 255, 255, true )
		end
	end
end
addCommandHandler('reparar',fix)

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

function recusar(source)
	local mecanico = getElementData(source,"cliente:mecanico")
	if isElement(mecanico) then
		outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador "..getPlayerName(source).." #ffffffRecusou o Reparo",mecanico, 255, 255, 255, true )
		outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFVocê Recusou o Reparo",source, 255, 255, 255, true )
	end
	setElementData(source,"cliente:mecanico",nil)	
	if isTimer(canceltimer[source]) then
		killTimer(canceltimer[source])
	end
end
addCommandHandler('recusar',recusar)

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

function aceitar(source)
	local mecanico = getElementData(source,"cliente:mecanico")
	if isElement(mecanico) then
	    
		if not isPedInVehicle(source) then
		outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFo Jogador Aceitou o Reparo, Porem não Esta em um Veiculo",mecanico, 255, 255, 255, true )
		outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFVoce Não Pode Aceitar um Reparo Fora de um Veiculo",source, 255, 255, 255, true ) return end

		outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador "..getPlayerName(source).." #FFFFFFAceitou o Reparo",mecanico, 255, 255, 255, true )
		local cx,cy,cz = getElementPosition(mecanico)
		local x,y,z = getElementPosition(source)
		local dist = getDistanceBetweenPoints3D(x,y,z,cx,cy,cz)
		if dist <= 7 then	
			if isPedInVehicle(source) then
				local seat = getPedOccupiedVehicleSeat(source)
				if seat == 0 then			
					local vh = getPedOccupiedVehicle(source)
					if isElement(vh) then
						setElementHealth(vh,1000)
						fixVehicle(vh)
						setVehicleEngineState(vh,true)
						if  isVehicleDamageProof(vh) then
							setVehicleDamageProof(vh,false)
						end
					end
					takePlayerMoney(source,500)
					givePlayerMoney(mecanico,500)
					outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFO Mecanico Reparou o Seu Veiculo",source, 255, 255, 255, true )
					outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFVoce Reparou um Veiculo",mecanico, 255, 255, 255, true )					
				end
			end	
		else
			outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFO Mecanico Estava Muito Longe",source, 255, 255, 255, true )
			outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFVocê Estava Muito Longe do Cliente",mecanico, 255, 255, 255, true )
		end
	end
	setElementData(source,"cliente:mecanico",nil)	
	if isTimer(canceltimer[source]) then
		killTimer(canceltimer[source])
	end
end
addCommandHandler('aceitar',aceitar)

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

function cancelfix(source)
	local mecanico = getElementData(source,"cliente:mecanico")
	if isElement(mecanico) then
		outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador "..getPlayerName(source).." #FFFFFFDemorou Para Aceitar o Reparo",mecanico , 255, 255, 255, true)
	end
	outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFVocê Demorou Demais Para Aceitar o Reparo",source, 255, 255, 255, true )
	setElementData(source,"cliente:mecanico",nil)	
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,"mecanico") or false
if type(uj) == "boolean" then
if uj == true then
outputMessage("#ffffff[ Clientes #ffffff] - #FFFFFFO Jogador #ffffff"..getPlayerName(source).." #ffffffChamou Por um Mecanico",player, 255, 255, 255, true )
outputMessage("#ffffff[ Clientes #ffffff] - #FFFFFFDigite /Localizar "..getPlayerName(source).." #ffffffPara Marcar O Jogador No Mapa",player, 255, 255, 255, true )
end
end
end		
end
addCommandHandler("mecanico",MecanicoVem)

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

function ComandoMecanico ( ThePlayer )
outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFOs Mecanicos Foram Avisados, Aguarde no Local", ThePlayer, 255, 255, 255, true )
end
addCommandHandler("mecanico", ComandoMecanico )

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

MecanicoVeiculoCar = {}
function MecanicoVeiculo ()
if getElementData ( source, "mecanico", true ) then
if MecanicoVeiculoCar[source] and isElement( MecanicoVeiculoCar[source] ) then destroyElement( MecanicoVeiculoCar[source] ) 
MecanicoVeiculoCar[source] = nil 
end
MecanicoVeiculoCar[source] = createVehicle( 525, 194.37677, -1803.61316, 4.67829)
setElementRotation (MecanicoVeiculoCar[source], 0, 0, 270 )
setVehicleColor ( MecanicoVeiculoCar[source], 255, 255, 255 )
warpPedIntoVehicle ( source, MecanicoVeiculoCar[source] )
outputMessage ( "#ffffff[ Mecanico #ffffff] - #FFFFFFSeu Veiculo Foi Criado Com Sucesso", source, 255, 255, 255, true )
end
end
addEvent( "Mecanico>CriarCarro",true)
addEventHandler( "Mecanico>CriarCarro", root, MecanicoVeiculo )

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

function DestruirMecanicoVeiculo ()
if isElement( MecanicoVeiculoCar[source] ) then
destroyElement ( MecanicoVeiculoCar[source] )
setElementData ( source, "mecanico:veiculo>ON", false )
end
end
addEventHandler ( "onPlayerLogout", root, DestruirMecanicoVeiculo )
addEventHandler ( "onPlayerQuit", root, DestruirMecanicoVeiculo )
addEventHandler ( "onPlayerWasted", root, DestruirMecanicoVeiculo )
addEvent ("Mecanico>DestruirCarro", true)
addEventHandler ("Mecanico>DestruirCarro", getRootElement(), DestruirMecanicoVeiculo )

function outputMessage (text, player, r, g, b)
	return exports["[SCR]LIB"]:outputMessage(player, text, r, g, b);
end

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

 

client.lua

setElementData(localPlayer,"cliente:mecanico",nil)

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

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

PainelMecanico = false

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

function PainelMecanicoDX ()
    dxDrawLine(x*430 - 1, y*205 - 1, x*430 - 1, y*563, tocolor(0, 0, 0, 255), x*1, false)
    dxDrawLine(x*937, y*205 - 1, x*430 - 1, y*205 - 1, tocolor(0, 0, 0, 255), x*1, false)
    dxDrawLine(x*430 - 1, y*563, x*937, y*563, tocolor(0, 0, 0, 255), x*1, false)
    dxDrawLine(x*937, y*563, x*937, y*205 - 1, tocolor(0, 0, 0, 255), x*1, false)
    dxDrawRectangle((screenW - x*507) / 2, (screenH - y*358) / 2, x*507, y*358, tocolor(0, 0, 0, 113), false)
    
	dxDrawRectangle(x*430, y*205, x*507, y*31, tocolor(67, 225, 182, 113), false)  
	dxDrawText("Emprego de Mecânico", x*429, y*204, x*937, y*236, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
    dxDrawText("X", x*906 + 1, y*204 + 1, x*937 + 1, y*236 + 1, tocolor(0, 0, 0, 255), x*1.00, "default-bold", "center", "center", false, false, false, false, false)
    dxDrawText("X", x*906, y*204, x*937, y*236, tocolor(246, 182, 45, 255), x*1.00, "default-bold", "center", "center", false, false, false, false, false)
    dxDrawRectangle(x*911, y*210, x*19, y*20, tocolor(0, 0, 0, 0), false)
	
	if getElementData (localPlayer, "mecanico", true ) then
	dxDrawText("Este é seu Trabalho Atualmente, Duvidas ? Leia os\nComandos de Sua Profissão Abaixo.", x*430, y*236, x*937, y*310, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
	else
	dxDrawText("Este é o Emprego de Mecânico do Nosso Servidor, Ao Aceitar\no Emprego Você vai Virar Mecânico Automaticamente.", x*430, y*236, x*937, y*310, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
    end
	
	dxDrawText("Comandos da Profissão", x*430, y*316, x*937, y*348, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
    dxDrawText("/Localizar Nick do Jogador\n/Deslocalizar\n/Reparar Nick do Jogador", x*430, y*354, x*937, y*428, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)

	if getElementData (localPlayer, "mecanico", true ) then
    dxDrawLine(x*524 - 1, y*482 - 1, x*524 - 1, y*507, tocolor(0, 0, 0, 255), x*1, false)
    dxDrawLine(x*630, y*482 - 1, x*524 - 1, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)
    dxDrawLine(x*524 - 1, y*507, x*630, y*507, tocolor(0, 0, 0, 255), x*1, false)
    dxDrawLine(x*630, y*507, x*630, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)
    dxDrawRectangle(x*524, y*482, x*106, y*25, tocolor(255, 72, 73, 105), false)
    dxDrawText("Pedir Demissão", x*525, y*482, x*630, y*507, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
	
	dxDrawLine(x*736 - 1, y*482 - 1, x*736 - 1, y*507, tocolor(0, 0, 0, 255), x*1, false)
    dxDrawLine(x*842, y*482 - 1, x*736 - 1, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)
    dxDrawLine(x*736 - 1, y*507, x*842, y*507, tocolor(0, 0, 0, 255), x*1, false)
    dxDrawLine(x*842, y*507, x*842, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)
    dxDrawRectangle(x*736, y*482, x*106, y*25, tocolor(45, 237, 255, 105), false)
	if getElementData (localPlayer, "mecanico:veiculo>ON", true ) then
	dxDrawText("Destruir Veiculo", x*737, y*482, x*842, y*507, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
	else
	dxDrawText("Criar Veiculo", x*737, y*482, x*842, y*507, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
	end
	
	else
    dxDrawLine(x*524 - 1, y*482 - 1, x*524 - 1, y*507, tocolor(0, 0, 0, 255), x*1, false)
    dxDrawLine(x*630, y*482 - 1, x*524 - 1, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)
    dxDrawLine(x*524 - 1, y*507, x*630, y*507, tocolor(0, 0, 0, 255), x*1, false)
    dxDrawLine(x*630, y*507, x*630, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)
    dxDrawRectangle(x*524, y*482, x*106, y*25, tocolor(89, 251, 77, 105), false)
	dxDrawText("Aceitar", x*525, y*482, x*630, y*507, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
    
	dxDrawLine(x*736 - 1, y*482 - 1, x*736 - 1, y*507, tocolor(0, 0, 0, 255), x*1, false)
    dxDrawLine(x*842, y*482 - 1, x*736 - 1, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)
    dxDrawLine(x*736 - 1, y*507, x*842, y*507, tocolor(0, 0, 0, 255), x*1, false)
    dxDrawLine(x*842, y*507, x*842, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)
    dxDrawRectangle(x*736, y*482, x*106, y*25, tocolor(255, 72, 73, 105), false)
	dxDrawText("Recusar", x*737, y*482, x*842, y*507, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
end
end

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

function AbrirPainelMecanico ()
if PainelMecanico == false then
addEventHandler ( "onClientRender", root, PainelMecanicoDX )
showCursor ( true )
PainelMecanico = true
end
end
addEvent ( "Abrir:PainelMecanico", true)
addEventHandler ( "Abrir:PainelMecanico", root, AbrirPainelMecanico )

function FecharPainelMecanico ()
if PainelMecanico == true then
removeEventHandler ( "onClientRender", root, PainelMecanicoDX )
showCursor ( false )
PainelMecanico = false
playSoundFrontEnd ( 40 )
end
end
addEvent ( "Fechar:PainelMecanico", true)
addEventHandler ( "Fechar:PainelMecanico", root, FecharPainelMecanico )

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

function FecharXMC (_,state)
if PainelMecanico == true then
if state == "down" then
if isCursorOnElement ( x*911, y*210, x*19, y*20 ) then
removeEventHandler ( "onClientRender", root, PainelMecanicoDX )
showCursor ( false )
PainelMecanico = false
playSoundFrontEnd ( 40 )
end
end
end
end
addEventHandler ( "onClientClick", root, FecharXMC )

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

function DemissaoMecanico (_,state)
if PainelMecanico == true then
if state == "down" then
if isCursorOnElement ( x*524, y*482, x*106, y*25 ) then
if getElementData (localPlayer, "mecanico", true ) then
removeEventHandler ( "onClientRender", root, PainelMecanicoDX )
setElementData (localPlayer, "mecanico", false )
outputChatBox ( "#ffffff[ Mecanico #ffffff] - Você Pediu Demissão", 255, 255, 255, true )
triggerServerEvent ( "Mecanico>Demitirse", localPlayer )
triggerServerEvent ( "Mecanico>DestruirCarro", localPlayer )
showCursor ( false )
PainelMecanico = false
playSoundFrontEnd ( 40 )
end
end
end
end
end
addEventHandler ( "onClientClick", root, DemissaoMecanico )

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

function AceitarMecanico (_,state)
if PainelMecanico == true then
if state == "down" then
if isCursorOnElement ( x*524, y*482, x*106, y*25 ) then
if not getElementData (localPlayer, "mecanico", false ) then
removeEventHandler ( "onClientRender", root, PainelMecanicoDX )
setElementData (localPlayer, "mecanico", true )
outputChatBox ( "#ffffff[ Mecanico #ffffff] - Você Agora é um Mecanico", 255, 255, 255, true )
triggerServerEvent ( "Mecanico>Aceitar", localPlayer )
showCursor ( false )
PainelMecanico = false
playSoundFrontEnd ( 40 )
end
end
end
end
end
addEventHandler ( "onClientClick", root, AceitarMecanico )

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

function RecusarMecanico (_,state)
if PainelMecanico == true then
if state == "down" then
if isCursorOnElement ( x*736, y*482, x*106, y*25 ) then
if not getElementData (localPlayer, "mecanico", true ) then
removeEventHandler ( "onClientRender", root, PainelMecanicoDX )
setElementData (localPlayer, "mecanico", false )
outputChatBox ( "#ffffff[ Mecanico #ffffff] - Você Recusou o Emprego de Mecanico", 255, 255, 255, true )
showCursor ( false )
PainelMecanico = false
playSoundFrontEnd ( 40 )
end
end
end
end
end
addEventHandler ( "onClientClick", root, RecusarMecanico )

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

function CriareDestruirVeh (_,state)
if PainelMecanico == true then
if state == "down" then
if isCursorOnElement ( x*736, y*482, x*106, y*25 ) then
if getElementData (localPlayer, "mecanico", true ) then
removeEventHandler ( "onClientRender", root, PainelMecanicoDX )
showCursor ( false )
PainelMecanico = false
playSoundFrontEnd ( 40 )
if getElementData (localPlayer, "mecanico:veiculo>ON", true ) then
triggerServerEvent ( "Mecanico>DestruirCarro", localPlayer )
outputChatBox("#ffffff[ Mecanico #ffffff] - #FFFFFFSeu Veiculo Foi Destruido com Sucesso", 255, 255, 255, true )	
setElementData ( localPlayer, "mecanico:veiculo>ON", false )
else
triggerServerEvent ( "Mecanico>CriarCarro", localPlayer )
setElementData ( localPlayer, "mecanico:veiculo>ON", true )
end
end
end
end
end
end
addEventHandler ( "onClientClick", root, CriareDestruirVeh )

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

function localizarMecanico(cn,name)
local jobMecanico = getElementData(localPlayer,"mecanico") or false
if type(jobMecanico) == "boolean" then
if jobMecanico == true then
if type(name) == "string" then
local player = getPlayerFromPartialName(name)
if isElement(player) then
if isElement(testeMecanico) then
destroyElement(testeMecanico)
end
testeMecanico = createBlipAttachedTo(player,61,2,255,255,255,255,0,999999)
outputChatBox("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador #ffffff"..getPlayerName(player).." #ffffffFoi Localizado",255,255,255,true)		
outputChatBox("#ffffff[ Mecanico #ffffff] - #FFFFFFPara Desmarcar O Jogador do Mapa Digite /Deslocalizar",255,255,255,true)	
else
outputChatBox("#ffffff[ Mecanico #ffffff] - #FFFFFFJogador Não Encontrado",255,255,255,true)
end
else
outputChatBox("#ffffff[ Mecanico #ffffff] - #FFFFFFDigite /Localizar Nick",255,255,255,true)
end		
end
end
end
addCommandHandler("localizar",localizarMecanico)

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

function deslocalizar(cn,name)
if isElement(testeMecanico) then
destroyElement(testeMecanico)
outputChatBox("#ffffff[ Mecanico #ffffff] - #FFFFFFJogador Deslocalizado Com Sucesso",255,255,255,true)
end
end
addCommandHandler("deslocalizar",deslocalizar)

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

function QuebradoMec ( )
    outputChatBox ( "#ffffff[ Aviso #ffffff] - Seu Veiculo Esta Quebrado, Chame Por um Mecanico", 255, 255, 255, true )
    outputChatBox ( "#ffffff[ Aviso #ffffff] - Digite /Mecanico & Aguarde no Local", 255, 255, 255, true )
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 isCursorOnElement( x,y,w,h )
local mx,my = getCursorPosition ()
local fullx,fully = guiGetScreenSize()
cursorx,cursory = mx*fullx,my*fully
if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
return true
else
return false
end
end

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

 

Edited by zTokyoGamer
Link to comment

 

13 minutes ago, zTokyoGamer said:

Pronto amigo @Lord Henry

Código ainda esta sem indentação.

https://pt.wikipedia.org/wiki/Indentação

Não vi exatamente aonde esta '' tentando '' setar o blip no jogador que chamou o  mecanico, talvez o problema esteja ai, nem setando esta.

Talvez eu possa ter visto rápido, e como estou no celular fica muito limitado aqui, quando eu entrar no PC vejo melhor, enquanto isso deixe o código indentado para que outras pessoas rapidamente entendam o código também e possam ajudar.

Edited by Jonas^
Link to comment
  • Other Languages Moderators
6 minutes ago, zTokyoGamer said:

Pronto amigo @Lord Henry

Permita-me indentar pra vc:

Spoiler

server.lua


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

local MecanicoMarker = createMarker ( 169.30359, -1818.79614, 4.56875 -1, "cylinder", 1.2, 255, 0, 0, 95 )
local BlipMecanicoMarker = createBlipAttachedTo ( MecanicoMarker, 27 )
setBlipVisibleDistance( BlipMecanicoMarker, 150)

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

function AbrirPainelMecanico ( source )
	if not isPedInVehicle ( source ) then
		triggerClientEvent (source, "Abrir:PainelMecanico", root)
	end
end
addEventHandler ( "onMarkerHit", MecanicoMarker, AbrirPainelMecanico )

function FecharPainelMecanico ( source )
	triggerClientEvent (source, "Fechar:PainelMecanico", root)
end
addEventHandler ("onMarkerLeave", MecanicoMarker, FecharPainelMecanico )

function DemitirSeMecanico ( )
	setElementModel ( source, 0 )
end
addEvent( "Mecanico>Demitirse", true )
addEventHandler( "Mecanico>Demitirse", root, DemitirSeMecanico )

function AceitarMecanico ( )
	setElementModel ( source, 50 )
end
addEvent( "Mecanico>Aceitar", true )
addEventHandler( "Mecanico>Aceitar", root, AceitarMecanico )

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

canceltimer={}

function fix(source,cmd,pname)
	if getElementData(source,"mecanico") == true then
		local cliente = getPlayerFromPartialName(pname)
		if isElement(cliente) then
			if cliente == source then outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFVocê não Pode Oferecer Reparos Para Você Mesmo",source, 255, 255, 255, true ) return end
			if isPedInVehicle(cliente) then
				local seat = getPedOccupiedVehicleSeat(cliente)
				if seat == 0 then
					local mecanico = getElementData(cliente,"cliente:mecanico")
					if isElement(mecanico) then
						outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador "..getPlayerName(cliente).." #FFFFFFJa Esta Sendo Atendido Por um Mecanico",source, 255, 255, 255, true )
					else
						local cx,cy,cz = getElementPosition(cliente)
						local x,y,z = getElementPosition(source)
						local dist = getDistanceBetweenPoints3D(x,y,z,cx,cy,cz)
						if dist <= 7 then
							local cmoney = getPlayerMoney(cliente)
							if cmoney >= 500 then
								setElementData(cliente,"cliente:mecanico",source)
								outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFVocê Ofereceu Serviços Para O Jogador #ffffff"..getPlayerName(cliente).."",source, 255, 255, 255, true )
								outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFO Mecanico "..getPlayerName(source).." #ffffffQuer Reparar seu Veiculo Por $500",cliente, 255, 255, 255, true )
								outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFDigite /Aceitar ou /Recusar",cliente, 255, 255, 255, true )
								canceltimer[cliente] = setTimer(cancelfix,10000,1,cliente)
							else
								outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador "..getPlayerName(cliente).." #ffffffNão tem Dinheiro Suficiente",source, 255, 255, 255, true )
							end
						end
					end
				else
					outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador "..getPlayerName(cliente).." #FFFFFFNão é o Motorista do Veiculo",source, 255, 255, 255, true )
				end
			else
				outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador "..getPlayerName(cliente).." #FFFFFFNão Esta em um Veiculo",source, 255, 255, 255, true )
			end
		else
			outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFJogador Não Encontrado",source, 255, 255, 255, true )
		end
	end
end
addCommandHandler('reparar',fix)

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

function recusar(source)
	local mecanico = getElementData(source,"cliente:mecanico")
	if isElement(mecanico) then
		outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador "..getPlayerName(source).." #ffffffRecusou o Reparo",mecanico, 255, 255, 255, true )
		outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFVocê Recusou o Reparo",source, 255, 255, 255, true )
	end
	setElementData(source,"cliente:mecanico",nil)	
	if isTimer(canceltimer[source]) then
		killTimer(canceltimer[source])
	end
end
addCommandHandler('recusar',recusar)

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

function aceitar(source)
	local mecanico = getElementData(source,"cliente:mecanico")
	if isElement(mecanico) then
		if not isPedInVehicle(source) then
		outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFo Jogador Aceitou o Reparo, Porem não Esta em um Veiculo",mecanico, 255, 255, 255, true )
		outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFVoce Não Pode Aceitar um Reparo Fora de um Veiculo",source, 255, 255, 255, true ) return end
		outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador "..getPlayerName(source).." #FFFFFFAceitou o Reparo",mecanico, 255, 255, 255, true )
		local cx,cy,cz = getElementPosition(mecanico)
		local x,y,z = getElementPosition(source)
		local dist = getDistanceBetweenPoints3D(x,y,z,cx,cy,cz)
		if dist <= 7 then	
			if isPedInVehicle(source) then
				local seat = getPedOccupiedVehicleSeat(source)
				if seat == 0 then			
					local vh = getPedOccupiedVehicle(source)
					if isElement(vh) then
						setElementHealth(vh,1000)
						fixVehicle(vh)
						setVehicleEngineState(vh,true)
						if  isVehicleDamageProof(vh) then
							setVehicleDamageProof(vh,false)
						end
					end
					takePlayerMoney(source,500)
					givePlayerMoney(mecanico,500)
					outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFO Mecanico Reparou o Seu Veiculo",source, 255, 255, 255, true )
					outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFVoce Reparou um Veiculo",mecanico, 255, 255, 255, true )					
				end
			end
		else
			outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFO Mecanico Estava Muito Longe",source, 255, 255, 255, true )
			outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFVocê Estava Muito Longe do Cliente",mecanico, 255, 255, 255, true )
		end
	end
	setElementData(source,"cliente:mecanico",nil)	
	if isTimer(canceltimer[source]) then
		killTimer(canceltimer[source])
	end
end
addCommandHandler('aceitar',aceitar)

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

function cancelfix(source)
	local mecanico = getElementData(source,"cliente:mecanico")
	if isElement(mecanico) then
		outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador "..getPlayerName(source).." #FFFFFFDemorou Para Aceitar o Reparo",mecanico , 255, 255, 255, true)
	end
	outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFVocê Demorou Demais Para Aceitar o Reparo",source, 255, 255, 255, true )
	setElementData(source,"cliente:mecanico",nil)	
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,"mecanico") or false
		if type(uj) == "boolean" then
			if uj == true then
				outputMessage("#ffffff[ Clientes #ffffff] - #FFFFFFO Jogador #ffffff"..getPlayerName(source).." #ffffffChamou Por um Mecanico",player, 255, 255, 255, true )
				outputMessage("#ffffff[ Clientes #ffffff] - #FFFFFFDigite /Localizar "..getPlayerName(source).." #ffffffPara Marcar O Jogador No Mapa",player, 255, 255, 255, true )
			end
		end
	end		
end
addCommandHandler("mecanico",MecanicoVem)

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

function ComandoMecanico ( ThePlayer )
	outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFOs Mecanicos Foram Avisados, Aguarde no Local", ThePlayer, 255, 255, 255, true )
end
addCommandHandler("mecanico", ComandoMecanico )

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

MecanicoVeiculoCar = {}

function MecanicoVeiculo ()
	if getElementData ( source, "mecanico", true ) then
		if MecanicoVeiculoCar[source] and isElement( MecanicoVeiculoCar[source] ) then
			destroyElement( MecanicoVeiculoCar[source] ) 
			MecanicoVeiculoCar[source] = nil 
		end
		MecanicoVeiculoCar[source] = createVehicle( 525, 194.37677, -1803.61316, 4.67829)
		setElementRotation (MecanicoVeiculoCar[source], 0, 0, 270 )
		setVehicleColor ( MecanicoVeiculoCar[source], 255, 255, 255 )
		warpPedIntoVehicle ( source, MecanicoVeiculoCar[source] )
		outputMessage ( "#ffffff[ Mecanico #ffffff] - #FFFFFFSeu Veiculo Foi Criado Com Sucesso", source, 255, 255, 255, true )
	end
end
addEvent( "Mecanico>CriarCarro",true)
addEventHandler( "Mecanico>CriarCarro", root, MecanicoVeiculo )

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

function DestruirMecanicoVeiculo ()
	if isElement( MecanicoVeiculoCar[source] ) then
		destroyElement ( MecanicoVeiculoCar[source] )
		setElementData ( source, "mecanico:veiculo>ON", false )
	end
end
addEventHandler ( "onPlayerLogout", root, DestruirMecanicoVeiculo )
addEventHandler ( "onPlayerQuit", root, DestruirMecanicoVeiculo )
addEventHandler ( "onPlayerWasted", root, DestruirMecanicoVeiculo )
addEvent ("Mecanico>DestruirCarro", true)
addEventHandler ("Mecanico>DestruirCarro", getRootElement(), DestruirMecanicoVeiculo )

function outputMessage (text, player, r, g, b)
	return exports["[SCR]LIB"]:outputMessage(player, text, r, g, b);
end

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

client.lua


setElementData(localPlayer,"cliente:mecanico",nil)
local screenW,screenH = guiGetScreenSize()
local resW, resH = 1366,768
local x, y = (screenW/resW), (screenH/resH)
--------------------------------------------------------------------
PainelMecanico = false
--------------------------------------------------------------------
function PainelMecanicoDX ()
	dxDrawLine(x*430 - 1, y*205 - 1, x*430 - 1, y*563, tocolor(0, 0, 0, 255), x*1, false)
	dxDrawLine(x*937, y*205 - 1, x*430 - 1, y*205 - 1, tocolor(0, 0, 0, 255), x*1, false)
	dxDrawLine(x*430 - 1, y*563, x*937, y*563, tocolor(0, 0, 0, 255), x*1, false)
	dxDrawLine(x*937, y*563, x*937, y*205 - 1, tocolor(0, 0, 0, 255), x*1, false)
	dxDrawRectangle((screenW - x*507) / 2, (screenH - y*358) / 2, x*507, y*358, tocolor(0, 0, 0, 113), false)
	dxDrawRectangle(x*430, y*205, x*507, y*31, tocolor(67, 225, 182, 113), false)  
	dxDrawText("Emprego de Mecânico", x*429, y*204, x*937, y*236, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
	dxDrawText("X", x*906 + 1, y*204 + 1, x*937 + 1, y*236 + 1, tocolor(0, 0, 0, 255), x*1.00, "default-bold", "center", "center", false, false, false, false, false)
	dxDrawText("X", x*906, y*204, x*937, y*236, tocolor(246, 182, 45, 255), x*1.00, "default-bold", "center", "center", false, false, false, false, false)
	dxDrawRectangle(x*911, y*210, x*19, y*20, tocolor(0, 0, 0, 0), false)
	if getElementData (localPlayer, "mecanico", true ) then
		dxDrawText("Este é seu Trabalho Atualmente, Duvidas ? Leia os\nComandos de Sua Profissão Abaixo.", x*430, y*236, x*937, y*310, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
	else
		dxDrawText("Este é o Emprego de Mecânico do Nosso Servidor, Ao Aceitar\no Emprego Você vai Virar Mecânico Automaticamente.", x*430, y*236, x*937, y*310, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
	end
	dxDrawText("Comandos da Profissão", x*430, y*316, x*937, y*348, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
	dxDrawText("/Localizar Nick do Jogador\n/Deslocalizar\n/Reparar Nick do Jogador", x*430, y*354, x*937, y*428, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
	if getElementData (localPlayer, "mecanico", true ) then
		dxDrawLine(x*524 - 1, y*482 - 1, x*524 - 1, y*507, tocolor(0, 0, 0, 255), x*1, false)
		dxDrawLine(x*630, y*482 - 1, x*524 - 1, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)
		dxDrawLine(x*524 - 1, y*507, x*630, y*507, tocolor(0, 0, 0, 255), x*1, false)
		dxDrawLine(x*630, y*507, x*630, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)
		dxDrawRectangle(x*524, y*482, x*106, y*25, tocolor(255, 72, 73, 105), false)
		dxDrawText("Pedir Demissão", x*525, y*482, x*630, y*507, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
		dxDrawLine(x*736 - 1, y*482 - 1, x*736 - 1, y*507, tocolor(0, 0, 0, 255), x*1, false)
		dxDrawLine(x*842, y*482 - 1, x*736 - 1, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)
		dxDrawLine(x*736 - 1, y*507, x*842, y*507, tocolor(0, 0, 0, 255), x*1, false)
		dxDrawLine(x*842, y*507, x*842, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)
		dxDrawRectangle(x*736, y*482, x*106, y*25, tocolor(45, 237, 255, 105), false)
		if getElementData (localPlayer, "mecanico:veiculo>ON", true ) then
			dxDrawText("Destruir Veiculo", x*737, y*482, x*842, y*507, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
		else
			dxDrawText("Criar Veiculo", x*737, y*482, x*842, y*507, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
		end
	else
		dxDrawLine(x*524 - 1, y*482 - 1, x*524 - 1, y*507, tocolor(0, 0, 0, 255), x*1, false)
		dxDrawLine(x*630, y*482 - 1, x*524 - 1, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)
		dxDrawLine(x*524 - 1, y*507, x*630, y*507, tocolor(0, 0, 0, 255), x*1, false)
		dxDrawLine(x*630, y*507, x*630, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)
		dxDrawRectangle(x*524, y*482, x*106, y*25, tocolor(89, 251, 77, 105), false)
		dxDrawText("Aceitar", x*525, y*482, x*630, y*507, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
		dxDrawLine(x*736 - 1, y*482 - 1, x*736 - 1, y*507, tocolor(0, 0, 0, 255), x*1, false)
		dxDrawLine(x*842, y*482 - 1, x*736 - 1, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)
		dxDrawLine(x*736 - 1, y*507, x*842, y*507, tocolor(0, 0, 0, 255), x*1, false)
		dxDrawLine(x*842, y*507, x*842, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)
		dxDrawRectangle(x*736, y*482, x*106, y*25, tocolor(255, 72, 73, 105), false)
		dxDrawText("Recusar", x*737, y*482, x*842, y*507, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
	end
end
--------------------------------------------------------------------
function AbrirPainelMecanico ()
	if PainelMecanico == false then
		addEventHandler ( "onClientRender", root, PainelMecanicoDX )
		showCursor ( true )
		PainelMecanico = true
	end
end
addEvent ( "Abrir:PainelMecanico", true)
addEventHandler ( "Abrir:PainelMecanico", root, AbrirPainelMecanico )

function FecharPainelMecanico ()
	if PainelMecanico == true then
		removeEventHandler ( "onClientRender", root, PainelMecanicoDX )
		showCursor ( false )
		PainelMecanico = false
		playSoundFrontEnd ( 40 )
	end
end
addEvent ( "Fechar:PainelMecanico", true)
addEventHandler ( "Fechar:PainelMecanico", root, FecharPainelMecanico )
--------------------------------------------------------------------
function FecharXMC (_,state)
	if PainelMecanico == true then
		if state == "down" then
			if isCursorOnElement ( x*911, y*210, x*19, y*20 ) then
				removeEventHandler ( "onClientRender", root, PainelMecanicoDX )
				showCursor ( false )
				PainelMecanico = false
				playSoundFrontEnd ( 40 )
			end
		end
	end
end
addEventHandler ( "onClientClick", root, FecharXMC )
--------------------------------------------------------------------
function DemissaoMecanico (_,state)
	if PainelMecanico == true then
		if state == "down" then
			if isCursorOnElement ( x*524, y*482, x*106, y*25 ) then
				if getElementData (localPlayer, "mecanico", true ) then
					removeEventHandler ( "onClientRender", root, PainelMecanicoDX )
					setElementData (localPlayer, "mecanico", false )
					outputChatBox ( "#ffffff[ Mecanico #ffffff] - Você Pediu Demissão", 255, 255, 255, true )
					triggerServerEvent ( "Mecanico>Demitirse", localPlayer )
					triggerServerEvent ( "Mecanico>DestruirCarro", localPlayer )
					showCursor ( false )
					PainelMecanico = false
					playSoundFrontEnd ( 40 )
				end
			end
		end
	end
end
addEventHandler ( "onClientClick", root, DemissaoMecanico )
--------------------------------------------------------------------
function AceitarMecanico (_,state)
	if PainelMecanico == true then
		if state == "down" then
			if isCursorOnElement ( x*524, y*482, x*106, y*25 ) then
				if not getElementData (localPlayer, "mecanico", false ) then
					removeEventHandler ( "onClientRender", root, PainelMecanicoDX )
					setElementData (localPlayer, "mecanico", true )
					outputChatBox ( "#ffffff[ Mecanico #ffffff] - Você Agora é um Mecanico", 255, 255, 255, true )
					triggerServerEvent ( "Mecanico>Aceitar", localPlayer )
					showCursor ( false )
					PainelMecanico = false
					playSoundFrontEnd ( 40 )
				end
			end
		end
	end
end
addEventHandler ( "onClientClick", root, AceitarMecanico )
--------------------------------------------------------------------
function RecusarMecanico (_,state)
	if PainelMecanico == true then
		if state == "down" then
			if isCursorOnElement ( x*736, y*482, x*106, y*25 ) then
				if not getElementData (localPlayer, "mecanico", true ) then
					removeEventHandler ( "onClientRender", root, PainelMecanicoDX )
					setElementData (localPlayer, "mecanico", false )
					outputChatBox ( "#ffffff[ Mecanico #ffffff] - Você Recusou o Emprego de Mecanico", 255, 255, 255, true )
					showCursor ( false )
					PainelMecanico = false
					playSoundFrontEnd ( 40 )
				end
			end
		end
	end
end
addEventHandler ( "onClientClick", root, RecusarMecanico )
--------------------------------------------------------------------
function CriareDestruirVeh (_,state)
	if PainelMecanico == true then
		if state == "down" then
			if isCursorOnElement ( x*736, y*482, x*106, y*25 ) then
				if getElementData (localPlayer, "mecanico", true ) then
					removeEventHandler ( "onClientRender", root, PainelMecanicoDX )
					showCursor ( false )
					PainelMecanico = false
					playSoundFrontEnd ( 40 )
					if getElementData (localPlayer, "mecanico:veiculo>ON", true ) then
						triggerServerEvent ( "Mecanico>DestruirCarro", localPlayer )
						outputChatBox("#ffffff[ Mecanico #ffffff] - #FFFFFFSeu Veiculo Foi Destruido com Sucesso", 255, 255, 255, true )	
						setElementData ( localPlayer, "mecanico:veiculo>ON", false )
					else
						triggerServerEvent ( "Mecanico>CriarCarro", localPlayer )
						setElementData ( localPlayer, "mecanico:veiculo>ON", true )
					end
				end
			end
		end
	end
end
addEventHandler ( "onClientClick", root, CriareDestruirVeh )
--------------------------------------------------------------------
function localizarMecanico(cn,name)
	local jobMecanico = getElementData(localPlayer,"mecanico") or false
	if type(jobMecanico) == "boolean" then
		if jobMecanico == true then
			if type(name) == "string" then
				local player = getPlayerFromPartialName(name)
				if isElement(player) then
					if isElement(testeMecanico) then
						destroyElement(testeMecanico)
					end
					testeMecanico = createBlipAttachedTo(player,61,2,255,255,255,255,0,999999)
					outputChatBox("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador #ffffff"..getPlayerName(player).." #ffffffFoi Localizado",255,255,255,true)
					outputChatBox("#ffffff[ Mecanico #ffffff] - #FFFFFFPara Desmarcar O Jogador do Mapa Digite /Deslocalizar",255,255,255,true)	
				else
					outputChatBox("#ffffff[ Mecanico #ffffff] - #FFFFFFJogador Não Encontrado",255,255,255,true)
				end
			else
				outputChatBox("#ffffff[ Mecanico #ffffff] - #FFFFFFDigite /Localizar Nick",255,255,255,true)
			end		
		end
	end
end
addCommandHandler("localizar",localizarMecanico)
--------------------------------------------------------------------
function deslocalizar(cn,name)
	if isElement(testeMecanico) then
		destroyElement(testeMecanico)
		outputChatBox("#ffffff[ Mecanico #ffffff] - #FFFFFFJogador Deslocalizado Com Sucesso",255,255,255,true)
	end
end
addCommandHandler("deslocalizar",deslocalizar)
--------------------------------------------------------------------
function QuebradoMec ( )
	outputChatBox ( "#ffffff[ Aviso #ffffff] - Seu Veiculo Esta Quebrado, Chame Por um Mecanico", 255, 255, 255, true )
	outputChatBox ( "#ffffff[ Aviso #ffffff] - Digite /Mecanico & Aguarde no Local", 255, 255, 255, true )
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 isCursorOnElement( x,y,w,h )
	local mx,my = getCursorPosition ()
	local fullx,fully = guiGetScreenSize()
	cursorx,cursory = mx*fullx,my*fully
	if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
		return true
	else
		return false
	end
end
--------------------------------------------------------------------

Agora sim está indentado.

 

Link to comment
1 hour ago, Lord Henry said:

Permita-me indentar pra vc:

  Hide contents

server.lua



 --------------------------------------------------------------------local MecanicoMarker = createMarker ( 169.30359, -1818.79614, 4.56875 -1, "cylinder", 1.2, 255, 0, 0, 95 )local BlipMecanicoMarker = createBlipAttachedTo ( MecanicoMarker, 27 )setBlipVisibleDistance( BlipMecanicoMarker, 150)--------------------------------------------------------------------function AbrirPainelMecanico ( source )	if not isPedInVehicle ( source ) then		triggerClientEvent (source, "Abrir:PainelMecanico", root)	endendaddEventHandler ( "onMarkerHit", MecanicoMarker, AbrirPainelMecanico )function FecharPainelMecanico ( source )	triggerClientEvent (source, "Fechar:PainelMecanico", root)endaddEventHandler ("onMarkerLeave", MecanicoMarker, FecharPainelMecanico )function DemitirSeMecanico ( )	setElementModel ( source, 0 )endaddEvent( "Mecanico>Demitirse", true )addEventHandler( "Mecanico>Demitirse", root, DemitirSeMecanico )function AceitarMecanico ( )	setElementModel ( source, 50 )endaddEvent( "Mecanico>Aceitar", true )addEventHandler( "Mecanico>Aceitar", root, AceitarMecanico )--------------------------------------------------------------------canceltimer={}function fix(source,cmd,pname)	if getElementData(source,"mecanico") == true then		local cliente = getPlayerFromPartialName(pname)		if isElement(cliente) then			if cliente == source then outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFVocê não Pode Oferecer Reparos Para Você Mesmo",source, 255, 255, 255, true ) return end			if isPedInVehicle(cliente) then				local seat = getPedOccupiedVehicleSeat(cliente)				if seat == 0 then					local mecanico = getElementData(cliente,"cliente:mecanico")					if isElement(mecanico) then						outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador "..getPlayerName(cliente).." #FFFFFFJa Esta Sendo Atendido Por um Mecanico",source, 255, 255, 255, true )					else						local cx,cy,cz = getElementPosition(cliente)						local x,y,z = getElementPosition(source)						local dist = getDistanceBetweenPoints3D(x,y,z,cx,cy,cz)						if dist <= 7 then							local cmoney = getPlayerMoney(cliente)							if cmoney >= 500 then								setElementData(cliente,"cliente:mecanico",source)								outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFVocê Ofereceu Serviços Para O Jogador #ffffff"..getPlayerName(cliente).."",source, 255, 255, 255, true )								outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFO Mecanico "..getPlayerName(source).." #ffffffQuer Reparar seu Veiculo Por $500",cliente, 255, 255, 255, true )								outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFDigite /Aceitar ou /Recusar",cliente, 255, 255, 255, true )								canceltimer[cliente] = setTimer(cancelfix,10000,1,cliente)							else								outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador "..getPlayerName(cliente).." #ffffffNão tem Dinheiro Suficiente",source, 255, 255, 255, true )							end						end					end				else					outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador "..getPlayerName(cliente).." #FFFFFFNão é o Motorista do Veiculo",source, 255, 255, 255, true )				end			else				outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador "..getPlayerName(cliente).." #FFFFFFNão Esta em um Veiculo",source, 255, 255, 255, true )			end		else			outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFJogador Não Encontrado",source, 255, 255, 255, true )		end	endendaddCommandHandler('reparar',fix)--------------------------------------------------------------------function recusar(source)	local mecanico = getElementData(source,"cliente:mecanico")	if isElement(mecanico) then		outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador "..getPlayerName(source).." #ffffffRecusou o Reparo",mecanico, 255, 255, 255, true )		outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFVocê Recusou o Reparo",source, 255, 255, 255, true )	end	setElementData(source,"cliente:mecanico",nil)		if isTimer(canceltimer[source]) then		killTimer(canceltimer[source])	endendaddCommandHandler('recusar',recusar)--------------------------------------------------------------------function aceitar(source)	local mecanico = getElementData(source,"cliente:mecanico")	if isElement(mecanico) then		if not isPedInVehicle(source) then		outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFo Jogador Aceitou o Reparo, Porem não Esta em um Veiculo",mecanico, 255, 255, 255, true )		outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFVoce Não Pode Aceitar um Reparo Fora de um Veiculo",source, 255, 255, 255, true ) return end		outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador "..getPlayerName(source).." #FFFFFFAceitou o Reparo",mecanico, 255, 255, 255, true )		local cx,cy,cz = getElementPosition(mecanico)		local x,y,z = getElementPosition(source)		local dist = getDistanceBetweenPoints3D(x,y,z,cx,cy,cz)		if dist <= 7 then				if isPedInVehicle(source) then				local seat = getPedOccupiedVehicleSeat(source)				if seat == 0 then								local vh = getPedOccupiedVehicle(source)					if isElement(vh) then						setElementHealth(vh,1000)						fixVehicle(vh)						setVehicleEngineState(vh,true)						if  isVehicleDamageProof(vh) then							setVehicleDamageProof(vh,false)						end					end					takePlayerMoney(source,500)					givePlayerMoney(mecanico,500)					outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFO Mecanico Reparou o Seu Veiculo",source, 255, 255, 255, true )					outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFVoce Reparou um Veiculo",mecanico, 255, 255, 255, true )									end			end		else			outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFO Mecanico Estava Muito Longe",source, 255, 255, 255, true )			outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFVocê Estava Muito Longe do Cliente",mecanico, 255, 255, 255, true )		end	end	setElementData(source,"cliente:mecanico",nil)		if isTimer(canceltimer[source]) then		killTimer(canceltimer[source])	endendaddCommandHandler('aceitar',aceitar)--------------------------------------------------------------------function cancelfix(source)	local mecanico = getElementData(source,"cliente:mecanico")	if isElement(mecanico) then		outputMessage("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador "..getPlayerName(source).." #FFFFFFDemorou Para Aceitar o Reparo",mecanico , 255, 255, 255, true)	end	outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFVocê Demorou Demais Para Aceitar o Reparo",source, 255, 255, 255, true )	setElementData(source,"cliente:mecanico",nil)	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	endend--------------------------------------------------------------------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,"mecanico") or false		if type(uj) == "boolean" then			if uj == true then				outputMessage("#ffffff[ Clientes #ffffff] - #FFFFFFO Jogador #ffffff"..getPlayerName(source).." #ffffffChamou Por um Mecanico",player, 255, 255, 255, true )				outputMessage("#ffffff[ Clientes #ffffff] - #FFFFFFDigite /Localizar "..getPlayerName(source).." #ffffffPara Marcar O Jogador No Mapa",player, 255, 255, 255, true )			end		end	end		endaddCommandHandler("mecanico",MecanicoVem)--------------------------------------------------------------------function ComandoMecanico ( ThePlayer )	outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFOs Mecanicos Foram Avisados, Aguarde no Local", ThePlayer, 255, 255, 255, true )endaddCommandHandler("mecanico", ComandoMecanico )--------------------------------------------------------------------MecanicoVeiculoCar = {}function MecanicoVeiculo ()	if getElementData ( source, "mecanico", true ) then		if MecanicoVeiculoCar[source] and isElement( MecanicoVeiculoCar[source] ) then			destroyElement( MecanicoVeiculoCar[source] ) 			MecanicoVeiculoCar[source] = nil 		end		MecanicoVeiculoCar[source] = createVehicle( 525, 194.37677, -1803.61316, 4.67829)		setElementRotation (MecanicoVeiculoCar[source], 0, 0, 270 )		setVehicleColor ( MecanicoVeiculoCar[source], 255, 255, 255 )		warpPedIntoVehicle ( source, MecanicoVeiculoCar[source] )		outputMessage ( "#ffffff[ Mecanico #ffffff] - #FFFFFFSeu Veiculo Foi Criado Com Sucesso", source, 255, 255, 255, true )	endendaddEvent( "Mecanico>CriarCarro",true)addEventHandler( "Mecanico>CriarCarro", root, MecanicoVeiculo )--------------------------------------------------------------------function DestruirMecanicoVeiculo ()	if isElement( MecanicoVeiculoCar[source] ) then		destroyElement ( MecanicoVeiculoCar[source] )		setElementData ( source, "mecanico:veiculo>ON", false )	endendaddEventHandler ( "onPlayerLogout", root, DestruirMecanicoVeiculo )addEventHandler ( "onPlayerQuit", root, DestruirMecanicoVeiculo )addEventHandler ( "onPlayerWasted", root, DestruirMecanicoVeiculo )addEvent ("Mecanico>DestruirCarro", true)addEventHandler ("Mecanico>DestruirCarro", getRootElement(), DestruirMecanicoVeiculo )function outputMessage (text, player, r, g, b)	return exports["[SCR]LIB"]:outputMessage(player, text, r, g, b);end--------------------------------------------------------------------

client.lua



 setElementData(localPlayer,"cliente:mecanico",nil)local screenW,screenH = guiGetScreenSize()local resW, resH = 1366,768local x, y = (screenW/resW), (screenH/resH)--------------------------------------------------------------------PainelMecanico = false--------------------------------------------------------------------function PainelMecanicoDX ()	dxDrawLine(x*430 - 1, y*205 - 1, x*430 - 1, y*563, tocolor(0, 0, 0, 255), x*1, false)	dxDrawLine(x*937, y*205 - 1, x*430 - 1, y*205 - 1, tocolor(0, 0, 0, 255), x*1, false)	dxDrawLine(x*430 - 1, y*563, x*937, y*563, tocolor(0, 0, 0, 255), x*1, false)	dxDrawLine(x*937, y*563, x*937, y*205 - 1, tocolor(0, 0, 0, 255), x*1, false)	dxDrawRectangle((screenW - x*507) / 2, (screenH - y*358) / 2, x*507, y*358, tocolor(0, 0, 0, 113), false)	dxDrawRectangle(x*430, y*205, x*507, y*31, tocolor(67, 225, 182, 113), false)  	dxDrawText("Emprego de Mecânico", x*429, y*204, x*937, y*236, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)	dxDrawText("X", x*906 + 1, y*204 + 1, x*937 + 1, y*236 + 1, tocolor(0, 0, 0, 255), x*1.00, "default-bold", "center", "center", false, false, false, false, false)	dxDrawText("X", x*906, y*204, x*937, y*236, tocolor(246, 182, 45, 255), x*1.00, "default-bold", "center", "center", false, false, false, false, false)	dxDrawRectangle(x*911, y*210, x*19, y*20, tocolor(0, 0, 0, 0), false)	if getElementData (localPlayer, "mecanico", true ) then		dxDrawText("Este é seu Trabalho Atualmente, Duvidas ? Leia os\nComandos de Sua Profissão Abaixo.", x*430, y*236, x*937, y*310, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)	else		dxDrawText("Este é o Emprego de Mecânico do Nosso Servidor, Ao Aceitar\no Emprego Você vai Virar Mecânico Automaticamente.", x*430, y*236, x*937, y*310, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)	end	dxDrawText("Comandos da Profissão", x*430, y*316, x*937, y*348, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)	dxDrawText("/Localizar Nick do Jogador\n/Deslocalizar\n/Reparar Nick do Jogador", x*430, y*354, x*937, y*428, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)	if getElementData (localPlayer, "mecanico", true ) then		dxDrawLine(x*524 - 1, y*482 - 1, x*524 - 1, y*507, tocolor(0, 0, 0, 255), x*1, false)		dxDrawLine(x*630, y*482 - 1, x*524 - 1, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)		dxDrawLine(x*524 - 1, y*507, x*630, y*507, tocolor(0, 0, 0, 255), x*1, false)		dxDrawLine(x*630, y*507, x*630, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)		dxDrawRectangle(x*524, y*482, x*106, y*25, tocolor(255, 72, 73, 105), false)		dxDrawText("Pedir Demissão", x*525, y*482, x*630, y*507, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)		dxDrawLine(x*736 - 1, y*482 - 1, x*736 - 1, y*507, tocolor(0, 0, 0, 255), x*1, false)		dxDrawLine(x*842, y*482 - 1, x*736 - 1, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)		dxDrawLine(x*736 - 1, y*507, x*842, y*507, tocolor(0, 0, 0, 255), x*1, false)		dxDrawLine(x*842, y*507, x*842, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)		dxDrawRectangle(x*736, y*482, x*106, y*25, tocolor(45, 237, 255, 105), false)		if getElementData (localPlayer, "mecanico:veiculo>ON", true ) then			dxDrawText("Destruir Veiculo", x*737, y*482, x*842, y*507, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)		else			dxDrawText("Criar Veiculo", x*737, y*482, x*842, y*507, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)		end	else		dxDrawLine(x*524 - 1, y*482 - 1, x*524 - 1, y*507, tocolor(0, 0, 0, 255), x*1, false)		dxDrawLine(x*630, y*482 - 1, x*524 - 1, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)		dxDrawLine(x*524 - 1, y*507, x*630, y*507, tocolor(0, 0, 0, 255), x*1, false)		dxDrawLine(x*630, y*507, x*630, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)		dxDrawRectangle(x*524, y*482, x*106, y*25, tocolor(89, 251, 77, 105), false)		dxDrawText("Aceitar", x*525, y*482, x*630, y*507, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)		dxDrawLine(x*736 - 1, y*482 - 1, x*736 - 1, y*507, tocolor(0, 0, 0, 255), x*1, false)		dxDrawLine(x*842, y*482 - 1, x*736 - 1, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)		dxDrawLine(x*736 - 1, y*507, x*842, y*507, tocolor(0, 0, 0, 255), x*1, false)		dxDrawLine(x*842, y*507, x*842, y*482 - 1, tocolor(0, 0, 0, 255), x*1, false)		dxDrawRectangle(x*736, y*482, x*106, y*25, tocolor(255, 72, 73, 105), false)		dxDrawText("Recusar", x*737, y*482, x*842, y*507, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)	endend--------------------------------------------------------------------function AbrirPainelMecanico ()	if PainelMecanico == false then		addEventHandler ( "onClientRender", root, PainelMecanicoDX )		showCursor ( true )		PainelMecanico = true	endendaddEvent ( "Abrir:PainelMecanico", true)addEventHandler ( "Abrir:PainelMecanico", root, AbrirPainelMecanico )function FecharPainelMecanico ()	if PainelMecanico == true then		removeEventHandler ( "onClientRender", root, PainelMecanicoDX )		showCursor ( false )		PainelMecanico = false		playSoundFrontEnd ( 40 )	endendaddEvent ( "Fechar:PainelMecanico", true)addEventHandler ( "Fechar:PainelMecanico", root, FecharPainelMecanico )--------------------------------------------------------------------function FecharXMC (_,state)	if PainelMecanico == true then		if state == "down" then			if isCursorOnElement ( x*911, y*210, x*19, y*20 ) then				removeEventHandler ( "onClientRender", root, PainelMecanicoDX )				showCursor ( false )				PainelMecanico = false				playSoundFrontEnd ( 40 )			end		end	endendaddEventHandler ( "onClientClick", root, FecharXMC )--------------------------------------------------------------------function DemissaoMecanico (_,state)	if PainelMecanico == true then		if state == "down" then			if isCursorOnElement ( x*524, y*482, x*106, y*25 ) then				if getElementData (localPlayer, "mecanico", true ) then					removeEventHandler ( "onClientRender", root, PainelMecanicoDX )					setElementData (localPlayer, "mecanico", false )					outputChatBox ( "#ffffff[ Mecanico #ffffff] - Você Pediu Demissão", 255, 255, 255, true )					triggerServerEvent ( "Mecanico>Demitirse", localPlayer )					triggerServerEvent ( "Mecanico>DestruirCarro", localPlayer )					showCursor ( false )					PainelMecanico = false					playSoundFrontEnd ( 40 )				end			end		end	endendaddEventHandler ( "onClientClick", root, DemissaoMecanico )--------------------------------------------------------------------function AceitarMecanico (_,state)	if PainelMecanico == true then		if state == "down" then			if isCursorOnElement ( x*524, y*482, x*106, y*25 ) then				if not getElementData (localPlayer, "mecanico", false ) then					removeEventHandler ( "onClientRender", root, PainelMecanicoDX )					setElementData (localPlayer, "mecanico", true )					outputChatBox ( "#ffffff[ Mecanico #ffffff] - Você Agora é um Mecanico", 255, 255, 255, true )					triggerServerEvent ( "Mecanico>Aceitar", localPlayer )					showCursor ( false )					PainelMecanico = false					playSoundFrontEnd ( 40 )				end			end		end	endendaddEventHandler ( "onClientClick", root, AceitarMecanico )--------------------------------------------------------------------function RecusarMecanico (_,state)	if PainelMecanico == true then		if state == "down" then			if isCursorOnElement ( x*736, y*482, x*106, y*25 ) then				if not getElementData (localPlayer, "mecanico", true ) then					removeEventHandler ( "onClientRender", root, PainelMecanicoDX )					setElementData (localPlayer, "mecanico", false )					outputChatBox ( "#ffffff[ Mecanico #ffffff] - Você Recusou o Emprego de Mecanico", 255, 255, 255, true )					showCursor ( false )					PainelMecanico = false					playSoundFrontEnd ( 40 )				end			end		end	endendaddEventHandler ( "onClientClick", root, RecusarMecanico )--------------------------------------------------------------------function CriareDestruirVeh (_,state)	if PainelMecanico == true then		if state == "down" then			if isCursorOnElement ( x*736, y*482, x*106, y*25 ) then				if getElementData (localPlayer, "mecanico", true ) then					removeEventHandler ( "onClientRender", root, PainelMecanicoDX )					showCursor ( false )					PainelMecanico = false					playSoundFrontEnd ( 40 )					if getElementData (localPlayer, "mecanico:veiculo>ON", true ) then						triggerServerEvent ( "Mecanico>DestruirCarro", localPlayer )						outputChatBox("#ffffff[ Mecanico #ffffff] - #FFFFFFSeu Veiculo Foi Destruido com Sucesso", 255, 255, 255, true )							setElementData ( localPlayer, "mecanico:veiculo>ON", false )					else						triggerServerEvent ( "Mecanico>CriarCarro", localPlayer )						setElementData ( localPlayer, "mecanico:veiculo>ON", true )					end				end			end		end	endendaddEventHandler ( "onClientClick", root, CriareDestruirVeh )--------------------------------------------------------------------function localizarMecanico(cn,name)	local jobMecanico = getElementData(localPlayer,"mecanico") or false	if type(jobMecanico) == "boolean" then		if jobMecanico == true then			if type(name) == "string" then				local player = getPlayerFromPartialName(name)				if isElement(player) then					if isElement(testeMecanico) then						destroyElement(testeMecanico)					end					testeMecanico = createBlipAttachedTo(player,61,2,255,255,255,255,0,999999)					outputChatBox("#ffffff[ Mecanico #ffffff] - #FFFFFFO Jogador #ffffff"..getPlayerName(player).." #ffffffFoi Localizado",255,255,255,true)					outputChatBox("#ffffff[ Mecanico #ffffff] - #FFFFFFPara Desmarcar O Jogador do Mapa Digite /Deslocalizar",255,255,255,true)					else					outputChatBox("#ffffff[ Mecanico #ffffff] - #FFFFFFJogador Não Encontrado",255,255,255,true)				end			else				outputChatBox("#ffffff[ Mecanico #ffffff] - #FFFFFFDigite /Localizar Nick",255,255,255,true)			end				end	endendaddCommandHandler("localizar",localizarMecanico)--------------------------------------------------------------------function deslocalizar(cn,name)	if isElement(testeMecanico) then		destroyElement(testeMecanico)		outputChatBox("#ffffff[ Mecanico #ffffff] - #FFFFFFJogador Deslocalizado Com Sucesso",255,255,255,true)	endendaddCommandHandler("deslocalizar",deslocalizar)--------------------------------------------------------------------function QuebradoMec ( )	outputChatBox ( "#ffffff[ Aviso #ffffff] - Seu Veiculo Esta Quebrado, Chame Por um Mecanico", 255, 255, 255, true )	outputChatBox ( "#ffffff[ Aviso #ffffff] - Digite /Mecanico & Aguarde no Local", 255, 255, 255, true )endaddEvent( "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	endend--------------------------------------------------------------------function isCursorOnElement( x,y,w,h )	local mx,my = getCursorPosition ()	local fullx,fully = guiGetScreenSize()	cursorx,cursory = mx*fullx,my*fully	if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then		return true	else		return false	endend--------------------------------------------------------------------

Agora sim está indentado.

 

Obrigado amigo irei aguarda sua resposta irei fazer aqui, bom ne so a parte de localizar não é também a parte de reparar a localizar ja tenho no celular nem precisa o problema mesmo é reparar

Desculpa comenta aqui novamente em baixo de outro tópico mas queria informa que achei uma coisa porem não estou conseguindo arruma creio que seja o problema de todo esse acontecimento ./debugscript 3 comando /reparar erro: linha: 250 @Lord Henry

Linha do Erro:

Spoiler

	return exports("[SCR]LIB"):outputMessage(player, text, r, g, b);

 

Codigo:

Spoiler

function outputMessage (text, player, r, g, b)
	return exports("[SCR]LIB"):outputMessage(player, text, r, g, b);
end

 

 

Link to comment
1 hour ago, Jonas^ said:

Você esta usando outro script junto com esse né? tem certeza que ele ta ligado?

Estou usando apenas ele tentei muda aqui mas não da da outro erro, estou aqui tentando dês de 7hrs da manhã ate agora só nisso ai mano ta complicado! Preciso muito disso

Erro:

Spoiler

[2019-03-27 16:21:10] WARNING: [Scripts]Mecanico\server.lua:250: Bad argument @ 'call' [Expected resource-data at argument 1, got string '[SCR]LIB']
[2019-03-27 16:21:10] ERROR: [Scripts]Mecanico\server.lua:250: attempt to index a boolean value

 

 

Linha do Erro:

Spoiler

return call("[SCR]LIB"):outputMessage(player, text, r, g, b);

 

Codigo:

Spoiler

function outputMessage (text, player, r, g, b)
    return call("[SCR]LIB"):outputMessage(player, text, r, g, b);

end

 

 

Link to comment

Amigo o erro parou só esta dando mensagem de WARNING na mesma linha e não esta reparando o carro quando uso /reparar matheus da a mensagem de WARNING @DNL291

Spoiler

[2019-03-27 18:07:12] WARNING: [Scripts]Mecanico\server.lua:257: Bad argument @ 'call' [Expected resource-data at argument 1, got boolean]
[2019-03-27 18:07:26] WARNING: [Scripts]Mecanico\server.lua:257: Bad argument @ 'call' [Expected resource-data at argument 1, got boolean]
[2019-03-27 18:07:33] WARNING: [Scripts]Mecanico\server.lua:257: Bad argument @ 'call' [Expected resource-data at argument 1, got boolean]
[2019-03-27 18:07:43] WARNING: [Scripts]Mecanico\server.lua:257: Bad argument @ 'call' [Expected resource-data at argument 1, got boolean]
[2019-03-27 18:07:47] WARNING: [Scripts]Mecanico\server.lua:257: Bad argument @ 'call' [Expected resource-data at argument 1, got boolean]
[2019-03-27 18:07:53] WARNING: [Scripts]Mecanico\server.lua:257: Bad argument @ 'call' [Expected resource-data at argument 1, got boolean]  [DUP x2]
[2019-03-27 18:07:53] WARNING: [Scripts]Mecanico\server.lua:257: Bad argument @ 'call' [Expected resource-data at argument 1, got boolean]

 

Este é o código correto que veio junto com os código, Porem da erro!

Spoiler

function outputMessage (text, player, r, g, b)
    return exports["[SCR]LIB"]:outputMessage(player, text, r, g, b);
end

 

Erro:

Spoiler

[2019-03-27 18:22:45] ERROR: [Scripts]Mecanico\server.lua:257: exports: Call to non-running server resource ([SCR]LIB) [string "?"]

 

 

Edited by zTokyoGamer
Link to comment
  • DNL291 locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...