killeryoyo Posted December 23, 2015 Share Posted December 23, 2015 Hello guys why when the player spawns the hud doesnt hide whats the error here pfff. function hudChanger () showPlayerHudComponent ( source, "radar", false ) showPlayerHudComponent ( source, "ammo", false ) showPlayerHudComponent ( source, "weapon", false ) showPlayerHudComponent ( source, "area_name", false ) showPlayerHudComponent ( source, "wanted", false ) showPlayerHudComponent ( source, "wanted", false ) showPlayerHudComponent ( source, "money", false ) showPlayerHudComponent ( source, "health", false ) showPlayerHudComponent ( source, "clock", false ) showPlayerHudComponent ( source, "vehiclename", false ) end addEventHandler ( "onClientPlayerSpawn", getRootElement(), hudChanger ) I tried onPlayerSpawn and it didnt tried with client it didnt. i tried with onPlayerSpawnsuccessful it didnt. I passed it to client but it didnt work to. whats wrong? Link to comment
killeryoyo Posted December 23, 2015 Author Share Posted December 23, 2015 now the radar the only is showing and the upper hud is hidden. what to do now? i made only the radar true Link to comment
draobrehtom Posted December 23, 2015 Share Posted December 23, 2015 When you use showPlayerHudComponent on client, you dont need first argument (player)- bool setPlayerHudComponentVisible ( string component, bool show ). Try this code and next time use debugscript 3, which shows all errors. function hudChanger () showPlayerHudComponent ("radar", false ) showPlayerHudComponent ("ammo", false ) showPlayerHudComponent ("weapon", false ) showPlayerHudComponent ("area_name", false ) showPlayerHudComponent ("wanted", false ) showPlayerHudComponent ("wanted", false ) showPlayerHudComponent ("money", false ) showPlayerHudComponent ("health", false ) showPlayerHudComponent ("clock", false ) showPlayerHudComponent ("vehiclename", false ) end addEventHandler ( "onClientPlayerSpawn", getRootElement(), hudChanger ) Link to comment
killeryoyo Posted December 23, 2015 Author Share Posted December 23, 2015 When you use showPlayerHudComponent on client, you dont need first argument (player)- bool setPlayerHudComponentVisible ( string component, bool show ). Try this code and next time use debugscript 3, which shows all errors. function hudChanger () showPlayerHudComponent ("radar", false ) showPlayerHudComponent ("ammo", false ) showPlayerHudComponent ("weapon", false ) showPlayerHudComponent ("area_name", false ) showPlayerHudComponent ("wanted", false ) showPlayerHudComponent ("wanted", false ) showPlayerHudComponent ("money", false ) showPlayerHudComponent ("health", false ) showPlayerHudComponent ("clock", false ) showPlayerHudComponent ("vehiclename", false ) end addEventHandler ( "onClientPlayerSpawn", getRootElement(), hudChanger ) well though the radar is still showing up. when i start the resource. both hides. When i spawn with the spawn screen the radar comes back] + there is no errors. Post updated Link to comment
draobrehtom Posted December 23, 2015 Share Posted December 23, 2015 (edited) Check your meta.xml. Is your script on client? Edited December 23, 2015 by Guest Link to comment
killeryoyo Posted December 23, 2015 Author Share Posted December 23, 2015 Check your meta.xml. Is you script in client? "test" /> Link to comment
draobrehtom Posted December 23, 2015 Share Posted December 23, 2015 You must search error in your code or somewhere else. Try to 'refresh all' in console MTA server, try to restart server. If you want, I can give you working script with this function and you can check, where you have errors. Also, put outputChatBox() in function, to check is it work. Link to comment
draobrehtom Posted December 23, 2015 Share Posted December 23, 2015 http://rghost.net/844nRnC2r Link to comment
killeryoyo Posted December 23, 2015 Author Share Posted December 23, 2015 You must search error in your code or somewhere else. Try to 'refresh all' in console MTA server, try to restart server. If you want, I can give you working script with this function and you can check, where you have errors. Also, put outputChatBox() in function, to check is it work. here are the errors finally shown after the server restart. the script needs argument 1 how to do it? http://imgur.com/GTvgFpT Link to comment
killeryoyo Posted December 23, 2015 Author Share Posted December 23, 2015 http://rghost.net/844nRnC2r it has the same errors to. Link to comment
draobrehtom Posted December 23, 2015 Share Posted December 23, 2015 You must search error in your code or somewhere else. Try to 'refresh all' in console MTA server, try to restart server. If you want, I can give you working script with this function and you can check, where you have errors. Also, put outputChatBox() in function, to check is it work. here are the errors finally shown after the server restart. the script needs argument 1 how to do it? http://imgur.com/GTvgFpT You need put argument (in this example it string). Check Wiki please. Example - outputChatBox("Example string hello world") Link to comment
killeryoyo Posted December 23, 2015 Author Share Posted December 23, 2015 You must search error in your code or somewhere else. Try to 'refresh all' in console MTA server, try to restart server. If you want, I can give you working script with this function and you can check, where you have errors. Also, put outputChatBox() in function, to check is it work. here are the errors finally shown after the server restart. the script needs argument 1 how to do it? http://imgur.com/GTvgFpT You need put argument (in this example it string). Check Wiki please. Example - outputChatBox("Example string hello world") thanks for helping, but i didnt understand still. Anyone could help? Link to comment
Perfect Posted December 23, 2015 Share Posted December 23, 2015 function hudChanger () showPlayerHudComponent ("radar", false ) showPlayerHudComponent ("ammo", false ) showPlayerHudComponent ("weapon", false ) showPlayerHudComponent ("area_name", false ) showPlayerHudComponent ("wanted", false ) showPlayerHudComponent ("wanted", false ) showPlayerHudComponent ("money", false ) showPlayerHudComponent ("health", false ) showPlayerHudComponent ("clock", false ) showPlayerHudComponent ("vehicle_name", false ) -- This is vehicle_name not vehiclename outputChatBox("Huds has been disabled", 0, 255, 0, true) -- Replace with message you want to show in this format end addEventHandler ( "onClientPlayerSpawn", getRootElement(), hudChanger ) Link to comment
#RooTs Posted December 23, 2015 Share Posted December 23, 2015 Try this local hudTable = { "radar", "ammo", "weapon", "area_name", "wanted", "money", "health", "clock", "vehicle_name" } 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
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