Jump to content

Need some help here?


Xierra

Recommended Posts

Posted

Hi there, I started working back on the Alternate HUD.

Since I got lots of "if" "elseif" and "else" commands I got a bit stuck at this:

How to remove all part of the alternate HUD by just using a command?

Script:

  
-- Made By XX3, from scratch with MS Notepad. Purpose: To make a new exotic compact HUD. 
-- You may edit this resource, but please credit me if you wanted to post an edited / extended version.  
  
-- Weapon tables for ammo. 
    local noreloadweapons = {} --Weapons that doesn't reload (including the flamethrower, minigun, which doesn't have reload anim). 
    noreloadweapons[16] = true 
    noreloadweapons[17] = true 
    noreloadweapons[18] = true 
    noreloadweapons[19] = true 
    noreloadweapons[25] = true 
    noreloadweapons[33] = true 
    noreloadweapons[34] = true 
    noreloadweapons[35] = true 
    noreloadweapons[36] = true 
    noreloadweapons[37] = true 
    noreloadweapons[38] = true 
    noreloadweapons[39] = true 
    noreloadweapons[41] = true 
    noreloadweapons[42] = true 
    noreloadweapons[43] = true 
  
    local meleespecialweapons = {} --Weapons that don't shoot, and special weapons. 
    meleespecialweapons[0] = true 
    meleespecialweapons[1] = true 
    meleespecialweapons[2] = true 
    meleespecialweapons[3] = true 
    meleespecialweapons[4] = true 
    meleespecialweapons[5] = true 
    meleespecialweapons[6] = true 
    meleespecialweapons[7] = true 
    meleespecialweapons[8] = true 
    meleespecialweapons[9] = true 
    meleespecialweapons[10] = true 
    meleespecialweapons[11] = true 
    meleespecialweapons[12] = true 
    meleespecialweapons[13] = true 
    meleespecialweapons[14] = true 
    meleespecialweapons[15] = true 
    meleespecialweapons[40] = true 
    meleespecialweapons[44] = true 
    meleespecialweapons[45] = true 
    meleespecialweapons[46] = true 
  
function DXdraw() 
--Variables 
        sWidth, sHeight = guiGetScreenSize() 
  
        health = getElementHealth( getLocalPlayer() ) 
        lineLength1 = 114 * ( health / 100 ) -- Health bar 
  
        armor = getPedArmor( getLocalPlayer() ) 
        lineLength2 = 114 * ( armor / 100 ) -- Armor bar 
         
        ammoinclip = getPedAmmoInClip (getLocalPlayer()) 
        totalammo = getPedTotalAmmo (getLocalPlayer()) 
        showammo1 = ammoinclip 
        showammo2 = totalammo 
  
        moneycount=getPlayerMoney(getLocalPlayer()) 
        money= '$' ..moneycount 
  
        local hour, mins = getTime () 
        time = hour .. ":" .. (((mins < 10) and "0"..mins) or mins) 
         
         
-------- Dynamic health colour thanks to 50p ---------- 
        tick = getTickCount ()  
         
-- For active health bar 
      local maxHealth = 100;  -- get max health stat 
        local colourPercent = ( health / maxHealth ) * 200; 
        local red, green; -- we don't need blue because we don't use it, it'll be 0 
        if health < ( maxHealth / 2 ) then 
        red = 200; 
        green = ( health / 50 ) * ( colourPercent * 2 ); 
else 
        green = 200; 
        red = 200 - ( ( health - 50 ) / 50 ) * 200; 
end 
-- For inactive health bar 
        local maxHealth = 75;  -- get max health stat 
        local colourPercent1 = ( health / maxHealth ) * 75; 
        local red1, green1; -- we don't need blue because we don't use it, it'll be 0 
        if health < ( maxHealth / 2 ) then 
        red1 = 75; 
        green1 = ( health / 50 ) * ( colourPercent1 * 2 ); 
else 
        green1 = 75; 
        red1 = 75 - ( ( health - 50 ) / 50 ) * 75; 
end 
local color1 = tocolor( red1, green1, 0, 150 ) 
local color2 = tocolor( red, green, 0, 200 ) 
  
 -- For the health bar 
 if getTickCount () %1500 < 500 and health <= 25 then 
  
 else  
 dxDrawRectangle(sWidth-206,sHeight-23,114.0,14.0,color1, false) -- Health inactive bar 
 dxDrawRectangle(sWidth-206,sHeight-23,lineLength1,14.0,color2,false) --Health active bar 
 end 
  
 if armor <= 0 then 
  
 else 
dxDrawRectangle(sWidth-206,sHeight-43,lineLength2,14.0,tocolor(200,200,200,200),false) -- Armor active bar 
dxDrawRectangle(sWidth-206,sHeight-43,114.0,14.0,tocolor(50,50,50,150),false) -- Armor inactive bar 
end 
  
------ DX drawing that are visible at all times 
dxDrawRectangle(sWidth-84,sHeight-48,78.0,33.0,tocolor(0,0,0,150),false) -- GTA Time DX Rectangle 
  
dxDrawText(tostring (money),sWidth-200,sHeight-78,sWidth-5,sHeight-54,tocolor(0,0,0,200),1.0,"pricedown","right","top",false,false,false) -- Money DX text (shadow) 
  
dxDrawText(tostring (money),sWidth-202,sHeight-81,sWidth-7,sHeight-57,tocolor(0,100,0,220),1.0,"pricedown","right","top",false,false,false) -- Money DX text 
  
dxDrawText(tostring (time),sWidth-81,sHeight-46,sWidth-10,sHeight-16,tocolor(250,250,250,200),1.0,"diploma","center","top",false,false,false) -- GTA Time DX text 
  
------- Weapon icons & Ammo DX drawings 
local weaponID = getPedWeapon (getLocalPlayer()); -- Get weapon ID 
dxDrawImage(sWidth-266,sHeight-56,48.0,52.0,"icons/".. tostring( weaponID ) .. ".png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Weapon icons image. 
  
-- now decide if the optional stuff should be drawn 
if noreloadweapons [getPedWeapon(getLocalPlayer())] then 
dxDrawText(tostring (showammo2),sWidth-400,sHeight-42,sWidth-288,sHeight-12,tocolor(0,255,255,200),1.0,"bankgothic","right","top",false,false,false) -- No reload weapons (for shotgun, grenades, etc) 
  
elseif meleespecialweapons [getPedWeapon(getLocalPlayer())] then 
-- Draw Nothing for melee and special weapons. 
  
else --Weapons that reloads. 
        dxDrawText(tostring (showammo1),sWidth-455,sHeight-41,sWidth-387,sHeight-13,tocolor(0,255,255,200),1.0,"bankgothic","right","top",false,false,false) 
        dxDrawText("|",sWidth-381,sHeight-42,sWidth-366,sHeight-8,tocolor(255,200,0,200),1.0,"bankgothic","left","top",false,false,false) 
        dxDrawText(tostring (showammo2),sWidth-365,sHeight-41,sWidth-272,sHeight-12,tocolor(0,255,255,200),1.0,"bankgothic","left","top",false,false,false) 
end 
end -- End of the DX Drawing function 
addEventHandler("onClientRender", getRootElement(), DXdraw) 
  
  
-- Show / Hide GTA SA HUD command function. 
  
function hudChanger () 
    showPlayerHudComponent ( "armour", false ) 
    showPlayerHudComponent ( "health", false ) 
    showPlayerHudComponent ( "money", false ) 
    showPlayerHudComponent ( "clock", false ) 
    showPlayerHudComponent ( "weapon", false ) 
    showPlayerHudComponent ("ammo", false) 
    showPlayerHudComponent ( "money", false ) 
end 
  
addCommandHandler ( "hidehud", hudChanger ) 
addEventHandler( "onClientResourceStart", getRootElement(), hudChanger ) -- Hide the HUD (except oxygen) on resource start. 
addEventHandler( "onPlayerJoin", getRootElement(), hudChanger ) -- The same, but also on player join. 
  
function hudChanger2 () 
    showPlayerHudComponent ( "armour", true )     
    showPlayerHudComponent ( "health", true )  
    showPlayerHudComponent ( "money", true ) 
    showPlayerHudComponent ( "clock", true ) 
    showPlayerHudComponent ( "weapon", true ) 
    showPlayerHudComponent ("ammo", true) 
    showPlayerHudComponent ( "money", true) 
end 
addCommandHandler ( "showhud", hudChanger2) -- Show all the HUD if you want to. 

Since I'm still a scripting newbie, I might not know how to do it. So any help is appreciated. :)

PS: Where are all the LUA function colors?

XX3 is gone. This is my new name. :3

Posted

hmmm i didn't got well your question but, to remove a dxDRAW element isn't like removEventHandle

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
So, how should I fix that? It's 100% DX drawings you know.

this function will destroy the whole HUD ;)

  
function destroyHud () 
removeEventHandler("onClientRender",getRootElement(),DXdraw) 
end 
addCommandHandler ( "destroyhud", destroyHud) -- Remove all new hud. 

i hope this is what you wanted :P

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Ahh that's right, I'll try it tomorrow.

Btw, what about reappearing it again? Was it addEventHandler to the same function?

XX3 is gone. This is my new name. :3

Posted

yup

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
Tested, and actually it didn't work. So anyone has the solution?

what part didn't worked?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

I'm asking for how to remove all part of the HUD in one command.

Btw, here's what I edited, just in the bottom of the script:

-- Show / Hide GTA SA HUD command function. 
  
function hudChanger () 
    showPlayerHudComponent ( "armour", false ) 
    showPlayerHudComponent ( "health", false ) 
    showPlayerHudComponent ( "money", false ) 
    showPlayerHudComponent ( "clock", false ) 
    showPlayerHudComponent ( "weapon", false ) 
    showPlayerHudComponent ("ammo", false) 
    showPlayerHudComponent ( "money", false ) 
     addEventHandler( "onClientRender", getRootElement(), DXdraw) 
end 
  
addCommandHandler ( "hidehud", hudChanger ) 
addEventHandler( "onClientResourceStart", getRootElement(), hudChanger ) -- Hide the HUD (except oxygen) on resource start. 
addEventHandler( "onPlayerJoin", getRootElement(), hudChanger ) -- The same, but also on player join. 
  
function hudChanger2 () 
    showPlayerHudComponent ( "armour", true )     
    showPlayerHudComponent ( "health", true )  
    showPlayerHudComponent ( "money", true ) 
    showPlayerHudComponent ( "clock", true ) 
    showPlayerHudComponent ( "weapon", true ) 
    showPlayerHudComponent ("ammo", true) 
    showPlayerHudComponent ( "money", true) 
     removeEventHandler( "onClientRender", getRootElement(), DXdraw) 
end 
addCommandHandler ( "showhud", hudChanger2) -- Show all the HUD if you want to. 
  
function hudChanger3 ()  
     showPlayerHudComponent ( "armour", false ) 
    showPlayerHudComponent ( "health", false ) 
    showPlayerHudComponent ( "money", false ) 
    showPlayerHudComponent ( "clock", false ) 
    showPlayerHudComponent ( "weapon", false ) 
    showPlayerHudComponent ("ammo", false) 
    showPlayerHudComponent ( "money", false ) 
     removeEventHandler( "onClientRender", getRootElement(), DXdraw) 
     end 
addCommandHandler( "hideall", hudChanger3) -- Hide every part of the HUD & the GTA HUD. 
  

XX3 is gone. This is my new name. :3

Posted

i put this and works,

-- Made By XX3, from scratch with MS Notepad. Purpose: To make a new exotic compact HUD. 
-- You may edit this resource, but please credit me if you wanted to post an edited / extended version. 
  
-- Weapon tables for ammo. 
    local noreloadweapons = {} --Weapons that doesn't reload (including the flamethrower, minigun, which doesn't have reload anim). 
    noreloadweapons[16] = true 
    noreloadweapons[17] = true 
    noreloadweapons[18] = true 
    noreloadweapons[19] = true 
    noreloadweapons[25] = true 
    noreloadweapons[33] = true 
    noreloadweapons[34] = true 
    noreloadweapons[35] = true 
    noreloadweapons[36] = true 
    noreloadweapons[37] = true 
    noreloadweapons[38] = true 
    noreloadweapons[39] = true 
    noreloadweapons[41] = true 
    noreloadweapons[42] = true 
    noreloadweapons[43] = true 
  
    local meleespecialweapons = {} --Weapons that don't shoot, and special weapons. 
    meleespecialweapons[0] = true 
    meleespecialweapons[1] = true 
    meleespecialweapons[2] = true 
    meleespecialweapons[3] = true 
    meleespecialweapons[4] = true 
    meleespecialweapons[5] = true 
    meleespecialweapons[6] = true 
    meleespecialweapons[7] = true 
    meleespecialweapons[8] = true 
    meleespecialweapons[9] = true 
    meleespecialweapons[10] = true 
    meleespecialweapons[11] = true 
    meleespecialweapons[12] = true 
    meleespecialweapons[13] = true 
    meleespecialweapons[14] = true 
    meleespecialweapons[15] = true 
    meleespecialweapons[40] = true 
    meleespecialweapons[44] = true 
    meleespecialweapons[45] = true 
    meleespecialweapons[46] = true 
  
function DXdraw() 
--Variables 
        sWidth, sHeight = guiGetScreenSize() 
  
        health = getElementHealth( getLocalPlayer() ) 
        lineLength1 = 114 * ( health / 100 ) -- Health bar 
  
        armor = getPedArmor( getLocalPlayer() ) 
        lineLength2 = 114 * ( armor / 100 ) -- Armor bar 
        
        ammoinclip = getPedAmmoInClip (getLocalPlayer()) 
        totalammo = getPedTotalAmmo (getLocalPlayer()) 
        showammo1 = ammoinclip 
        showammo2 = totalammo 
  
        moneycount=getPlayerMoney(getLocalPlayer()) 
        money= '$' ..moneycount 
  
        local hour, mins = getTime () 
        time = hour .. ":" .. (((mins < 10) and "0"..mins) or mins) 
        
        
-------- Dynamic health colour thanks to 50p ---------- 
        tick = getTickCount () 
        
-- For active health bar 
      local maxHealth = 100;  -- get max health stat 
        local colourPercent = ( health / maxHealth ) * 200; 
        local red, green; -- we don't need blue because we don't use it, it'll be 0 
        if health < ( maxHealth / 2 ) then 
        red = 200; 
        green = ( health / 50 ) * ( colourPercent * 2 ); 
else 
        green = 200; 
        red = 200 - ( ( health - 50 ) / 50 ) * 200; 
end 
-- For inactive health bar 
        local maxHealth = 75;  -- get max health stat 
        local colourPercent1 = ( health / maxHealth ) * 75; 
        local red1, green1; -- we don't need blue because we don't use it, it'll be 0 
        if health < ( maxHealth / 2 ) then 
        red1 = 75; 
        green1 = ( health / 50 ) * ( colourPercent1 * 2 ); 
else 
        green1 = 75; 
        red1 = 75 - ( ( health - 50 ) / 50 ) * 75; 
end 
local color1 = tocolor( red1, green1, 0, 150 ) 
local color2 = tocolor( red, green, 0, 200 ) 
  
 -- For the health bar 
 if getTickCount () %1500 < 500 and health <= 25 then 
  
 else 
 dxDrawRectangle(sWidth-206,sHeight-23,114.0,14.0,color1, false) -- Health inactive bar 
 dxDrawRectangle(sWidth-206,sHeight-23,lineLength1,14.0,color2,false) --Health active bar 
 end 
  
 if armor <= 0 then 
  
 else 
dxDrawRectangle(sWidth-206,sHeight-43,lineLength2,14.0,tocolor(200,200,200,200),false) -- Armor active bar 
dxDrawRectangle(sWidth-206,sHeight-43,114.0,14.0,tocolor(50,50,50,150),false) -- Armor inactive bar 
end 
  
------ DX drawing that are visible at all times 
dxDrawRectangle(sWidth-84,sHeight-48,78.0,33.0,tocolor(0,0,0,150),false) -- GTA Time DX Rectangle 
  
dxDrawText(tostring (money),sWidth-200,sHeight-78,sWidth-5,sHeight-54,tocolor(0,0,0,200),1.0,"pricedown","right","top",false,false,false) -- Money DX text (shadow) 
  
dxDrawText(tostring (money),sWidth-202,sHeight-81,sWidth-7,sHeight-57,tocolor(0,100,0,220),1.0,"pricedown","right","top",false,false,false) -- Money DX text 
  
dxDrawText(tostring (time),sWidth-81,sHeight-46,sWidth-10,sHeight-16,tocolor(250,250,250,200),1.0,"diploma","center","top",false,false,false) -- GTA Time DX text 
  
------- Weapon icons & Ammo DX drawings 
local weaponID = getPedWeapon (getLocalPlayer()); -- Get weapon ID 
dxDrawImage(sWidth-266,sHeight-56,48.0,52.0,"icons/".. tostring( weaponID ) .. ".png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Weapon icons image. 
  
-- now decide if the optional stuff should be drawn 
if noreloadweapons [getPedWeapon(getLocalPlayer())] then 
dxDrawText(tostring (showammo2),sWidth-400,sHeight-42,sWidth-288,sHeight-12,tocolor(0,255,255,200),1.0,"bankgothic","right","top",false,false,false) -- No reload weapons (for shotgun, grenades, etc) 
  
elseif meleespecialweapons [getPedWeapon(getLocalPlayer())] then 
-- Draw Nothing for melee and special weapons. 
  
else --Weapons that reloads. 
        dxDrawText(tostring (showammo1),sWidth-455,sHeight-41,sWidth-387,sHeight-13,tocolor(0,255,255,200),1.0,"bankgothic","right","top",false,false,false) 
        dxDrawText("|",sWidth-381,sHeight-42,sWidth-366,sHeight-8,tocolor(255,200,0,200),1.0,"bankgothic","left","top",false,false,false) 
        dxDrawText(tostring (showammo2),sWidth-365,sHeight-41,sWidth-272,sHeight-12,tocolor(0,255,255,200),1.0,"bankgothic","left","top",false,false,false) 
end 
end -- End of the DX Drawing function 
addEventHandler("onClientRender", getRootElement(), DXdraw) 
  
-- Show / Hide GTA SA HUD command function.  
function hudChanger () 
    showPlayerHudComponent ( "armour", false ) 
    showPlayerHudComponent ( "health", false ) 
    showPlayerHudComponent ( "money", false ) 
    showPlayerHudComponent ( "clock", false ) 
    showPlayerHudComponent ( "weapon", false ) 
    showPlayerHudComponent ("ammo", false) 
    showPlayerHudComponent ( "money", false ) 
     addEventHandler( "onClientRender", getRootElement(), DXdraw) 
end 
  
addCommandHandler ( "hidehud", hudChanger ) 
addEventHandler( "onClientResourceStart", getRootElement(), hudChanger ) -- Hide the HUD (except oxygen) on resource start. 
addEventHandler( "onPlayerJoin", getRootElement(), hudChanger ) -- The same, but also on player join. 
  
function hudChanger2 () 
    showPlayerHudComponent ( "armour", true )     
    showPlayerHudComponent ( "health", true ) 
    showPlayerHudComponent ( "money", true ) 
    showPlayerHudComponent ( "clock", true ) 
    showPlayerHudComponent ( "weapon", true ) 
    showPlayerHudComponent ("ammo", true) 
    showPlayerHudComponent ( "money", true) 
     removeEventHandler( "onClientRender", getRootElement(), DXdraw) 
end 
addCommandHandler ( "showhud", hudChanger2) -- Show all the HUD if you want to. 
  
function hudChanger3 () 
     showPlayerHudComponent ( "armour", false ) 
    showPlayerHudComponent ( "health", false ) 
    showPlayerHudComponent ( "money", false ) 
    showPlayerHudComponent ( "clock", false ) 
    showPlayerHudComponent ( "weapon", false ) 
    showPlayerHudComponent ("ammo", false) 
    showPlayerHudComponent ( "money", false ) 
     removeEventHandler( "onClientRender", getRootElement(), DXdraw) 
     end 
addCommandHandler( "hideall", hudChanger3) -- Hide every part of the HUD & the GTA HUD. 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

this is SERVER event, it will never trigger:

addEventHandler( "onPlayerJoin", getRootElement(), hudChanger ) -- The same, but also on player join. 

remove that line. dont try to change it - it will cause unwanted effect. You really dont need this.

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

Ahh, a server event! I never thought that would happen :o

Thanks a lot, needs to be fixed.

i put this and works,
-- Made By XX3, from scratch with MS Notepad. Purpose: To make a new exotic compact HUD. 
-- You may edit this resource, but please credit me if you wanted to post an edited / extended version. 
  
-- Weapon tables for ammo. 
    local noreloadweapons = {} --Weapons that doesn't reload (including the flamethrower, minigun, which doesn't have reload anim). 
    noreloadweapons[16] = true 
    noreloadweapons[17] = true 
    noreloadweapons[18] = true 
    noreloadweapons[19] = true 
    noreloadweapons[25] = true 
    noreloadweapons[33] = true 
    noreloadweapons[34] = true 
    noreloadweapons[35] = true 
    noreloadweapons[36] = true 
    noreloadweapons[37] = true 
    noreloadweapons[38] = true 
    noreloadweapons[39] = true 
    noreloadweapons[41] = true 
    noreloadweapons[42] = true 
    noreloadweapons[43] = true 
  
    local meleespecialweapons = {} --Weapons that don't shoot, and special weapons. 
    meleespecialweapons[0] = true 
    meleespecialweapons[1] = true 
    meleespecialweapons[2] = true 
    meleespecialweapons[3] = true 
    meleespecialweapons[4] = true 
    meleespecialweapons[5] = true 
    meleespecialweapons[6] = true 
    meleespecialweapons[7] = true 
    meleespecialweapons[8] = true 
    meleespecialweapons[9] = true 
    meleespecialweapons[10] = true 
    meleespecialweapons[11] = true 
    meleespecialweapons[12] = true 
    meleespecialweapons[13] = true 
    meleespecialweapons[14] = true 
    meleespecialweapons[15] = true 
    meleespecialweapons[40] = true 
    meleespecialweapons[44] = true 
    meleespecialweapons[45] = true 
    meleespecialweapons[46] = true 
  
function DXdraw() 
--Variables 
        sWidth, sHeight = guiGetScreenSize() 
  
        health = getElementHealth( getLocalPlayer() ) 
        lineLength1 = 114 * ( health / 100 ) -- Health bar 
  
        armor = getPedArmor( getLocalPlayer() ) 
        lineLength2 = 114 * ( armor / 100 ) -- Armor bar 
        
        ammoinclip = getPedAmmoInClip (getLocalPlayer()) 
        totalammo = getPedTotalAmmo (getLocalPlayer()) 
        showammo1 = ammoinclip 
        showammo2 = totalammo 
  
        moneycount=getPlayerMoney(getLocalPlayer()) 
        money= '$' ..moneycount 
  
        local hour, mins = getTime () 
        time = hour .. ":" .. (((mins < 10) and "0"..mins) or mins) 
        
        
-------- Dynamic health colour thanks to 50p ---------- 
        tick = getTickCount () 
        
-- For active health bar 
      local maxHealth = 100;  -- get max health stat 
        local colourPercent = ( health / maxHealth ) * 200; 
        local red, green; -- we don't need blue because we don't use it, it'll be 0 
        if health < ( maxHealth / 2 ) then 
        red = 200; 
        green = ( health / 50 ) * ( colourPercent * 2 ); 
else 
        green = 200; 
        red = 200 - ( ( health - 50 ) / 50 ) * 200; 
end 
-- For inactive health bar 
        local maxHealth = 75;  -- get max health stat 
        local colourPercent1 = ( health / maxHealth ) * 75; 
        local red1, green1; -- we don't need blue because we don't use it, it'll be 0 
        if health < ( maxHealth / 2 ) then 
        red1 = 75; 
        green1 = ( health / 50 ) * ( colourPercent1 * 2 ); 
else 
        green1 = 75; 
        red1 = 75 - ( ( health - 50 ) / 50 ) * 75; 
end 
local color1 = tocolor( red1, green1, 0, 150 ) 
local color2 = tocolor( red, green, 0, 200 ) 
  
 -- For the health bar 
 if getTickCount () %1500 < 500 and health <= 25 then 
  
 else 
 dxDrawRectangle(sWidth-206,sHeight-23,114.0,14.0,color1, false) -- Health inactive bar 
 dxDrawRectangle(sWidth-206,sHeight-23,lineLength1,14.0,color2,false) --Health active bar 
 end 
  
 if armor <= 0 then 
  
 else 
dxDrawRectangle(sWidth-206,sHeight-43,lineLength2,14.0,tocolor(200,200,200,200),false) -- Armor active bar 
dxDrawRectangle(sWidth-206,sHeight-43,114.0,14.0,tocolor(50,50,50,150),false) -- Armor inactive bar 
end 
  
------ DX drawing that are visible at all times 
dxDrawRectangle(sWidth-84,sHeight-48,78.0,33.0,tocolor(0,0,0,150),false) -- GTA Time DX Rectangle 
  
dxDrawText(tostring (money),sWidth-200,sHeight-78,sWidth-5,sHeight-54,tocolor(0,0,0,200),1.0,"pricedown","right","top",false,false,false) -- Money DX text (shadow) 
  
dxDrawText(tostring (money),sWidth-202,sHeight-81,sWidth-7,sHeight-57,tocolor(0,100,0,220),1.0,"pricedown","right","top",false,false,false) -- Money DX text 
  
dxDrawText(tostring (time),sWidth-81,sHeight-46,sWidth-10,sHeight-16,tocolor(250,250,250,200),1.0,"diploma","center","top",false,false,false) -- GTA Time DX text 
  
------- Weapon icons & Ammo DX drawings 
local weaponID = getPedWeapon (getLocalPlayer()); -- Get weapon ID 
dxDrawImage(sWidth-266,sHeight-56,48.0,52.0,"icons/".. tostring( weaponID ) .. ".png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Weapon icons image. 
  
-- now decide if the optional stuff should be drawn 
if noreloadweapons [getPedWeapon(getLocalPlayer())] then 
dxDrawText(tostring (showammo2),sWidth-400,sHeight-42,sWidth-288,sHeight-12,tocolor(0,255,255,200),1.0,"bankgothic","right","top",false,false,false) -- No reload weapons (for shotgun, grenades, etc) 
  
elseif meleespecialweapons [getPedWeapon(getLocalPlayer())] then 
-- Draw Nothing for melee and special weapons. 
  
else --Weapons that reloads. 
        dxDrawText(tostring (showammo1),sWidth-455,sHeight-41,sWidth-387,sHeight-13,tocolor(0,255,255,200),1.0,"bankgothic","right","top",false,false,false) 
        dxDrawText("|",sWidth-381,sHeight-42,sWidth-366,sHeight-8,tocolor(255,200,0,200),1.0,"bankgothic","left","top",false,false,false) 
        dxDrawText(tostring (showammo2),sWidth-365,sHeight-41,sWidth-272,sHeight-12,tocolor(0,255,255,200),1.0,"bankgothic","left","top",false,false,false) 
end 
end -- End of the DX Drawing function 
addEventHandler("onClientRender", getRootElement(), DXdraw) 
  
-- Show / Hide GTA SA HUD command function.  
function hudChanger () 
    showPlayerHudComponent ( "armour", false ) 
    showPlayerHudComponent ( "health", false ) 
    showPlayerHudComponent ( "money", false ) 
    showPlayerHudComponent ( "clock", false ) 
    showPlayerHudComponent ( "weapon", false ) 
    showPlayerHudComponent ("ammo", false) 
    showPlayerHudComponent ( "money", false ) 
     addEventHandler( "onClientRender", getRootElement(), DXdraw) 
end 
  
addCommandHandler ( "hidehud", hudChanger ) 
addEventHandler( "onClientResourceStart", getRootElement(), hudChanger ) -- Hide the HUD (except oxygen) on resource start. 
addEventHandler( "onPlayerJoin", getRootElement(), hudChanger ) -- The same, but also on player join. 
  
function hudChanger2 () 
    showPlayerHudComponent ( "armour", true )     
    showPlayerHudComponent ( "health", true ) 
    showPlayerHudComponent ( "money", true ) 
    showPlayerHudComponent ( "clock", true ) 
    showPlayerHudComponent ( "weapon", true ) 
    showPlayerHudComponent ("ammo", true) 
    showPlayerHudComponent ( "money", true) 
     removeEventHandler( "onClientRender", getRootElement(), DXdraw) 
end 
addCommandHandler ( "showhud", hudChanger2) -- Show all the HUD if you want to. 
  
function hudChanger3 () 
     showPlayerHudComponent ( "armour", false ) 
    showPlayerHudComponent ( "health", false ) 
    showPlayerHudComponent ( "money", false ) 
    showPlayerHudComponent ( "clock", false ) 
    showPlayerHudComponent ( "weapon", false ) 
    showPlayerHudComponent ("ammo", false) 
    showPlayerHudComponent ( "money", false ) 
     removeEventHandler( "onClientRender", getRootElement(), DXdraw) 
     end 
addCommandHandler( "hideall", hudChanger3) -- Hide every part of the HUD & the GTA HUD. 

Ahh thanks! :D What's edited anyway?

Ehem, problem solved. There will be a next question next time. (You'll know it later)

XX3 is gone. This is my new name. :3

Posted

nothing was edited if i'm right, i just told that i put that and worked :P

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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