Jump to content

[AYUDA] Que esta mal de esto? CORREGIDLO Porfavor!!


Digore

Recommended Posts

fading = 0 
fading2 = "up" 
local screenWidth,screenHeight = guiGetScreenSize() 
function updateIcons () 
if getElementData(getLocalPlayer(),"logedin") then 
    --fading 
    if fading >= 0 and fading2 == "up" then 
        fading = fading + 5 
    elseif fading <= 255 and fading2 == "down" then 
        fading = fading - 5 
    end 
    --fading math. 
    if fading == 0 then 
        fading2 = "up" 
    elseif fading == 255 then 
        fading2 = "down" 
    end 
  
local x,y,z = getElementPosition(getLocalPlayer()) 
    for i,player in ipairs(getElementsByType("player")) do 
        setPlayerNametagShowing ( player, false ) 
        if player ~= getLocalPlayer() then 
        local vehicle = getPedOccupiedVehicle(player) 
                local px,py,pz = getElementPosition (player) 
                local pdistance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) 
                if pdistance <= 2 then 
                    --Get screenposition 
                    local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 ) 
                    if sx and sy then 
                    --Draw Name 
                    if getElementData(player,"bandit") then 
                        text = string.gsub(getPlayerName(player), '#%x%x%x%x%x%x', '' ).." (Bandit)" 
                    else 
                        text = string.gsub(getPlayerName(player), '#%x%x%x%x%x%x', '' ) 
                    end 
                    local w = dxGetTextWidth(text,1.02,"default-bold") 
                    dxDrawText (text, sx-(w/2), sy, sx-(w/2), sy, tocolor ( 100, 255, 100, 200 ), 1.02, "default-bold" ) 
                    end 
                end 
        end      
    end 
    --Vehicletags 
    local x,y,z = getElementPosition(getLocalPlayer()) 
    for i,veh in ipairs(getElementsByType("vehicle")) do 
                local px,py,pz = getElementPosition (veh) 
                local vehID = getElementModel(veh) 
                local vehicle = getPedOccupiedVehicle(getLocalPlayer()) 
                if veh ~= vehicle then 
                if vehID ~= 548 then 
                local pdistance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) 
                if pdistance <= 6 then 
                    --Get screenposition 
                    local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 ) 
                    if sx and sy then 
                    --Draw Vehicle 
                    local w = dxGetTextWidth(getVehicleName(veh),1.02,"default-bold") 
                    dxDrawText ( getVehicleName(veh), sx-(w/2), sy, sx-(w/2), sy, tocolor ( 100, 255, 100, 200 ), 1.02, "default-bold" )     
                    end 
                end 
                end 
                end 
    end 
    --Vehicle Infos 
    local veh = getPedOccupiedVehicle (getLocalPlayer()) 
    if veh then 
        local maxfuel = getElementData(veh, "maxfuel") 
        local fuel = getElementData(getElementData(veh, "parent"), "fuel") 
        local tires,engine,parts = getVehicleAddonInfos (getElementModel(veh)) 
        local needengine = getElementData(veh, "needengines") 
        local needtires = getElementData(veh, "needtires") 
        local needparts = getElementData(veh, "needparts")               
        local engine = getElementData(getElementData(veh, "parent"), "Engine_inVehicle") or 0 
        local tires = getElementData(getElementData(veh, "parent"), "Tire_inVehicle") or 0 
        local parts = getElementData(getElementData(veh, "parent"), "Parts_inVehicle") or 0 
        local offset = dxGetFontHeight(1.02, "default-bold") 
        local w = dxGetTextWidth(engine .. "/" .. needengine .. " Engine", 1.02, "default-bold") 
        if engine == needengine then 
        dxDrawRectangle(34, 214, 60, 13, tocolor(89, 161, 58, 255)) -- MOTOR 
              dxDrawText ("Motor",36,214,5,5,tocolor ( 0,0,0, 231 ), 0.9, "default-bold" ) 
            r,g,b = 0,255,0 
        else 
           dxDrawRectangle(34, 214, 60, 13, tocolor(171, 16, 3, 255)) -- MOTOR 
              dxDrawText ("Motor",36,214,5,5,tocolor ( 0,0,0, 231 ), 0.9, "default-bold" ) 
            r,g,b = 255,0,0 
        end 
        dxDrawText(engine .. "/" .. needengine .. " Engine", screenWidth * 0.5 - w / 2, screenHeight * 0, screenWidth * 0.5 - w / 2, screenHeight * 0, tocolor(r, g, b, 220), 1.02, "default-bold") 
        local w = dxGetTextWidth(tires .. "/" .. needtires .. " Tires", 1.02, "default-bold") 
        if tires == needtires then 
        dxDrawRectangle(34, 234, 60, 13, tocolor(89, 161, 58, 255)) -- RUEDA 
         dxDrawText ("Rueda",36,234,5,5,tocolor ( 0,0,0, 231 ), 0.9, "default-bold" ) 
            r,g,b = 0,255,0 
        else 
        dxDrawRectangle(34, 234, 60, 13, tocolor(171,15,5, 255)) -- RUEDA 
         dxDrawText ("Rueda",36,234,5,5,tocolor ( 0,0,0, 231 ), 0.9, "default-bold" ) 
            r,g,b = 255,0,0 
        end 
        dxDrawText(tires .. "/" .. needtires .. " Tires", screenWidth * 0.5 - w / 2, screenHeight * 0 + offset, screenWidth * 0.5 - w / 2, screenHeight * 0 + offset, tocolor(r, g, b, 220), 1.02, "default-bold") 
        local w = dxGetTextWidth(parts .. "/" .. needparts .. " Tank Parts", 1.02, "default-bold") 
            if parts == needparts then 
            dxDrawRectangle(34, 254, 60, 13, tocolor(89, 161, 58, 255)) -- DEPOSITO  
         dxDrawText ("Depósito",36,254,5,5,tocolor ( 0,0,0, 231 ), 0.9, "default-bold" ) 
                r,g,b = 0,255,0 
            else 
            dxDrawRectangle(34, 254, 60, 13, tocolor(171,15,5, 255)) -- DEPOSITO 
         dxDrawText ("Depósito",36,254,5,5,tocolor ( 0,0,0, 231 ), 0.9, "default-bold" ) 
                r,g,b = 255,0,0 
            end 
            dxDrawText (parts.."/"..needparts.." Depósito",screenWidth*0.5-w/2 , screenHeight*0.08,screenWidth*0.5-w/2 , screenHeight*1+offset, tocolor (r,g,b, 0 ) , 1.02, "default-bold" ) 
        local w = dxGetTextWidth("Fuel:"..math.floor(fuel).."/"..maxfuel,1.02,"default-bold") 
        if fuel == maxfuel then 
        dxDrawRectangle(15, 213, 13, 115, tocolor(0, 0, 0, 150), true) ------fundo 
        dxDrawRectangle(16, 214, 10, 115, tocolor(78, 138, 51, 255), true) --100% 
            r,g,b = 0,255,0 
        elseif getElementData(getElementData(veh,"parent"),"fuel") <= 0 then 
            dxDrawRectangle(15, 213, 13, 115, tocolor(100, 0, 0, 150), true) ------fundo 
            setVehicleEngineState(veh, false) 
            r,g,b = 255,0,255    
        elseif fuel <= maxfuel/10 then 
            dxDrawRectangle(15, 213, 13, 115, tocolor(0, 0, 0, 150), true) ------fundo 
            dxDrawRectangle(16, 315, 10, 14.5, tocolor(171,55,5, 255), true) --20% 
            r,g,b = 255,0,0  
        elseif fuel <= maxfuel/4 then 
            dxDrawRectangle(15, 213, 13, 115, tocolor(0, 0, 0, 150), true) ------fundo 
             dxDrawRectangle(16, 308, 10, 19, tocolor(171,15,5, 255), true) --20% 
            r,g,b = 255,50,0     
        elseif fuel <= maxfuel/3 then 
            dxDrawRectangle(15, 213, 13, 115, tocolor(0, 0, 0, 150), true) ------fundo 
            dxDrawRectangle(16, 308, 10, 19, tocolor(141, 161, 59, 255), true) --20% 
            r,g,b = 200,100,0 
        elseif fuel <= maxfuel/2 then 
            dxDrawRectangle(15, 213, 13, 115, tocolor(0, 0, 0, 150), true) ------fundo 
         dxDrawRectangle(16, 290, 10, 39, tocolor(91, 161, 59, 255), true) --40% 
            r,g,b = 125,200,0        
        elseif fuel <= maxfuel/1.5  then  
            dxDrawRectangle(15, 213, 13, 115, tocolor(0, 0, 0, 150), true) ------fundo 
            dxDrawRectangle(16, 251, 10, 76, tocolor(83, 150, 54, 255), true) -- 80% 
            r,g,b = 50,200,0 
        elseif fuel <= maxfuel/0  then  
            dxDrawRectangle(15, 213, 13, 115, tocolor(0, 0, 0, 150), true) ------fundo 
            dxDrawRectangle(16, 233, 10, 95, tocolor(78, 138, 51, 255), true) --90% 
            r,g,b = 50,200,0             
        end 
  
        dxDrawLine(16, 251, 26, 251, tocolor(42, 109, 5, 210), 1, true) 
        dxDrawLine(16, 290, 26, 290, tocolor(42, 109, 5, 203), 1, true) 
        dxDrawLine(14, 233, 19, 233, tocolor(42, 179, 5, 255), 1, true) 
        dxDrawLine(14, 271, 19, 271, tocolor(42, 179, 5, 255), 1, true) 
        dxDrawLine(14, 307, 19, 307, tocolor(42, 179, 5, 255), 1, true) 
        dxDrawLine(26, 215, 26, 327, tocolor(75, 137, 48, 255), 2, true) 
        dxDrawLine(17, 215, 16, 327, tocolor(75, 137, 48, 255), 2, true) 
        dxDrawLine(15.5, 215, 27, 215, tocolor(102, 179, 50, 255), 2, true) 
        dxDrawLine(15.5, 327, 27, 327.3, tocolor(102, 179, 50, 255), 2, true) 
   
    --  dxDrawText ("Fuel:"..math.floor(fuel).."/"..maxfuel,screenWidth*0.5-w/2 , screenHeight*0+offset*2,screenWidth*0.5-w/2 , screenHeight*0+offset*2,tocolor ( r,g,b, 200 ), 1.02, "default-bold" ) 
    end 
    if not playerTarget then return end 
        local x,y,z = getElementPosition(playerTarget) 
        local x,y,distance = getScreenFromWorldPosition (x,y,z+0.5) 
        distance = 20 
        if getElementData(playerTarget,"bandit") then 
            text = string.gsub(getPlayerName(playerTarget), '#%x%x%x%x%x%x', '' ).." (Bandit)" 
        else 
            text = string.gsub(getPlayerName(playerTarget), '#%x%x%x%x%x%x', '' ) 
        end 
        local w = dxGetTextWidth(text,distance*0.033,"default-bold") 
        dxDrawText (text,x-(w/2),y,x-(w/2), y, tocolor ( 100, 255, 100, 200 ), distance*0.033, "default-bold" ) 
         
end  
end 
addEventHandler ( "onClientRender", getRootElement(), updateIcons ) 
  
-- vermelho  171,15,3 
-- verde fuel 89,161,58 
-- escuro 78,138,51 
-- meio 83,145,54 
-- claro 91,161,59 
-- linha 64,117,41 
-- linha meio 39,74,27 
  
  
  
  
local screenWidth, screenHeight = guiGetScreenSize()  
local lineColor = tocolor(105, 200, 100) 
local lineColorH = tocolor(31, 231, 31) 
function drawLinesAcrossScreen() 
    --[[ dxDrawRectangle( screenWidth*0.017, screenHeight*0.232, screenWidth*0.0065, screenHeight*0.136, tocolor(92, 146, 56)) 
    dxDrawRectangle( screenWidth*0.017, screenHeight*0.252, screenWidth*0.0065, screenHeight*0.116, tocolor(98, 130, 50))  
    dxDrawRectangle( screenWidth*0.017, screenHeight*0.275, screenWidth*0.0065, screenHeight*0.093, tocolor(106, 120, 45))  
dxDrawRectangle( screenWidth*0.017, screenHeight*0.30, screenWidth*0.0065, screenHeight*0.068, tocolor(112, 110, 40)) 
dxDrawRectangle( screenWidth*0.017, screenHeight*0.3249, screenWidth*0.0065, screenHeight*0.043, tocolor(118, 100, 35))  
    dxDrawRectangle( screenWidth*0.017, screenHeight*0.3458, screenWidth*0.0065, screenHeight*0.024, tocolor(124, 90, 30)) 
     
       dxDrawRectangle(34, 226, 25, 13, tocolor(89, 161, 58, 255)) -- ENG 
              dxDrawText ("ENG",36,226,5,5,tocolor ( 0,0,0, 231 ), 0.9, "default-bold" ) 
         
        dxDrawRectangle(34, 249, 25, 13, tocolor(89, 161, 58, 255)) -- TIRE 
         dxDrawText ("TIRE",36,250,5,5,tocolor ( 0,0,0, 231 ), 0.9, "default-bold" ) 
        dxDrawRectangle(34, 272, 25, 13, tocolor(89, 161, 58, 255)) -- TKP   
         dxDrawText ("TKP",36,272,5,5,tocolor ( 0,0,0, 231 ), 0.9, "default-bold" ) 
  
     
     dxDrawRectangle(15, 213, 13, 115, tocolor(0, 0, 0, 150), true) ------fundo 
     
        dxDrawRectangle(15, 213, 13, 115, tocolor(0, 0, 0, 150), true)   --vazio 
      dxDrawRectangle(16, 214, 10, 115, tocolor(78, 138, 51, 255), true) --100% 
       
        dxDrawRectangle(16, 251, 10, 76, tocolor(83, 150, 54, 255), true) -- 80% 
        dxDrawRectangle(16, 290, 10, 39, tocolor(91, 161, 59, 255), true) --40% 
       dxDrawRectangle(16, 308, 10, 19, tocolor(141, 161, 59, 255), true) --20% ]]-- 
  
--[[        
     
        dxDrawLine(16, 251, 26, 251, tocolor(42, 109, 5, 210), 1, true) 
        dxDrawLine(16, 290, 26, 290, tocolor(42, 109, 5, 203), 1, true) 
         dxDrawLine(14, 233, 19, 233, tocolor(42, 179, 5, 255), 1, true) 
        dxDrawLine(14, 271, 19, 271, tocolor(42, 179, 5, 255), 1, true) 
        dxDrawLine(14, 307, 19, 307, tocolor(42, 179, 5, 255), 1, true) 
         dxDrawLine(26, 215, 26, 327, tocolor(75, 137, 48, 255), 2, true) 
        dxDrawLine(17, 215, 16, 326, tocolor(75, 137, 48, 255), 2, true) 
        dxDrawLine(15.5, 215, 27, 215, tocolor(102, 179, 50, 255), 2, true) 
        dxDrawLine(15.5, 327, 27, 327.3, tocolor(102, 179, 50, 255), 2, true) 
   
         
         
  
dxDrawLine( screenWidth*0.016, screenHeight*0.23, screenWidth*0.016, screenHeight*0.37, tocolor(201, 43, 70), 1) 
 dxDrawLine( screenWidth*0.024, screenHeight*0.23, screenWidth*0.024, screenHeight*0.37, tocolor(201, 43, 7), 1) 
    dxDrawLine( screenWidth*0.0155, screenHeight*0.23, screenWidth*0.0155, screenHeight*0.37, tocolor(108, 168, 66), 2) 
    dxDrawLine( screenWidth*0.0239, screenHeight*0.23, screenWidth*0.0239, screenHeight*0.37, tocolor(108, 168, 66), 2) 
dxDrawLine( screenWidth*0.0235, screenHeight*0.229, screenWidth*0.015, screenHeight*0.229, tocolor(108, 168, 66), 2) 
    dxDrawLine( screenWidth*0.0249, screenHeight*0.231, screenWidth*0.015, screenHeight*0.231, tocolor(31, 43, 7), 1) 
    dxDrawLine( screenWidth*0.0235, screenHeight*0.368, screenWidth*0.015, screenHeight*0.368, tocolor(21, 43, 7), 1) 
dxDrawLine( screenWidth*0.0235, screenHeight*0.37, screenWidth*0.015, screenHeight*0.37, tocolor(108, 168, 66), 2) 
    dxDrawLine( screenWidth*0.0235, screenHeight*0.275, screenWidth*0.015, screenHeight*0.275, tocolor(31, 31, 31), 1) 
    dxDrawLine( screenWidth*0.0235, screenHeight*0.325, screenWidth*0.015, screenHeight*0.325, tocolor(31, 31, 31, 200), 1) 
    dxDrawLine( screenWidth*0.015, screenHeight*0.252, screenWidth*0.018, screenHeight*0.252, tocolor(10, 10, 10), 1) 
    dxDrawLine( screenWidth*0.0262, screenHeight*0.252, screenWidth*0.024, screenHeight*0.252, tocolor(108, 168, 66), 1) 
    dxDrawLine( screenWidth*0.015, screenHeight*0.3, screenWidth*0.018, screenHeight*0.3, tocolor(31, 10, 10), 1) 
    dxDrawLine( screenWidth*0.0262, screenHeight*0.3, screenWidth*0.024, screenHeight*0.3, tocolor(108, 168, 66), 1) 
    dxDrawLine( screenWidth*0.015, screenHeight*0.346, screenWidth*0.018, screenHeight*0.346, tocolor(50, 10, 12), 1) 
    dxDrawLine( screenWidth*0.0262, screenHeight*0.346, screenWidth*0.024, screenHeight*0.346, tocolor(108, 168, 66), 1) 
    ]]-- 
end 
addEventHandler("onClientRender", root, drawLinesAcrossScreen) 

Edited by Guest
Link to comment
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...