AserOsama Posted January 24, 2018 Share Posted January 24, 2018 (edited) Well, I want to delete the GTA SA original HUD. So I made a script using SetPlayerHudComponentVisible function and It worked but here the problem comes when I get killed and I respawn, It shows again! local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted" } addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () for _, component in ipairs( components ) do setPlayerHudComponentVisible( component, false ) end end) I want to know the function I can use to disable HUD on resource start and on player respawn. Thanks! Edited January 24, 2018 by AserOsama Link to comment
DRW Posted January 24, 2018 Share Posted January 24, 2018 7 minutes ago, AserOsama said: Well, I want to delete the GTA SA original HUD. So I made a script using SetPlayerHudComponentVisible function and It worked but here the problem comes when I get killed and I respawn, It shows again! local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted" } addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () for _, component in ipairs( components ) do setPlayerHudComponentVisible( component, false ) end end) I want to know the function I can use to disable HUD on resource start and on player respawn. Thanks! Either the current spawn/death script does that intentionally, or it is a built-in thing. Just hide it again depending where it happens, either onClientPlayerWasted or onClientPlayerSpawn, or both. Try stopping the default spawn/death resource and try again. Link to comment
AserOsama Posted January 24, 2018 Author Share Posted January 24, 2018 3 minutes ago, MadnessReloaded said: Either the current spawn/death script does that intentionally, or it is a built-in thing. Just hide it again depending where it happens, either onClientPlayerWasted or onClientPlayerSpawn, or both. Try stopping the default spawn/death resource and try again. If you could explain more? like this? local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted" } addEventHandler("onClientPlayerWasted", getResourceRootElement(getThisResource()), function () for _, component in ipairs( components ) do setPlayerHudComponentVisible( component, false ) end end) local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted" } addEventHandler("onClientPlayerSpawn", getResourceRootElement(getThisResource()), function () for _, component in ipairs( components ) do setPlayerHudComponentVisible( component, false ) end end) Link to comment
DRW Posted January 24, 2018 Share Posted January 24, 2018 Exactly, but don't use getResourceRootElement in this case, it has nothing to do with the event. Use localPlayer, since you want to check if you die, not others. local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted" } addEventHandler("onClientPlayerWasted", localPlayer, function () for _, component in ipairs( components ) do setPlayerHudComponentVisible( component, false ) end end) local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted" } addEventHandler("onClientPlayerSpawn", localPlayer, function () for _, component in ipairs( components ) do setPlayerHudComponentVisible( component, false ) end end) 1 Link to comment
AserOsama Posted January 24, 2018 Author Share Posted January 24, 2018 Well, Thanks it worked! Link to comment
AserOsama Posted February 16, 2018 Author Share Posted February 16, 2018 Bump, It's now working but when I login, The ammo and weapon shows up. Quote local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted", "area_name", "vehicle_name", "radio" } addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () for _, component in ipairs( components ) do setPlayerHudComponentVisible( component, false ) end end) local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted", "area_name", "vehicle_name", "radio" } addEventHandler("onClientPlayerWasted", localPlayer, function () for _, component in ipairs( components ) do setPlayerHudComponentVisible( component, false ) end end) local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted", "area_name", "vehicle_name", "radio" } addEventHandler("onClientPlayerSpawn", localPlayer, function () for _, component in ipairs( components ) do setPlayerHudComponentVisible( component, false ) end end) local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted", "area_name", "vehicle_name", "radio" } addEventHandler("onClientPlayerJoin", localPlayer, function () for _, component in ipairs( components ) do setPlayerHudComponentVisible( component, false ) end end) local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted", "area_name", "vehicle_name", "radio" } addEventHandler("onClientPlayerLogin", localPlayer, function () for _, component in ipairs( components ) do setPlayerHudComponentVisible( component, false ) end end) Link to comment
Mahlukat Posted February 16, 2018 Share Posted February 16, 2018 You can use setTimer and check like this; local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted", "area_name", "vehicle_name", "radio" } setTimer(function() for i,v in pairs(components) if isPlayerHudComponentVisible(v)then setPlayerHudComponentVisible( v, false ) end end end, 1000,0) Link to comment
Captain Cody Posted February 16, 2018 Share Posted February 16, 2018 (edited) setTimer(setPlayerHudComponentVisible, 1000,0,'all', false ) Edited February 16, 2018 by CodyJ(L) Link to comment
AserOsama Posted February 16, 2018 Author Share Posted February 16, 2018 1 hour ago, Mahlukat said: You can use setTimer and check like this; local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted", "area_name", "vehicle_name", "radio" } setTimer(function() for i,v in pairs(components) if isPlayerHudComponentVisible(v)then setPlayerHudComponentVisible( v, false ) end end end, 1000,0) 1 hour ago, CodyJ(L) said: setTimer(setPlayerHudComponentVisible, 1000,0,'all', false ) That's correct? local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted", "area_name", "vehicle_name", "radio" } addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () for _, component in ipairs( components ) do setTimer(setPlayerHudComponentVisible 1000,0, component, false ) end end) Link to comment
iPrestege Posted February 16, 2018 Share Posted February 16, 2018 I think you should look in the resources and find the resource that's responsible for showing the HUD and handle it better than using timer..etc. Link to comment
AserOsama Posted February 16, 2018 Author Share Posted February 16, 2018 Fixed it, Nvm Link to comment
xRGamingx Posted February 17, 2018 Share Posted February 17, 2018 2 hours ago, AserOsama said: Fixed it, Nvm How did you solve it? I have a HUD dx and it appears before the player start session ¿? Send PM plz Link to comment
Manticore Posted February 22, 2018 Share Posted February 22, 2018 function hideall(player) showPlayerHudComponent ( "ammo", false ) showPlayerHudComponent ( "area_name", false ) showPlayerHudComponent ( "armour", false ) showPlayerHudComponent ( "breath", false ) showPlayerHudComponent ( "clock", false ) showPlayerHudComponent ( "health", false ) showPlayerHudComponent ( "money", false ) showPlayerHudComponent ( "vehicle_name", false ) showPlayerHudComponent ( "weapon", false ) showPlayerHudComponent ( "radio", false ) end addEventHandler ( "onClientResourceStart", getRootElement(), hideall ) function showall(player) showPlayerHudComponent ( "ammo", true ) showPlayerHudComponent ( "area_name", true ) showPlayerHudComponent ( "armour", true ) showPlayerHudComponent ( "breath", true ) showPlayerHudComponent ( "clock", true ) showPlayerHudComponent ( "health", true ) showPlayerHudComponent ( "money", true ) showPlayerHudComponent ( "vehicle_name", true ) showPlayerHudComponent ( "weapon", true ) showPlayerHudComponent ( "radio", true ) end addEventHandler ( "onClientResourceStop", resourceRoot, showall ) This should be work. Add this on client side. 1 Link to comment
Lisandu Posted December 21, 2021 Share Posted December 21, 2021 Nice its worked Thanks a lot! On 24/01/2018 at 08:12, DRW said: Exactly, but don't use getResourceRootElement in this case, it has nothing to do with the event. Use localPlayer, since you want to check if you die, not others. local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted" } addEventHandler("onClientPlayerWasted", localPlayer, function () for _, component in ipairs( components ) do setPlayerHudComponentVisible( component, false ) end end) local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted" } addEventHandler("onClientPlayerSpawn", localPlayer, function () for _, component in ipairs( components ) do setPlayerHudComponentVisible( component, false ) end end) This worked correcty for me 1 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