Best-Killer1 Posted September 30, 2015 Share Posted September 30, 2015 Hud Showing boffer/after login and when wasted hud showing too The Code local newFont = dxCreateFont( "font/font.ttf", 15 ) local newFont2 = dxCreateFont( "font/font.ttf", 9 ) local newFont3 = dxCreateFont( "font/font.ttf", 24 ) local LOCAL_PLAYER = getLocalPlayer() pos = getElementPosition(LOCAL_PLAYER) showPlayerHudComponent("radar",true) showPlayerHudComponent("weapon", false ) showPlayerHudComponent( "ammo", false ) showPlayerHudComponent("vehicle_name", false ) function dxtest() local playerX, playerY, playerZ = getElementPosition( LOCAL_PLAYER ) -- Get player's coordinates. local playerZoneName = getZoneName( playerX, playerY, playerZ ) local health = string.format("%03d", (getElementHealth(LOCAL_PLAYER))) local armor = math.floor (getPedArmor(LOCAL_PLAYER)) local weaponId = getPedWeapon(getLocalPlayer()) local money = getPlayerMoney(LOCAL_PLAYER); local totalAmmo = getPedTotalAmmo(LOCAL_PLAYER); local ammoInClip = getPedAmmoInClip(LOCAL_PLAYER); local oxygen = math.floor (getPedOxygenLevel(LOCAL_PLAYER)) / 10; local stat = getPedStat(LOCAL_PLAYER,24) local time = getRealTime() local hr,mins = getTime() local time3 = hr..":"..(((mins <10) and "0"..mins) or mins) local hours = time.hour local minutes = time.minute local sWidth,sHeight = guiGetScreenSize() dxDrawImage((740/1024)*sWidth, (8/768)*sHeight, (283/1024)*sWidth, (120/768)*sHeight, "outras/background.png",0,0,0,tocolor(0,0,0,255)) dxDrawImage((868/1024)*sWidth, (60/768)*sHeight, (148/1024)*sWidth, (38/768)*sHeight, "outras/background.png",0,0,0,tocolor(255,255,255,255)) dxDrawImage((873/1024)*sWidth, (63/768)*sHeight, (22/1024)*sWidth, (33/768)*sHeight, "outras/$.png",0,0,0,tocolor(255,255,255,255)) dxDrawImage((765/1024)*sWidth, (25/768)*sHeight, (85/1024)*sWidth, (85/768)*sHeight, "img/".. tostring(weaponId) ..".png") if totalAmmo ~= false and ammoInClip ~= false then dxDrawText(tostring(ammoInClip) .. ":" .. tostring(totalAmmo),(830/1024)*sWidth, (100/768)*sHeight, (20/1024)*sWidth, (20/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*0.40, newFont3,"left","top",false,false,false) end ---dxDrawText(tostring (money),(895/1024)*sWidth, (63/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*1.10, newFont,"left","top",false,false,false) local moneycount = getPlayerMoney(getLocalPlayer()) local money = ' ' ..moneycount -- Money dxDrawText(tostring (money),(886/1024)*sWidth, (63/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*1.10, newFont,"left","top",false,false,false) dxDrawText("SAEG:RPG",(910/1024)*sWidth, (98/768)*sHeight, (310/1024)*sWidth, (135/768)*sHeight, tocolor(0,102,0,255), (sWidth/1000)*1.25, newFont2,"left","top",false,false,false) --dxDrawText("000",(900/1024)*sWidth, (13/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,255,150), (sWidth/1024)*0.90, newFont3,"left","top",false,false,false) dxDrawText(tostring (armor).." %",(875/1024)*sWidth, (24/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*0.40, newFont3,"left","top",false,false,false) dxDrawImage((845.7/1024)*sWidth, (24/768)*sHeight, (30/1024)*sWidth, (20/768)*sHeight, "outras/armor.png") dxDrawText(tostring (health).." %",(950/1024)*sWidth, (19/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*0.60, newFont3,"left","top",false,false,false) dxDrawImage((920.7/1024)*sWidth, (19/768)*sHeight, (30/1024)*sWidth, (30/768)*sHeight, "outras/HP.png") if oxygen ~= false and isElementInWater(LOCAL_PLAYER) == true then dxDrawText(tostring(oxygen).." %",(800/1024)*sWidth, (120/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*0.60, newFont3,"left","top",false,false,false) dxDrawImage((755.7/1024)*sWidth, (125/768)*sHeight, (30/1024)*sWidth, (20/768)*sHeight, "outras/armor.png", nil, nil, tocolor(0, 128, 0, 255)); end --dxDrawText(tostring (armor).." %",(906/1024)*sWidth, (73/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*0.90, "pricedown","left","top",false,false,false) --dxDrawText(time3,(875/1024)*sWidth, (30/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,0,255), (sWidth/1024)*1.20, "pricedown","left","top",false,false,false) --dxDrawText("r$: "..money,(800/1024)*sWidth, (140/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(34,178,170,255), (sWidth/1024)*1.10, "pricedown","left","top",false,false,false) end addEventHandler("onClientHUDRender",getRootElement(), dxtest) root = getResourceRootElement() function changeit() showPlayerHudComponent("money",false) showPlayerHudComponent("area_name",false) showPlayerHudComponent("health",false) showPlayerHudComponent("clock",false) showPlayerHudComponent("armour",false) showPlayerHudComponent("breath",false) end addEventHandler("onClientResourceStart",root, changeit) function inCar() triggerEvent("onEnter",getLocalPlayer(),inCar) end addEventHandler("onClientVehicleEnter",getRootElement(),inCar) function outOfCar() removeEventHandler("onEnter",getLocalPlayer(),outOfCar) end addEventHandler("onClientVehicleExit",getRootElement(),outOfCar) function carHealth() local sWidth,sHeight = guiGetScreenSize() if isPedInVehicle(getLocalPlayer()) then vehicle = getPedOccupiedVehicle(getLocalPlayer()) health = math.ceil(getElementHealth(vehicle) / 10) speedx, speedy, speedz = getElementVelocity ( vehicle) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kmh = math.ceil(actualspeed * 180) end end addEvent("onEnter",true) addEventHandler("onEnter",getRootElement(),carHealth) addEventHandler("onClientHUDRender",getRootElement(),carHealth) if fileExists("client.lua") then fileDelete("client.lua") end Link to comment
1LoL1 Posted September 30, 2015 Share Posted September 30, 2015 Try this: local newFont = dxCreateFont( "font/font.ttf", 15 ) local newFont2 = dxCreateFont( "font/font.ttf", 9 ) local newFont3 = dxCreateFont( "font/font.ttf", 24 ) local LOCAL_PLAYER = getLocalPlayer() pos = getElementPosition(LOCAL_PLAYER) showPlayerHudComponent("radar",true) showPlayerHudComponent("weapon", false ) showPlayerHudComponent( "ammo", false ) showPlayerHudComponent("vehicle_name", false ) function dxtest() local playerX, playerY, playerZ = getElementPosition( LOCAL_PLAYER ) -- Get player's coordinates. local playerZoneName = getZoneName( playerX, playerY, playerZ ) local health = string.format("%03d", (getElementHealth(LOCAL_PLAYER))) local armor = math.floor (getPedArmor(LOCAL_PLAYER)) local weaponId = getPedWeapon(getLocalPlayer()) local money = getPlayerMoney(LOCAL_PLAYER); local totalAmmo = getPedTotalAmmo(LOCAL_PLAYER); local ammoInClip = getPedAmmoInClip(LOCAL_PLAYER); local oxygen = math.floor (getPedOxygenLevel(LOCAL_PLAYER)) / 10; local stat = getPedStat(LOCAL_PLAYER,24) local time = getRealTime() local hr,mins = getTime() local time3 = hr..":"..(((mins <10) and "0"..mins) or mins) local hours = time.hour local minutes = time.minute local sWidth,sHeight = guiGetScreenSize() dxDrawImage((740/1024)*sWidth, (8/768)*sHeight, (283/1024)*sWidth, (120/768)*sHeight, "outras/background.png",0,0,0,tocolor(0,0,0,255)) dxDrawImage((868/1024)*sWidth, (60/768)*sHeight, (148/1024)*sWidth, (38/768)*sHeight, "outras/background.png",0,0,0,tocolor(255,255,255,255)) dxDrawImage((873/1024)*sWidth, (63/768)*sHeight, (22/1024)*sWidth, (33/768)*sHeight, "outras/$.png",0,0,0,tocolor(255,255,255,255)) dxDrawImage((765/1024)*sWidth, (25/768)*sHeight, (85/1024)*sWidth, (85/768)*sHeight, "img/".. tostring(weaponId) ..".png") if totalAmmo ~= false and ammoInClip ~= false then dxDrawText(tostring(ammoInClip) .. ":" .. tostring(totalAmmo),(830/1024)*sWidth, (100/768)*sHeight, (20/1024)*sWidth, (20/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*0.40, newFont3,"left","top",false,false,false) end ---dxDrawText(tostring (money),(895/1024)*sWidth, (63/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*1.10, newFont,"left","top",false,false,false) local moneycount = getPlayerMoney(getLocalPlayer()) local money = ' ' ..moneycount -- Money dxDrawText(tostring (money),(886/1024)*sWidth, (63/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*1.10, newFont,"left","top",false,false,false) dxDrawText("SAEG:RPG",(910/1024)*sWidth, (98/768)*sHeight, (310/1024)*sWidth, (135/768)*sHeight, tocolor(0,102,0,255), (sWidth/1000)*1.25, newFont2,"left","top",false,false,false) --dxDrawText("000",(900/1024)*sWidth, (13/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,255,150), (sWidth/1024)*0.90, newFont3,"left","top",false,false,false) dxDrawText(tostring (armor).." %",(875/1024)*sWidth, (24/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*0.40, newFont3,"left","top",false,false,false) dxDrawImage((845.7/1024)*sWidth, (24/768)*sHeight, (30/1024)*sWidth, (20/768)*sHeight, "outras/armor.png") dxDrawText(tostring (health).." %",(950/1024)*sWidth, (19/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*0.60, newFont3,"left","top",false,false,false) dxDrawImage((920.7/1024)*sWidth, (19/768)*sHeight, (30/1024)*sWidth, (30/768)*sHeight, "outras/HP.png") if oxygen ~= false and isElementInWater(LOCAL_PLAYER) == true then dxDrawText(tostring(oxygen).." %",(800/1024)*sWidth, (120/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*0.60, newFont3,"left","top",false,false,false) dxDrawImage((755.7/1024)*sWidth, (125/768)*sHeight, (30/1024)*sWidth, (20/768)*sHeight, "outras/armor.png", nil, nil, tocolor(0, 128, 0, 255)); end --dxDrawText(tostring (armor).." %",(906/1024)*sWidth, (73/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*0.90, "pricedown","left","top",false,false,false) --dxDrawText(time3,(875/1024)*sWidth, (30/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,0,255), (sWidth/1024)*1.20, "pricedown","left","top",false,false,false) --dxDrawText("r$: "..money,(800/1024)*sWidth, (140/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(34,178,170,255), (sWidth/1024)*1.10, "pricedown","left","top",false,false,false) end addEventHandler("onClientHUDRender",getRootElement(), dxtest) root = getResourceRootElement() function changeit() showPlayerHudComponent("money",false) showPlayerHudComponent("area_name",false) showPlayerHudComponent("health",false) showPlayerHudComponent("clock",false) showPlayerHudComponent("armour",false) showPlayerHudComponent("breath",false) end addEventHandler("onClientResourceStart",root, changeit) function wasted() showPlayerHudComponent("money",false) showPlayerHudComponent("area_name",false) showPlayerHudComponent("health",false) showPlayerHudComponent("clock",false) showPlayerHudComponent("armour",false) showPlayerHudComponent("breath",false) end addEventHandler("onPlayerWasted",root, wasted) function inCar() triggerEvent("onEnter",getLocalPlayer(),inCar) end addEventHandler("onClientVehicleEnter",getRootElement(),inCar) function outOfCar() removeEventHandler("onEnter",getLocalPlayer(),outOfCar) end addEventHandler("onClientVehicleExit",getRootElement(),outOfCar) function carHealth() local sWidth,sHeight = guiGetScreenSize() if isPedInVehicle(getLocalPlayer()) then vehicle = getPedOccupiedVehicle(getLocalPlayer()) health = math.ceil(getElementHealth(vehicle) / 10) speedx, speedy, speedz = getElementVelocity ( vehicle) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kmh = math.ceil(actualspeed * 180) end end addEvent("onEnter",true) addEventHandler("onEnter",getRootElement(),carHealth) addEventHandler("onClientHUDRender",getRootElement(),carHealth) if fileExists("client.lua") then fileDelete("client.lua") end Link to comment
Best-Killer1 Posted September 30, 2015 Author Share Posted September 30, 2015 Try this: local newFont = dxCreateFont( "font/font.ttf", 15 ) local newFont2 = dxCreateFont( "font/font.ttf", 9 ) local newFont3 = dxCreateFont( "font/font.ttf", 24 ) local LOCAL_PLAYER = getLocalPlayer() pos = getElementPosition(LOCAL_PLAYER) showPlayerHudComponent("radar",true) showPlayerHudComponent("weapon", false ) showPlayerHudComponent( "ammo", false ) showPlayerHudComponent("vehicle_name", false ) function dxtest() local playerX, playerY, playerZ = getElementPosition( LOCAL_PLAYER ) -- Get player's coordinates. local playerZoneName = getZoneName( playerX, playerY, playerZ ) local health = string.format("%03d", (getElementHealth(LOCAL_PLAYER))) local armor = math.floor (getPedArmor(LOCAL_PLAYER)) local weaponId = getPedWeapon(getLocalPlayer()) local money = getPlayerMoney(LOCAL_PLAYER); local totalAmmo = getPedTotalAmmo(LOCAL_PLAYER); local ammoInClip = getPedAmmoInClip(LOCAL_PLAYER); local oxygen = math.floor (getPedOxygenLevel(LOCAL_PLAYER)) / 10; local stat = getPedStat(LOCAL_PLAYER,24) local time = getRealTime() local hr,mins = getTime() local time3 = hr..":"..(((mins <10) and "0"..mins) or mins) local hours = time.hour local minutes = time.minute local sWidth,sHeight = guiGetScreenSize() dxDrawImage((740/1024)*sWidth, (8/768)*sHeight, (283/1024)*sWidth, (120/768)*sHeight, "outras/background.png",0,0,0,tocolor(0,0,0,255)) dxDrawImage((868/1024)*sWidth, (60/768)*sHeight, (148/1024)*sWidth, (38/768)*sHeight, "outras/background.png",0,0,0,tocolor(255,255,255,255)) dxDrawImage((873/1024)*sWidth, (63/768)*sHeight, (22/1024)*sWidth, (33/768)*sHeight, "outras/$.png",0,0,0,tocolor(255,255,255,255)) dxDrawImage((765/1024)*sWidth, (25/768)*sHeight, (85/1024)*sWidth, (85/768)*sHeight, "img/".. tostring(weaponId) ..".png") if totalAmmo ~= false and ammoInClip ~= false then dxDrawText(tostring(ammoInClip) .. ":" .. tostring(totalAmmo),(830/1024)*sWidth, (100/768)*sHeight, (20/1024)*sWidth, (20/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*0.40, newFont3,"left","top",false,false,false) end ---dxDrawText(tostring (money),(895/1024)*sWidth, (63/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*1.10, newFont,"left","top",false,false,false) local moneycount = getPlayerMoney(getLocalPlayer()) local money = ' ' ..moneycount -- Money dxDrawText(tostring (money),(886/1024)*sWidth, (63/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*1.10, newFont,"left","top",false,false,false) dxDrawText("SAEG:RPG",(910/1024)*sWidth, (98/768)*sHeight, (310/1024)*sWidth, (135/768)*sHeight, tocolor(0,102,0,255), (sWidth/1000)*1.25, newFont2,"left","top",false,false,false) --dxDrawText("000",(900/1024)*sWidth, (13/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,255,150), (sWidth/1024)*0.90, newFont3,"left","top",false,false,false) dxDrawText(tostring (armor).." %",(875/1024)*sWidth, (24/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*0.40, newFont3,"left","top",false,false,false) dxDrawImage((845.7/1024)*sWidth, (24/768)*sHeight, (30/1024)*sWidth, (20/768)*sHeight, "outras/armor.png") dxDrawText(tostring (health).." %",(950/1024)*sWidth, (19/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*0.60, newFont3,"left","top",false,false,false) dxDrawImage((920.7/1024)*sWidth, (19/768)*sHeight, (30/1024)*sWidth, (30/768)*sHeight, "outras/HP.png") if oxygen ~= false and isElementInWater(LOCAL_PLAYER) == true then dxDrawText(tostring(oxygen).." %",(800/1024)*sWidth, (120/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*0.60, newFont3,"left","top",false,false,false) dxDrawImage((755.7/1024)*sWidth, (125/768)*sHeight, (30/1024)*sWidth, (20/768)*sHeight, "outras/armor.png", nil, nil, tocolor(0, 128, 0, 255)); end --dxDrawText(tostring (armor).." %",(906/1024)*sWidth, (73/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*0.90, "pricedown","left","top",false,false,false) --dxDrawText(time3,(875/1024)*sWidth, (30/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(255,255,0,255), (sWidth/1024)*1.20, "pricedown","left","top",false,false,false) --dxDrawText("r$: "..money,(800/1024)*sWidth, (140/768)*sHeight, (310/1024)*sWidth, (60/768)*sHeight, tocolor(34,178,170,255), (sWidth/1024)*1.10, "pricedown","left","top",false,false,false) end addEventHandler("onClientHUDRender",getRootElement(), dxtest) root = getResourceRootElement() function changeit() showPlayerHudComponent("money",false) showPlayerHudComponent("area_name",false) showPlayerHudComponent("health",false) showPlayerHudComponent("clock",false) showPlayerHudComponent("armour",false) showPlayerHudComponent("breath",false) end addEventHandler("onClientResourceStart",root, changeit) function wasted() showPlayerHudComponent("money",false) showPlayerHudComponent("area_name",false) showPlayerHudComponent("health",false) showPlayerHudComponent("clock",false) showPlayerHudComponent("armour",false) showPlayerHudComponent("breath",false) end addEventHandler("onPlayerWasted",root, wasted) function inCar() triggerEvent("onEnter",getLocalPlayer(),inCar) end addEventHandler("onClientVehicleEnter",getRootElement(),inCar) function outOfCar() removeEventHandler("onEnter",getLocalPlayer(),outOfCar) end addEventHandler("onClientVehicleExit",getRootElement(),outOfCar) function carHealth() local sWidth,sHeight = guiGetScreenSize() if isPedInVehicle(getLocalPlayer()) then vehicle = getPedOccupiedVehicle(getLocalPlayer()) health = math.ceil(getElementHealth(vehicle) / 10) speedx, speedy, speedz = getElementVelocity ( vehicle) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kmh = math.ceil(actualspeed * 180) end end addEvent("onEnter",true) addEventHandler("onEnter",getRootElement(),carHealth) addEventHandler("onClientHUDRender",getRootElement(),carHealth) if fileExists("client.lua") then fileDelete("client.lua") end Same problem Link to comment
TAPL Posted October 1, 2015 Share Posted October 1, 2015 I wonder how opening more than one thread will get your code fixed. https://forum.multitheftauto.com/viewtopic.php?f=91&t=93113 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now