WASSIm. Posted June 2, 2013 Share Posted June 2, 2013 hi guys i have problem. hud not showing and no error local sx,sy = guiGetScreenSize ( ) local font1 = "sans" local font2 = "pricedown" local scale1 = 1.7 local scale2 = 1.7 enablePlayerWeapon = true enablePlayerAmmo = true enablePlayerHealth = true enablePlayerArmour = true enablePlayerClock = true enablePlayerMoney = true enablePlayerWanted = true enablePlayerDay = true function dxDrawBorderedText( text, x, y, w, h, color, black, scale1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded ) text_ = text:gsub ( "#%x%x%x%x%x%x", "" ) dxDrawText ( text_, x - black, y - black, w - black, h - black, tocolor ( 0, 0, 0, black55 ), scale1, font, alignX, alignY, clip, wordBreak, false, true ) dxDrawText ( text_, x + black, y - black, w + black, h - black, tocolor ( 0, 0, 0, black55 ), scale1, font, alignX, alignY, clip, wordBreak, false, true ) dxDrawText ( text_, x - black, y + black, w - black, h + black, tocolor ( 0, 0, 0, black55 ), scale1, font, alignX, alignY, clip, wordBreak, false, true ) dxDrawText ( text_, x + black, y + black, w + black, h + black, tocolor ( 0, 0, 0, black55 ), scale1, font, alignX, alignY, clip, wordBreak, false, true ) dxDrawText ( text_, x - black, y, w - black, h, tocolor ( 0, 0, 0, black55 ), scale1, font, alignX, alignY, clip, wordBreak, false, true ) dxDrawText ( text_, x + black, y, w + black, h, tocolor ( 0, 0, 0, black55 ), scale1, font, alignX, alignY, clip, wordBreak, false, true ) dxDrawText ( text_, x, y - black, w, h - black, tocolor ( 0, 0, 0, black55 ), scale1, font, alignX, alignY, clip, wordBreak, false, true ) dxDrawText ( text_, x, y + black, w, h + black, tocolor ( 0, 0, 0, black55 ), scale1, font, alignX, alignY, clip, wordBreak, false, true ) dxDrawText ( text, x, y, w, h, color, scale1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded ) end function hud( ) if not isPlayerMapVisible () then days = { [ 0 ] = 'Sunday', [ 1 ] = 'Monday', [ 2 ] = 'Tuesday', [ 3 ] = 'Wednesday', [ 4 ] = 'Thursday', [ 5 ] = 'Friday', [ 6 ] = 'Saturday', } noreloadweapons = {} 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[39] = true noreloadweapons[41] = true noreloadweapons[43] = true meleespecialweapons = {} 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 playerWeapon = getPedWeapon ( localPlayer ) playerAmmo = getPedTotalAmmo ( localPlayer ) playerAmmo2 = getPedTotalAmmo( localPlayer )-getPedAmmoInClip( localPlayer ) playerAmmoc = getPedAmmoInClip ( localPlayer ) playerHealth = getElementHealth ( localPlayer ) playerArmor = getPedArmor ( localPlayer ) hour, mins = getTime ( localPlayer ) money = getPlayerMoney ( localPlayer ) wanted = getPlayerWantedLevel ( localPlayer ) stat = getPedStat ( localPlayer, 24 ) day = (days [getRealTime().weekday] ) showammo1 = playerAmmoc showammo2 = playerAmmo showammo3 = playerAmmo2 currenthealth = math.floor(playerHealth) currentarmor = math.floor(playerArmor) time = hour .. " : " .. (((mins < 10) and "0"..mins) or mins) if ( enablePlayerWeapon ) then wpx5, wpy5, wpx6, wpy6 = sx*(1115.0/1440),sy*(40.0/900),sx*(110.0/1440),sy*(115.0/900) end if ( enablePlayerAmmo ) then amx1, amy1, amx2, amy2 = sx*(1440.0/1440),sy*(128.0/900),sx*(910.0/1440),sy*(27.0/900) end if ( enablePlayerHealth ) then if (stat > 573 ) then hx1, hy1, hx2, hy2 = sx*(1440.0/1440),sy*(150.0/900),sx*(1370.0/1440),sy*(27.0/900) else hx1, hy1, hx2, hy2 = sx*(1440.0/1440),sy*(130.0/900),sx*(1370.0/1440),sy*(27.0/900) end end if ( enablePlayerArmour ) then if (stat > 573 ) then ax1, ay1, ax2, ay2 = sx*(1440.0/1440),sy*(92.0/900),sx*(1370.0/1440),sy*(27.0/900) else ax1, ay1, ax2, ay2 = sx*(1440.0/1440),sy*(88.0/900),sx*(1370.0/1440),sy*(27.0/900) end end if ( enablePlayerClock ) then tx1, ty1, tx2, ty2 = sx*(1440.0/1440),sy*(40.0/900),sx*(1165.0/1440),sy*(27.0/900) end if ( enablePlayerMoney ) then if (stat > 573 ) then mx1, my1, mx2, my2 = sx*(1440.0/1440),sy*(175.0/900),sx*(1366.0/1440),sy*(27.0/900) else mx1, my1, mx2, my2 = sx*(1440.0/1440),sy*(151.0/900),sx*(1366.0/1440),sy*(27.0/900) end end if ( enablePlayerWanted ) then wx1, wy1, wx2, wy2 = sx*(1440.0/1440),sy*(151.0/900),sx*(1166.0/1440),sy*(27.0/900) end if ( enablePlayerDay ) then dx1, dy1, dx2, dy2 = sx*(1440.0/1440),sy*(0.0/900),sx*(1165.0/1440),sy*(27.0/900) end if ( isPlayerHQHudVisible ( localplayer,Weapon ) ) then wpx5, wpy5, wpx6, wpy6 = sx*(1115.0/1440),sy*(40.0/900),sx*(110.0/1440),sy*(115.0/900) end if ( isPlayerHQHudVisible ( localplayer,Ammo ) ) then amx1, amy1, amx2, amy2 = sx*(1440.0/1440),sy*(128.0/900),sx*(910.0/1440),sy*(27.0/900) end if ( isPlayerHQHudVisible ( localplayer,Health ) ) then if (stat > 573 ) then hx1, hy1, hx2, hy2 = sx*(1440.0/1440),sy*(150.0/900),sx*(1370.0/1440),sy*(27.0/900) else hx1, hy1, hx2, hy2 = sx*(1440.0/1440),sy*(130.0/900),sx*(1370.0/1440),sy*(27.0/900) end end if ( isPlayerHQHudVisible ( localplayer,Armour ) ) then if (stat > 573 ) then ax1, ay1, ax2, ay2 = sx*(1440.0/1440),sy*(92.0/900),sx*(1370.0/1440),sy*(27.0/900) else ax1, ay1, ax2, ay2 = sx*(1440.0/1440),sy*(88.0/900),sx*(1370.0/1440),sy*(27.0/900) end end if ( isPlayerHQHudVisible ( localplayer,Clock ) ) then tx1, ty1, tx2, ty2 = sx*(1440.0/1440),sy*(40.0/900),sx*(1165.0/1440),sy*(27.0/900) end if ( isPlayerHQHudVisible ( localplayer,Money ) ) then if (stat > 573 ) then mx1, my1, mx2, my2 = sx*(1440.0/1440),sy*(175.0/900),sx*(1366.0/1440),sy*(27.0/900) else mx1, my1, mx2, my2 = sx*(1440.0/1440),sy*(151.0/900),sx*(1366.0/1440),sy*(27.0/900) end end if ( isPlayerHQHudVisible ( localplayer,Wanted ) ) then wx1, wy1, wx2, wy2 = sx*(1440.0/1440),sy*(151.0/900),sx*(1166.0/1440),sy*(27.0/900) end if ( isPlayerHQHudVisible ( localplayer,Day ) ) then dx1, dy1, dx2, dy2 = sx*(1440.0/1440),sy*(0.0/900),sx*(1165.0/1440),sy*(27.0/900) end if ( isPlayerHQHudVisible ( localplayer,Weapon ) ) then if playerWeapon and doesPedHaveJetPack (localPlayer) then dxDrawImage(wpx5-60, wpy5+30, wpx6/2, wpy6/2,"images/weapon/"..tostring(playerWeapon)..".png",0.0,0.0,0.0,tocolor(255,255,255,255),false) dxDrawImage(wpx5, wpy5, wpx6, wpy6,"images/weapon/JP.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) elseif not playerWeapon and doesPedHaveJetPack (localPlayer) then dxDrawImage(wpx5, wpy5, wpx6, wpy6,"images/weapon/JP.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) elseif isPlayerPhoneIcon ( localPlayer ) then dxDrawImage(wpx5, wpy5, wpx6, wpy6,"images/weapon/PH.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) elseif playerWeapon then dxDrawImage(wpx5, wpy5, wpx6, wpy6,"images/weapon/"..tostring (playerWeapon)..".png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end end if ( isPlayerHQHudVisible ( localplayer,Ammo) ) then if (meleespecialweapons [playerWeapon]) or doesPedHaveJetPack (localPlayer) or isPlayerPhoneIcon ( localPlayer ) then --nothing elseif (noreloadweapons [playerWeapon]) then dxDrawBorderedText(""..tostring(showammo2).."",amx1, amy1, amx2, amy2,tocolor (180,200,240,255),2,scale1,font1,"center","top",false,false,false) elseif (not noreloadweapons [playerWeapon]) then dxDrawBorderedText(""..tostring(showammo3).."-"..tostring(showammo1).."",amx1, amy1, amx2-5, amy2,tocolor(180,200,240,255),2,scale1,font1,"center","top",false,false,false,false) end end if ( isPlayerHQHudVisible ( localplayer,Health ) ) then dxDrawBorderedText(""..tostring(currenthealth).."%",hx1, hy1, hx2, hy2,tocolor (180,25,29,255),2,scale1,font1,"center","top",false,false,false) end if ( isPlayerHQHudVisible ( localplayer,Armour ) ) then if (playerArmor > 1) then dxDrawBorderedText(""..tostring(currentarmor).."%",ax1, ay1, ax2, ay2,tocolor (225,225,225,255),2,scale1,font1,"center","top",false,false,false) end end if ( isPlayerHQHudVisible ( localplayer,Day ) ) then dxDrawBorderedText Link to comment
Raph Posted June 3, 2013 Share Posted June 3, 2013 If you try to show your HUD with "onClientPreRender", it's normal that the hud isn't showing. You need to make it "onClientRender". See onClientRender for more info. Link to comment
WASSIm. Posted June 3, 2013 Author Share Posted June 3, 2013 If you try to show your HUD with "onClientPreRender", it's normal that the hud isn't showing. You need to make it "onClientRender". See onClientRender for more info. its working before use isPlayerHQHudVisible i think problem with that Link to comment
Raph Posted June 3, 2013 Share Posted June 3, 2013 I can't see neither your isPlayerHQHudVisible or setPlayerHQHudVisible functions. Maybe you didn't show your full script. Do you have any debug text showing? Link to comment
WASSIm. Posted June 3, 2013 Author Share Posted June 3, 2013 I can't see neither your isPlayerHQHudVisible or setPlayerHQHudVisible functions. Maybe you didn't show your full script. Do you have any debug text showing? isPlayerHQHudVisible and setPlayerHQHudVisible is exports Link to comment
Raph Posted June 3, 2013 Share Posted June 3, 2013 Then shouldn't it be like exports.resourceName:isPlayerHQHudVisible? Link to comment
Raph Posted June 3, 2013 Share Posted June 3, 2013 Oh okay. Try to change line 376 for onClientRender Link to comment
WASSIm. Posted June 3, 2013 Author Share Posted June 3, 2013 nothing i think problem in isPlayerHQHudVisible Link to comment
WASSIm. Posted June 3, 2013 Author Share Posted June 3, 2013 function isPlayerPhoneIcon ( thePlayer ) if ( isElement( thePlayer ) ) then if ( getElementData(thePlayer, "PhoneIcon" ) ) then return true else return false end else return false end end function isPlayerHQHudVisible ( thePlayer ) if ( isElement( thePlayer ) ) then if ( getElementData(thePlayer, "ammo" ) ) then return true else return false end else return false end end function isPlayerHQHudVisible ( thePlayer ) if ( isElement( thePlayer ) ) then if ( getElementData(thePlayer, "armour" ) ) then return true else return false end else return false end end function isPlayerHQHudVisible ( thePlayer ) if ( isElement( thePlayer ) ) then if ( getElementData(thePlayer, "clock" ) ) then return true else return false end else return false end end function isPlayerHQHudVisible ( thePlayer ) if ( isElement( thePlayer ) ) then if ( getElementData(thePlayer, "health" ) ) then return true else return false end else return false end end function isPlayerHQHudVisible ( thePlayer ) if ( isElement( thePlayer ) ) then if ( getElementData(thePlayer, "money" ) ) then return true else return false end else return false end end function isPlayerHQHudVisible ( thePlayer ) if ( isElement( thePlayer ) ) then if ( getElementData(thePlayer, "weapon" ) ) then return true else return false end else return false end end function isPlayerHQHudVisible ( thePlayer ) if ( isElement( thePlayer ) ) then if ( getElementData(thePlayer, "wanted" ) ) then return true else return false end else return false end end function isPlayerHQHudVisible ( thePlayer ) if ( isElement( thePlayer ) ) then if ( getElementData(thePlayer, "day" ) ) then return true else return false end else return false end end function setPlayerPhoneIcon ( thePlayer, stats) if ( isElement( thePlayer ) ) then setElementData(thePlayer, "PhoneIcon", stats ) else return false end end function setPlayerHQHudVisible ( thePlayer, stats) if ( isElement( thePlayer ) ) then setElementData(thePlayer, "ammo", stats ) else return false end end function setPlayerHQHudVisible ( thePlayer, stats) if ( isElement( thePlayer ) ) then setElementData(thePlayer, "armour", stats ) else return false end end function setPlayerHQHudVisible ( thePlayer, stats) if ( isElement( thePlayer ) ) then setElementData(thePlayer, "clock", stats ) else return false end end function setPlayerHQHudVisible ( thePlayer, stats) if ( isElement( thePlayer ) ) then setElementData(thePlayer, "health", stats ) else return false end end function setPlayerHQHudVisible ( thePlayer, stats) if ( isElement( thePlayer ) ) then setElementData(thePlayer, "money", stats ) else return false end end function setPlayerHQHudVisible ( thePlayer, stats) if ( isElement( thePlayer ) ) then setElementData(thePlayer, "weapon", stats ) else return false end end function setPlayerHQHudVisible ( thePlayer, stats) if ( isElement( thePlayer ) ) then setElementData(thePlayer, "wanted", stats ) else return false end end function setPlayerHQHudVisible ( thePlayer, stats) if ( isElement( thePlayer ) ) then setElementData(thePlayer, "day", stats ) else return false end end function setPlayerHQHudVisible ( thePlayer, stats) if ( isElement( thePlayer ) ) then setElementData(thePlayer, "all", stats ) setElementData(thePlayer, "ammo", stats ) setElementData(thePlayer, "armour", stats ) setElementData(thePlayer, "clock", stats ) setElementData(thePlayer, "health", stats ) setElementData(thePlayer, "money", stats ) setElementData(thePlayer, "weapon", stats ) setElementData(thePlayer, "wanted", stats ) setElementData(thePlayer, "day", stats ) else return false end end Link to comment
Raph Posted June 3, 2013 Share Posted June 3, 2013 I don't get why you have some many functions called the same. Try using only one like this: function isPlayerHQHudVisible(thePlayer, hudComponent) if (isElement(thePlayer)) then if (getElementData(thePlayer, hudComponent)) then return true else return false end else return false end end function setPlayerHQHudVisible(thePlayer, hudComponent, state) if (isElement(thePlayer)) then setElementData(thePlayer, hudComponent, state) return true else return false end end Then, to call them, you can use this: setPlayerHQHudVisible(localPlayer, "ammo", true) --and isPlayerHQHudVisible(localPlayer, "ammo") Link to comment
WASSIm. Posted June 4, 2013 Author Share Posted June 4, 2013 i make script new hud i want make function like hud normally exm if use that setPlayerHQHudVisible(localPlayer, "weapon", false) hide weapon icon in new hud 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