Xwad Posted April 7, 2015 Share Posted April 7, 2015 Hi i have a weapon hud on my server but i have a problem with it. When i login and chose team and skin then the hud dosent hide.. how can i hide it when i login? thanks. this is the script https://community.multitheftauto.com/index.php?p= ... ls&id=9674 Link to comment
Tekken Posted April 7, 2015 Share Posted April 7, 2015 onPlayerJoin onPlayerLogin setPlayerHudComponentVisible Link to comment
Xwad Posted April 7, 2015 Author Share Posted April 7, 2015 cooool i made it with the functions and it works now !! it hides when i join!!! thanks!! Link to comment
Xwad Posted April 7, 2015 Author Share Posted April 7, 2015 i want to hide the radar and the weapon hud but its not working. Pls help. function Hide() showPlayerHudComponent("all",false) end addEventHandler("onClientPlayerJoin", getRootElement(), Hide) Link to comment
WhoAmI Posted April 7, 2015 Share Posted April 7, 2015 If you are using custom radar/HUD it won't work. Link to comment
Mr.unpredictable. Posted April 7, 2015 Share Posted April 7, 2015 i want to hide the radar and the weapon hud but its not working. Pls help. function Hide() showPlayerHudComponent("all",false) end addEventHandler("onClientPlayerJoin", getRootElement(), Hide) That will only hide the default Hud. Link to comment
Xwad Posted April 7, 2015 Author Share Posted April 7, 2015 yeah i just want to hide the default hud. But it dosent work when i join. But when im on the server and start the rescource then it will be hided but if i disconnect and connect agaiun the i will see it again.. Link to comment
Dimos7 Posted April 7, 2015 Share Posted April 7, 2015 addEventHandler("onClientPlayerJoin", getRootElement(), function() showPlayerHudComponent("all", false) end) Link to comment
#RooTs Posted April 7, 2015 Share Posted April 7, 2015 try this local hudTable = { "ammo", "armour", "clock", "health", "money", "weapon", "wanted", "area_name", "vehicle_name", "breath", "clock" } addEventHandler("onClientResourceStart", resourceRoot, function() for id, hudComponents in ipairs(hudTable) do showPlayerHudComponent(hudComponents, false) end end) addEventHandler("onClientResourceStop", resourceRoot, function() for id, hudComponents in ipairs(hudTable) do showPlayerHudComponent(hudComponents, true) end end) Link to comment
#RooTs Posted April 8, 2015 Share Posted April 8, 2015 not working:( WTF ? I tested here and work, what's your game mode Link to comment
Xwad Posted April 8, 2015 Author Share Posted April 8, 2015 my gamemode is play just connect and take a look. server28.clans.hu:22095 Link to comment
#RooTs Posted April 8, 2015 Share Posted April 8, 2015 my gamemode is play just connect and take a look. server28.clans.hu:22095 paste all code in here Link to comment
Xwad Posted April 8, 2015 Author Share Posted April 8, 2015 Client.lua "Xwad" version="1.0" type="script" name="Hide hud" /> Meta.xml local hudTable = { "ammo", "armour", "clock", "health", "money", "weapon", "wanted", "area_name", "vehicle_name", "breath", "clock" } addEventHandler("onClientResourceStart", resourceRoot, function() for id, hudComponents in ipairs(hudTable) do showPlayerHudComponent(hudComponents, false) end end) addEventHandler("onClientResourceStop", resourceRoot, function() for id, hudComponents in ipairs(hudTable) do showPlayerHudComponent(hudComponents, true) Link to comment
#RooTs Posted April 8, 2015 Share Posted April 8, 2015 (edited) LOL, omg. please, give-me image screen shot with the erro. there is nothing wrong with the codes, the radar of Rage that's right. must be some problem with your gta mod --[[ -------------------------------------- # Resource Name Grand Theft Auto V | Radar # Author Rage Special Thanks to MrTasty(dxMap & Blips) # Date created 25.04.2014 # Last update 01.01.2015 # Updates [01.01.2015] -Moved from shader to dx -Blips support -------------------------------------- --]] local screenW,screenH = guiGetScreenSize() local resW,resH = 1280,720 local sW,sH = (screenW/resW), (screenH/resH) --Features local alwaysRenderMap = false local alwaysRenderOxygen = false local disableGTASAhealth = true local disableGTASAarmor = true local disableGTASAoxygen = true local enableBlipDistance = true --Dimensions & Sizes --Blip size, pixels relative to 1366x768 resolution local worldW, worldH = 3072, 3072 local blip = 14 local turn = true local alpha = 255 local sRotating = 0 local rt = dxCreateRenderTarget(290, 175) -- Useful functions -- function findRotation(x1,y1,x2,y2) --Author: Doomed_Space_Marine & robhol local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end; return t; end function getPointFromDistanceRotation(x, y, dist, angle) --Author: robhol local a = math.rad(90 - angle); local dx = math.cos(a) * dist; local dy = math.sin(a) * dist; return x+dx, y+dy; end function drawRadar() showPlayerHudComponent("radar", false) if disableGTASAhealth then showPlayerHudComponent("health", false) end if disableGTASAarmor then showPlayerHudComponent("armour", false) end if disableGTASAoxygen then showPlayerHudComponent("breath", false) end if (not isPlayerMapVisible()) then local mW, mH = dxGetMaterialSize(rt) if ( alwaysRenderMap or getElementInterior(localPlayer) == 0 ) then dxSetRenderTarget(rt, true) local x, y = getElementPosition(localPlayer) local X, Y = mW/2 -(x/(6000/worldW)), mH/2 +(y/(6000/worldH)) local camX,camY,camZ = getElementRotation(getCamera()) --dxDrawRectangle(0, 0, mW, mH, 0xFF7CA7D1) --render background dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, "img/radar_map.jpg", camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255)) dxSetRenderTarget() end --dxDrawImage((20+5)*sW, screenH-((191+5))*sH, (292-10)*sW, (144)*sH, rt, 0, 0, 0, tocolor(255, 255, 255, 150)) dxDrawImage((18+5)*sW, screenH-((179+5))*sH, (275-10)*sW, (135)*sH, rt, 0, 0, 0, tocolor(255, 255, 255, 150)) local health = math.max(math.min(getElementHealth(localPlayer)/(0.232018558500192*getPedStat(localPlayer, 24) -32.018558511152), 1), 0) local armor = math.max(math.min(getPedArmor(localPlayer)/100, 1), 0) local oxygen = math.max(math.min(getPedOxygenLevel(localPlayer)/(1.5*getPedStat(localPlayer, 225) +1000), 1), 0) --# Get rotations local _, _, c_Rot = getElementRotation( getCamera()); local _, _, p_Rot = getElementRotation( localPlayer ) local playerHealth = math.floor( getElementHealth( localPlayer )) local playerArmor = math.floor( getPedArmor( localPlayer )) local playerOxygen = math.floor( getPedOxygenLevel( localPlayer )) if ( playerHealth <= 50) then HP_Colour = tocolor(200, 0, 0, 190) HP_Alpha = tocolor(200, 0, 0, 100) else HP_Colour = tocolor(102, 204, 102, 190) HP_Alpha = tocolor(102, 204, 102, 100) end if ( playerHealth >= 101 ) then maxHealth = 200 else maxHealth = 100 end --# Alpha dxDrawRectangle(23.5*sW, 676.5*sH, 130.5*sW, 9.2*sH, HP_Alpha) dxDrawRectangle(156.6*sW, 676.5*sH, 65*sW, 9.2*sH, tocolor(0, 102, 255, 100)) dxDrawRectangle(225*sW, 676.5*sH, 62.6*sW, 9.2*sH, tocolor(255, 255, 0, 100)) --# Bars dxDrawRectangle(23.5*sW, 676.5*sH, 130.5*sW/maxHealth*playerHealth, 9.2*sH, HP_Colour) dxDrawRectangle(156.6*sW, 676.5*sH, 65*sW/100*playerArmor, 9.2*sH, tocolor(0, 102, 255, 190)) dxDrawRectangle(225*sW, 676.5*sH, 62.6*sW/1000*playerOxygen, 9.2*sH, tocolor(255, 255, 0, 190)) --# Radar Cover dxDrawImage(18*sW, 530*sH, 275*sW, 160*sH, "img/radar_cover.png", 0, 0, 0, tocolor(255, 255, 255, 255)) --#Blips local rx, ry, rz = getElementRotation(localPlayer) local lB = (23)*sW local rB = (23+265)*sW local tB = screenH-(184)*sH local bB = tB + (135)*sH local cX, cY = (rB+lB)/2, (tB+bB)/2 +(35)*sH for k, v in ipairs(getElementsByType("blip")) do local px, py, pz = getElementPosition(localPlayer) local _,_,camZ = getElementRotation(getCamera()) local bx, by, bz = getElementPosition(v) local actualDist = getDistanceBetweenPoints2D(px, py, bx, by) local maxDist = getBlipVisibleDistance(v) if ( actualDist <= maxDist ) then local dist = actualDist/(6000/((worldW+worldH)/2)) local rot = findRotation(bx, by, px, py)-camZ local bpx, bpy = getPointFromDistanceRotation(cX, cY, dist, rot) local bpx = math.max(lB, math.min(rB, bpx)) local bpy = math.max(tB, math.min(bB, bpy)) local blipID = getElementData(v, "customIcon") or getBlipIcon(v) local _, _, _, bcA = getBlipColor(v) local bcR, bcG, bcB = 255, 255, 255 if getBlipIcon(v) == 0 then bcR, bcG, bcB = getBlipColor(v) end local bUD = "img/blip.png" if (bz - pz) >= 5 then bUD = "img/blip_up.png" elseif (bz - pz) <= -5 then bUD = "img/blip_down.png" end local bS = getBlipSize(v) dxDrawImage(bpx -(blip*bS)*sW/2, bpy -(blip*bS)*sH/2, (blip*bS)*sW, (blip*bS)*sH, "img/blips/"..blipID..".png", 0, 0, 0, tocolor(bcR, bcG, bcB, bcA)) end end if ( renderNorthBlip ) then local _,_,camZ = getElementRotation(getCamera()) local toLeft, toTop, toRight, toBottom = cX-lB, cY-tB, rB-cX, b-cY local bpx, bpy = getPointFromDistanceRotation(cX, cY, math.sqrt(toTop^2 + toLeft^2), -camZ+180) local bpx = math.max(lB, math.min(rB, bpx)) local bpy = math.max(tB, math.min(bB, bpy)) dxDrawImage(bpx -(blip*2)/2, bpy -(blip*2)/2, blip*2, blip*2, "img/blips/4.png", 0, 0, 0) end local _,_,camZ = getElementRotation(getCamera()) dxDrawImage(cX -(blip*1.5)*sW/2, cY -(blip*1.5)*sH/2, (blip*1.5)*sW, (blip*1.5)*sH, "img/player.png", camZ-rz, 0, 0) --[[ sRotating=sRotating+10 if ( sRotating==360 ) then sRotating=0 end]] --[[ local localVehicle = getPedOccupiedVehicle(localPlayer) if isElement(localVehicle) and getVehicleType(localVehicle) == "Helicopter" then dxDrawImage(cX -(blip*1.5)*sW/2, cY -(blip*2)*sH/2, (blip*2)*sW, (blip*2)*sH, "img/hunter.png", camZ-rz, 0, 0) dxDrawImage(cX -(blip*1.5)*sW/2, cY -(blip*2)*sH/2, (blip*2)*sW, (blip*2)*sH, "img/hrotor.png", sRotating) elseif isElement(localVehicle) and getVehicleType(localVehicle) == "Plane" then dxDrawImage(cX -(blip*1.5)*sW/2, cY -(blip*2)*sH/2, (blip*2)*sW, (blip*2)*sH, "img/blips/5.png", camZ-rz, 0, 0) else dxDrawImage(cX -(blip*1.5)*sW/2, cY -(blip*1.5)*sH/2, (blip*1.5)*sW, (blip*1.5)*sH, "img/player.png", camZ-rz, 0, 0) end ]] --# Wanted local g_wl = getPlayerWantedLevel( localPlayer ) if ( g_wl > 0 ) then if ( turn == true ) then alpha = alpha + 5 if ( alpha > 180 ) then alpha = 180 turn = false end elseif ( turn == false ) then alpha = alpha - 5 if ( alpha < 0 ) then alpha = 0 turn = true end end dxDrawRectangle(23*sW, 536*sH, 265*sW, 135*sH, tocolor(0, 102, 255, alpha)) else return end end end addEventHandler( "onClientRender", root, drawRadar) local hudTable = { "ammo", "armour", "clock", "health", "money", "weapon", "wanted", "area_name", "vehicle_name", "breath", "clock" } addEventHandler("onClientResourceStart", resourceRoot, function() for id, hudComponents in ipairs(hudTable) do showPlayerHudComponent(hudComponents, false) end end) addEventHandler("onClientResourceStop", resourceRoot, function() for id, hudComponents in ipairs(hudTable) do showPlayerHudComponent(hudComponents, true) end end) Edited April 8, 2015 by Guest Link to comment
Et-win Posted April 8, 2015 Share Posted April 8, 2015 addEventHandler("onClientPlayerJoin", getRootElement(), function() showPlayerHudComponent("all", false) end) This is totally not different from his code except how it's build... Link to comment
Xwad Posted April 8, 2015 Author Share Posted April 8, 2015 its not working when I enter the server and join. But if I on the server and restart rescource then it will be hide but if I reconnect then I will see it again.. Maybe its becaouse I have a spawn system script? wait I send a picture Link to comment
Dimos7 Posted April 9, 2015 Share Posted April 9, 2015 function hide() showPlayerHudComponent("all", false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), hide) addEventHandler("onClientPlayerJoin", getRootElement(), hide) or try server side function hide() showPlayerHudComponent(source, "all", false) end addEventHandler("onResourceStart" , getResourceRootElement(getThisResource()), hide) addEventHandler("onPlayerJoin", getRootElement(), hide) function show() showPlayerHudComponent(source, "all", true) end addEventHandler("onPlayerLogin", getRootElement(), show) Link to comment
.:DoA:.Backflip Posted April 9, 2015 Share Posted April 9, 2015 function hide() showPlayerHudComponent("all", false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), hide) addEventHandler("onClientPlayerJoin", getRootElement(), hide) or try server side function hide() showPlayerHudComponent(source, "all", false) end addEventHandler("onResourceStart" , getResourceRootElement(getThisResource()), hide) addEventHandler("onPlayerJoin", getRootElement(), hide) function show() showPlayerHudComponent(source, "all", true) end addEventHandler("onPlayerLogin", getRootElement(), show) Dimos, do you even know that the source of this event is the root element of this resource? The code of RooTs should work fine, but I guess the problem is some other resource which causes the problem. Link to comment
Xwad Posted April 10, 2015 Author Share Posted April 10, 2015 i think the problem is becaouse the spawn menu no? https://community.multitheftauto.com/index.php?p= ... ls&id=1152 Link to comment
Xwad Posted April 10, 2015 Author Share Posted April 10, 2015 i use this hud : https://community.multitheftauto.com/in ... s&id=10277 Link to comment
#RooTs Posted April 10, 2015 Share Posted April 10, 2015 LOLLLL you do not know nor edit a script? I recommend, study a bit before creating a server Link to comment
#RooTs Posted April 10, 2015 Share Posted April 10, 2015 whats the problem?? the problem is that. is not the HUD, but your other script 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