ZeyadGTX Posted September 18, 2014 Posted September 18, 2014 Hello i use this Line to Show the player armor in the Hud it works but i want if player have armor then it shown if player doesn't have armor then it should be hidden dxDrawText("#FFFFFFArmor: #0000FF"..armor.."%", (872/1024)*sWidth, (80/768)*sHeight, (289/1024)*sWidth, (250/768)*sHeight, tocolor (0, 0, 0, 255), (0.99/1366)*sWidth,(0.9/768)*sHeight,"bankgothic","left","top",false,false,false,true)
xeon17 Posted September 18, 2014 Posted September 18, 2014 if (armor) then dxDrawText("#FFFFFFArmor: #0000FF"..armor.."%", (872/1024)*sWidth, (80/768)*sHeight, (289/1024)*sWidth, (250/768)*sHeight, tocolor (0, 0, 0, 255), (0.99/1366)*sWidth,(0.9/768)*sHeight,"bankgothic","left","top",false,false,false,true) ?
ZeyadGTX Posted September 18, 2014 Author Posted September 18, 2014 This Shows player's armor when he has ? and hide when he hasnot ???
xeon17 Posted September 18, 2014 Posted September 18, 2014 This Shows player's armor when he has ? and hide when he hasnot ??? Just think a little about it , armor is your variable when you get the player's health so if player have health it will draw the text, if no then no..
ZeyadGTX Posted September 18, 2014 Author Posted September 18, 2014 No not working the Whole Armor text is removed if there is armor or there isnot
ZeyadGTX Posted September 18, 2014 Author Posted September 18, 2014 That's dxDrawText Functions Client Side FPSLimit = 60 FPSMax = 1 player = getLocalPlayer() sWidth,sHeight = guiGetScreenSize() addEvent("onClientPlayerHUDShown", true) addEvent("onClientPlayerHUDHidden", true) function restoreHUD() setElementData(player, "state.hud", "enabled") showChat(true) showPlayerHudComponent("crosshair", true) showPlayerHudComponent("radar", true) triggerServerEvent("onPlayerHUDShown", player) triggerEvent("onClientPlayerHUDShown", player) end addEventHandler("onClientResourceStart", resourceRoot, restoreHUD) function hudvisible ( ) if getElementData(player, "state.hud") == "disabled" then return end --Gets some elements local hour, mins = getTime () local time = hour .. ":" .. (((mins < 10) and "0"..mins) or mins) local moneycount=getPlayerMoney(getLocalPlayer()) local money= '' ..moneycount local phealth = math.floor (getElementHealth ( getLocalPlayer() )) local armor = math.floor(getPedArmor ( getLocalPlayer() )) local zone = getZoneName (getElementPosition(getLocalPlayer())) local oxygen = getPedOxygenLevel (getLocalPlayer()) local ammo = getPedTotalAmmo (getLocalPlayer()) local clip = getPedAmmoInClip (getLocalPlayer()) local XP = getElementData(localPlayer, "EXP") or 0 local LV = getElementData(localPlayer, "LV") or 0 local lp = getElementData(player, "Army.rank") or "Newbie" --Draws the player hud dxDrawText(tostring (time),(0.878)*sWidth, (0.007)*sHeight, (0.293)*sWidth, (0.263)*sHeight,tocolor(250,250,250,200),(0.9/1366)*sWidth,(0.9/768)*sHeight,"bankgothic","left","top",false,false,false,true) dxDrawText(tostring (money), (0.08)*sWidth, (0.640)*sHeight, (0.282)*sWidth, (0.326)*sHeight, tocolor (0, 255, 0, 255), (0.9/1366)*sWidth,(0.9/768)*sHeight,"bankgothic","left","top",false,false,false,true) dxDrawText("#FFFFFFHealth: #FF0000"..phealth.."%", (870/1024)*sWidth, (45/768)*sHeight, (289/1024)*sWidth, (250/768)*sHeight, tocolor (0, 0, 0, 255), (0.9/1366)*sWidth,(0.9/768)*sHeight,"bankgothic","left","top",false,false,false,true) dxDrawText("#FFFFFFArmor: #0000FF"..armor.."%", (872/1024)*sWidth, (80/768)*sHeight, (289/1024)*sWidth, (250/768)*sHeight, tocolor (0, 0, 0, 255), (0.99/1366)*sWidth,(0.9/768)*sHeight,"bankgothic","left","top",false,false,false,true) dxDrawText(zone, (850/1024)*sWidth, (740/768)*sHeight, (289/1024)*sWidth, (250/768)*sHeight, tocolor (255, 255, 255, 255), (0.85/1366)*sWidth,(0.85/768)*sHeight,"bankgothic","left","top",false,false,false,true) --dxDrawText(tonumber(getElementData(getLocalPlayer(), "distance.foot")).." m", (25/1024)*sWidth, (200/768)*sHeight, (289/1024)*sWidth, (250/768)*sHeight, tocolor (255, 255, 255, 255), (0.7/1366)*sWidth,(0.7/768)*sHeight,"bankgothic","left","top",false,false,false,true) --dxDrawText(tonumber(getElementData(getLocalPlayer(), "distance.Automobile")).." m", (25/1024)*sWidth, (215/768)*sHeight, (289/1024)*sWidth, (250/768)*sHeight, tocolor (255, 255, 255, 255), (0.7/1366)*sWidth,(0.7/768)*sHeight,"bankgothic","left","top",false,false,false,true) --dxDrawText(tonumber(getElementData(getLocalPlayer(), "distance.Plane")).." m", (25/1024)*sWidth, (230/768)*sHeight, (289/1024)*sWidth, (250/768)*sHeight, tocolor (255, 255, 255, 255), (0.7/1366)*sWidth,(0.7/768)*sHeight,"bankgothic","left","top",false,false,false,true) --dxDrawText(tonumber(getElementData(getLocalPlayer(), "distance.Bike")).." m", (25/1024)*sWidth, (245/768)*sHeight, (289/1024)*sWidth, (250/768)*sHeight, tocolor (255, 255, 255, 255), (0.7/1366)*sWidth,(0.7/768)*sHeight,"bankgothic","left","top",false,false,false,true) --dxDrawText(tonumber(getElementData(getLocalPlayer(), "distance.Helicopter")).." m", (25/1024)*sWidth, (260/768)*sHeight, (289/1024)*sWidth, (250/768)*sHeight, tocolor (255, 255, 255, 255), (0.7/1366)*sWidth,(0.7/768)*sHeight,"bankgothic","left","top",false,false,false,true) --dxDrawText(tonumber(getElementData(getLocalPlayer(), "distance.BMX")).." m", (25/1024)*sWidth, (275/768)*sHeight, (289/1024)*sWidth, (250/768)*sHeight, tocolor (255, 255, 255, 255), (0.7/1366)*sWidth,(0.7/768)*sHeight,"bankgothic","left","top",false,false,false,true) --dxDrawText(tonumber(getElementData(getLocalPlayer(), "distance.Quad")).." m", (25/1024)*sWidth, (290/768)*sHeight, (289/1024)*sWidth, (250/768)*sHeight, tocolor (255, 255, 255, 255), (0.7/1366)*sWidth,(0.7/768)*sHeight,"bankgothic","left","top",false,false,false,true) dxDrawImage((839/1024)*sWidth, (42/768)*sHeight, (33/1024)*sWidth, (33/768)*sHeight, "Heart.png") dxDrawImage((840/1024)*sWidth, (80/768)*sHeight, (32/1024)*sWidth, (32/768)*sHeight, "armor.png") dxDrawImage((47/1024)*sWidth, (490/768)*sHeight, (32/1024)*sWidth, (32/768)*sHeight, "$.png")
-.Paradox.- Posted September 18, 2014 Posted September 18, 2014 if (armor) then dxDrawText("#FFFFFFArmor: #0000FF"..armor.."%", (872/1024)*sWidth, (80/768)*sHeight, (289/1024)*sWidth, (250/768)*sHeight, tocolor (0, 0, 0, 255), (0.99/1366)*sWidth,(0.9/768)*sHeight,"bankgothic","left","top",false,false,false,true) ? An 'end' is missing P: @Spider Learn LUA dude At least tell what debug says, Something like this is simple, no need to write a whole topic for it
ZeyadGTX Posted September 18, 2014 Author Posted September 18, 2014 see that if (armor) then dxDrawText("#FFFFFFArmor: #0000FF"..armor.."%", (872/1024)*sWidth, (80/768)*sHeight, (289/1024)*sWidth, (250/768)*sHeight, tocolor (0, 0, 0, 255), (0.99/1366)*sWidth,(0.9/768)*sHeight,"bankgothic","left","top",false,false,false,true) end
#DRAGON!FIRE Posted September 18, 2014 Posted September 18, 2014 if ( getPedArmor ( getLocalPlayer ( ) ) > 0 ) then --- Code end
ZeyadGTX Posted September 18, 2014 Author Posted September 18, 2014 Any way non of your posts helped me i just tried code and worked for me if armor > 0 then dxDrawText("#FFFFFFArmor: #0000FF"..armor.."%", (872/1024)*sWidth, (80/768)*sHeight, (289/1024)*sWidth, (250/768)*sHeight, tocolor (0, 0, 0, 255), (0.99/1366)*sWidth,(0.9/768)*sHeight,"bankgothic","left","top",false,false,false,true) end if armor > 0 then dxDrawImage((840/1024)*sWidth, (80/768)*sHeight, (32/1024)*sWidth, (32/768)*sHeight, "armor.png") end
-.Paradox.- Posted September 18, 2014 Posted September 18, 2014 Any way non of your posts helped me i just tried code and worked for me if armor > 0 then dxDrawText("#FFFFFFArmor: #0000FF"..armor.."%", (872/1024)*sWidth, (80/768)*sHeight, (289/1024)*sWidth, (250/768)*sHeight, tocolor (0, 0, 0, 255), (0.99/1366)*sWidth,(0.9/768)*sHeight,"bankgothic","left","top",false,false,false,true) end if armor > 0 then dxDrawImage((840/1024)*sWidth, (80/768)*sHeight, (32/1024)*sWidth, (32/768)*sHeight, "armor.png") end Maybe because someone WASN'T clear enough and post what debug says. # ZA7F helped as well
#DRAGON!FIRE Posted September 18, 2014 Posted September 18, 2014 if ( getPedArmor ( getLocalPlayer ( ) ) > 0 ) then dxDrawText("#FFFFFFArmor: #0000FF"..armor.."%", (872/1024)*sWidth, (80/768)*sHeight, (289/1024)*sWidth, (250/768)*sHeight, tocolor (0, 0, 0, 255), (0.99/1366)*sWidth,(0.9/768)*sHeight,"bankgothic","left","top",false,false,false,true) dxDrawImage((840/1024)*sWidth, (80/768)*sHeight, (32/1024)*sWidth, (32/768)*sHeight, "armor.png") end
-.Paradox.- Posted September 18, 2014 Posted September 18, 2014 That's dxDrawText FunctionsClient Side local armor = math.floor(getPedArmor ( getLocalPlayer() ))) if ( getPedArmor ( getLocalPlayer ( ) ) > 0 ) then --- Code end
xeon17 Posted September 18, 2014 Posted September 18, 2014 @NightFury i did it my self Why you even help for help if you fix every code by alone?
Et-win Posted September 18, 2014 Posted September 18, 2014 Why even helping him if he is constantly letting us do the job+Not his scripts?
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