iPanda Posted September 5, 2013 Share Posted September 5, 2013 My life does not work: ( Purpose: When you press key F, then hides HUD, pressing the key returns back to HUD. function hudChanger ( key ) local key = "F6" if key == "F6" then showPlayerHudComponent ( source, "ammo", false ) showPlayerHudComponent ( source, "area_name", false ) showPlayerHudComponent ( source, "armour", false ) showPlayerHudComponent ( source, "breath", false ) showPlayerHudComponent ( source, "clock", false ) showPlayerHudComponent ( source, "health", false ) showPlayerHudComponent ( source, "money", false ) showPlayerHudComponent ( source, "radar", false ) showPlayerHudComponent ( source, "vehicle_name", false ) showPlayerHudComponent ( source, "radio", false ) showPlayerHudComponent ( source, "weapon", false ) showPlayerHudComponent ( source, "wanted", false ) else showPlayerHudComponent ( source, "ammo", false ) showPlayerHudComponent ( source, "area_name", false ) showPlayerHudComponent ( source, "armour", false ) showPlayerHudComponent ( source, "breath", false ) showPlayerHudComponent ( source, "clock", false ) showPlayerHudComponent ( source, "health", false ) showPlayerHudComponent ( source, "money", false ) showPlayerHudComponent ( source, "radar", true ) showPlayerHudComponent ( source, "vehicle_name", false ) showPlayerHudComponent ( source, "radio", false ) showPlayerHudComponent ( source, "weapon", false ) showPlayerHudComponent ( source, "wanted", false ) end end addEventHandler ("onPlayerJoin", getRootElement (), function () addEventHandler ( "onResourceStart", source, hudChanger) end ) bindKey( key, "down", hudChanger ) Link to comment
Castillo Posted September 5, 2013 Share Posted September 5, 2013 local key = "F6" function hudChanger ( thePlayer ) showPlayerHudComponent ( thePlayer, "all", ( not isPlayerHudComponentVisible ( thePlayer, "ammo" ) ) ) end addEventHandler ( "onPlayerJoin", getRootElement (), function ( ) bindKey ( source, key, "down", hudChanger ) end ) addEventHandler ( "onResourceStart", resourceRoot, function ( ) for _, player in ipairs ( getElementsByType ( "player" ) ) do bindKey ( player, key, "down", hudChanger ) end end ) 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