Jump to content

help


killeryoyo

Recommended Posts

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

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
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
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
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
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
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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...