Jump to content

Hud


Xperia

Recommended Posts

Tengo un hud hecho, y en ese script, en client side, quiero quitarlo, pero al reconectar, el hud vuelve.¿Que le hago?

function quitar() 
    showPlayerHudComponent ( "armour", false ) 
    showPlayerHudComponent ( "health", false ) 
    showPlayerHudComponent ( "money", false ) 
    showPlayerHudComponent ( "clock", false ) 
    showPlayerHudComponent ( "weapon", false ) 
    showPlayerHudComponent ( "ammo", false) 
    showPlayerHudComponent ( "money", false ) 
    showPlayerHudComponent ( "wanted", false ) 
    showPlayerHudComponent ( "radar", true ) 
end  
addEventHandler("onClientResourceStart",getRootElement(),quitar) 

Link to comment
function quitar ( ) 
    showPlayerHudComponent ( "armour", false ) 
    showPlayerHudComponent ( "health", false ) 
    showPlayerHudComponent ( "money", false ) 
    showPlayerHudComponent ( "clock", false ) 
    showPlayerHudComponent ( "weapon", false ) 
    showPlayerHudComponent ( "ammo", false) 
    showPlayerHudComponent ( "money", false ) 
    showPlayerHudComponent ( "wanted", false ) 
    showPlayerHudComponent ( "radar", true ) 
end  
addEventHandler ( "onClientPlayerSpawn", localPlayer, quitar ) 

Link to comment

Probalo asi de nuevo.

function quitar ( ) 
    showPlayerHudComponent (source, "armour", false ) 
    showPlayerHudComponent (source, "health", false ) 
    showPlayerHudComponent (source, "money", false ) 
    showPlayerHudComponent (source, "clock", false ) 
    showPlayerHudComponent (source, "weapon", false ) 
    showPlayerHudComponent (source, "ammo", false) 
    showPlayerHudComponent (source, "money", false ) 
    showPlayerHudComponent (source, "wanted", false ) 
    showPlayerHudComponent (source, "radar", true ) 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), quitar ) 

Edited by Guest
Link to comment
Probalo asi de nuevo.
function quitar ( ) 
    showPlayerHudComponent (source, "armour", false ) 
    showPlayerHudComponent (source, "health", false ) 
    showPlayerHudComponent (source, "money", false ) 
    showPlayerHudComponent (source, "clock", false ) 
    showPlayerHudComponent (source, "weapon", false ) 
    showPlayerHudComponent (source, "ammo", false) 
    showPlayerHudComponent (source, "money", false ) 
    showPlayerHudComponent (source, "wanted", false ) 
    showPlayerHudComponent (source, "radar", true ) 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), quitar ) 

Probalo asi ahora.

Link to comment
function speed ( ) 
    addEventHandler ( "onClientRender", root, getspeed ) 
end 
addEventHandler ("onClientVehicleEnter", root, speed) 
  
function wylacz ( ) 
  
    removeEventHandler ( "onClientRender", root, getspeed ) 
end 
addEventHandler("onClientVehicleExit", root, wylacz) 
  
  
addEventHandler("onClientRender",getRootElement(), 
    function ( ) 
        weaponID = getPedWeapon(getLocalPlayer()) 
        weapName = getWeaponNameFromID(weaponID) 
        health = getElementHealth (localPlayer) 
        dxDrawText("Player Health: "..tostring(math.floor(health+0.5)).." %",20.0,264.0,296.0,280.0,tocolor(0,255,0,255),0.5,"bankgothic","left","top",false,false,false) 
        dxDrawText("Weapon Name: "..weapName,20.0,285.0,296.0,301.0,tocolor(0,255,0,255),0.5,"bankgothic","left","top",false,false,false) 
        if isPedInVehicle (localPlayer) == false then return end 
        Vname = getVehicleName(getPedOccupiedVehicle(localPlayer)) 
        health = getElementHealth (getPedOccupiedVehicle(localPlayer)) 
        sx, sy, sz = getElementVelocity (getPedOccupiedVehicle(localPlayer)) 
        kmhs = math.floor(((sx^2 + sy^2 + sz^2)^(0.5))*180) 
        dxDrawText("Vehicle Name: "..Vname,20.0,307.0,296.0,323.0,tocolor(0,255,0,255),0.5,"bankgothic","left","top",false,false,false) 
        dxDrawText("Vehicle Health: "..tostring(math.floor(health*0.1)).." %",20.0,328.0,296.0,344.0,tocolor(0,255,0,255),0.5,"bankgothic","left","top",false,false,false) 
        dxDrawText("Speed: "..tostring(kmhs).." Km/h",20.0,348.0,296.0,364.0,tocolor(0,255,0,255),0.5,"bankgothic","left","top",false,false,false) 
    end 
) 
  
function quitar ( ) 
    showPlayerHudComponent ( "armour", false ) 
    showPlayerHudComponent ( "health", false ) 
    showPlayerHudComponent ( "money", false ) 
    showPlayerHudComponent ( "clock", false ) 
    showPlayerHudComponent ( "weapon", false ) 
    showPlayerHudComponent ( "ammo", false) 
    showPlayerHudComponent ( "money", false ) 
    showPlayerHudComponent ( "wanted", false ) 
    showPlayerHudComponent ( "radar", true ) 
end 
addEventHandler ( "onClientPlayerSpawn", localPlayer, quitar ) 

EDIT: Uso el spawn de 50p.

Link to comment
Si usas el spawn de 50p , editaste el "c_main" para que no aparescan los elementos?.

Este post fue un poco "fail", al parecer lo tenia bien, pense que el spawn de 50p afectaba pero me entro en una oreja y me salio por otra.Igualmente, ya me funciona, gracias Solid y NOD.

Link to comment
function speed ( ) 
    addEventHandler ( "onClientRender", root, getspeed ) 
end 
addEventHandler ("onClientVehicleEnter", root, speed) 
  
function wylacz ( ) 
  
    removeEventHandler ( "onClientRender", root, getspeed ) 
end 
addEventHandler("onClientVehicleExit", root, wylacz) 
  
addEventHandler("onClientRender",getRootElement(), 
    function ( ) 
        weaponID = getPedWeapon(getLocalPlayer()) 
        weapName = getWeaponNameFromID(weaponID) 
        health = getElementHealth (localPlayer) 
        dxDrawText("Player Health: "..tostring(math.floor(health+0.5)).." %",20.0,264.0,296.0,280.0,tocolor(0,255,0,255),0.5,"bankgothic","left","top",false,false,false) 
        dxDrawText("Weapon Name: "..weapName,20.0,285.0,296.0,301.0,tocolor(0,255,0,255),0.5,"bankgothic","left","top",false,false,false) 
        if isPedInVehicle (localPlayer) == false then return end 
        Vname = getVehicleName(getPedOccupiedVehicle(localPlayer)) 
        health = getElementHealth (getPedOccupiedVehicle(localPlayer)) 
        sx, sy, sz = getElementVelocity (getPedOccupiedVehicle(localPlayer)) 
        kmhs = math.floor(((sx^2 + sy^2 + sz^2)^(0.5))*180) 
        dxDrawText("Vehicle Name: "..Vname,20.0,307.0,296.0,323.0,tocolor(0,255,0,255),0.5,"bankgothic","left","top",false,false,false) 
        dxDrawText("Vehicle Health: "..tostring(math.floor(health*0.1)).." %",20.0,328.0,296.0,344.0,tocolor(0,255,0,255),0.5,"bankgothic","left","top",false,false,false) 
        dxDrawText("Speed: "..tostring(kmhs).." Km/h",20.0,348.0,296.0,364.0,tocolor(0,255,0,255),0.5,"bankgothic","left","top",false,false,false) 
    end 
) 
  
function quitar ( ) 
    setTimer ( 
        function ( ) 
            for _, component in ipairs ( { "armour", "health", "money", "clock", "weapon", "ammo", "money", "wanted", "radar" } ) do 
                showPlayerHudComponent ( component, false ) 
            end 
        end 
        ,5000, 1 
    ) 
end 
addEventHandler ( "onClientPlayerSpawn", localPlayer, quitar ) 

Lo ocultara 5 segundos despues de spawnear.

Link to comment
function quitar() 
    showPlayerHudComponent ( "armour", false ) 
    showPlayerHudComponent ( "health", false ) 
    showPlayerHudComponent ( "money", false ) 
    showPlayerHudComponent ( "clock", false ) 
    showPlayerHudComponent ( "weapon", false ) 
    showPlayerHudComponent ( "ammo", false) 
    showPlayerHudComponent ( "money", false ) 
    showPlayerHudComponent ( "wanted", false ) 
    showPlayerHudComponent ( "radar", true ) 
end  
addEventHandler("onClientPlayerJoin",getLocalPlayer(),quitar) 
addEventHandler("onClientPlayerWasted",getLocalPlayer(),quitar) 
addEventHandler("onClientPlayerSpawn",getLocalPlayer(),quitar) 

intenta eso y cuando reinicies script matate..

Deberia funcionar

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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