Jump to content

Hud problem


SkatCh

Recommended Posts

Posted

hi guys please i need some help i create a new Hud for my server and it's working fine , but the problem when i try to (reconnect or quit and join again) i can see the Hud with the login panel , i want to see it just when the player join the game i used this event , "onClientHUDRender" , is there anyway to fix it .

i'm sorry about my english .

Posted (edited)
hi guys please i need some help i create a new Hud for my server and it's working fine , but the problem when i try to (reconnect or quit and join again) i can see the Hud with the login panel , i want to see it just when the player join the game i used this event , "onClientHUDRender" , is there anyway to fix it .

i'm sorry about my english .

Explain more about your problem

you want when player login hud will be visible, if Yes use

Edited by Guest
Posted

yes ,

i tried this event "onClientPlayerLogin" but it it doesn't work i still can see the Hud with the login panel .

just i want when the player login hud will be visible not before he login in .

  • Moderators
Posted

It doesn't work, because it doesn't exist, as simple as that.

There is only onPlayerLogin at serverside.

And why there is no "onClientPlayerLogin" event, that is because registrations will only be done at a place where a database is located. (a place where you save user-names and passwords)

All client events:

https://wiki.multitheftauto.com/wiki/Cl ... _Functions

All server events:

https://wiki.multitheftauto.com/wiki/Se ... _Functions

Posted

what are you talking about i didn't undrestand nothing can u explane more or give a solution i don't need Client; server event i know them all but just i want the hud appear when the player join the server in other word when the player click login .

  • Moderators
Posted

Joins the server?

Your solution.

  
addEventHandler("onClientResourceStart",resourceRoot, 
function() 
-- do your gui stuff. 
  
end) 

Posted

i think you don't undrestand what i am talking about , i mean when players join my server they can see the Hud before they login .

i tried all events :

"onClientHUDRender"

"onClientPlayerSpawn"

"onClientPlayerJoin"

but the problem still exist .

  • Moderators
Posted

why don't you show the login later?

Or are you talking about the moment they are downloading the code?

Posted

you can try this,

addEventHandler("onPlayerJoin",root, 
function() 
for k, v in ipairs({"ammo","weapon","wanted","area_name","vehicle_name","health","money","clock"}) do 
 showPlayerHudComponent(source,v,false) 
   end 
  end 
  ) 

Posted
you can try this,
addEventHandler("onPlayerJoin",root, 
function() 
for k, v in ipairs({"ammo","weapon","wanted","area_name","vehicle_name","health","money","clock"}) do 
 showPlayerHudComponent(source,v,false) 
   end 
  end 
  ) 

he can just do that

showPlayerHudComponent(source,"all",false) 

Posted
you can try this,
addEventHandler("onPlayerJoin",root, 
function() 
for k, v in ipairs({"ammo","weapon","wanted","area_name","vehicle_name","health","money","clock"}) do 
 showPlayerHudComponent(source,v,false) 
   end 
  end 
  ) 

he can just do that

showPlayerHudComponent(source,"all",false) 

i alredy know , but there was another topic has the same problem ,

and

showPlayerHudComponent(source,"all",false) didn't work with him when players join ,

He tested what i put above , and it worked,

Posted
why don't you show the login later?

Or are you talking about the moment they are downloading the code?

it didn't work , just i want the Hud appear when the player start playing . i'm talking about my new hud not Gta sa hud .

  • Moderators
Posted

start playing = spawn? -- onClientPlayerSpawn

or start playing = download is done? -- onClientResourceStart

You aren't very clear.

  
 addEventHandler("onClientRender",root, functionName) 
 removeEventHandler("onClientRender",root, functionName) 

Posted
can any one tell me how can i open and close an event with F11 .

i mean i want to use bindKey .

removeEventHandler 

Though, I would use a variable to enable/disable it.

Posted
handlerExist = false 
function openClose() 
    if (handlerExist == false) then 
        handlerExist = true 
        addEventHandler("onClientRender",root,functionName) 
    elseif (handlerExist == true) then 
        handlerExist = false 
        removeEventHandler("onClientRender",root,functionName) 
    end 
end 
bindKey("F11", "down", openClose) 

Posted

By the way, as i understood, he made the HUD not the GTA Hud.

so how will "showPlayerHudComponent(source,"all",false)" work..?!

his HUD isn't a part of GTA HUD, so the function "showPlayerHudComponents(source,"all",false) will only hide the GTA Hud.

Posted

guys can anyone help me i want when the player press F11 = hud open , if he press it again F11 = hud close .

i tried this one but it just close the Hud . ( Not GTA Hud my own Hud )

addEventHandler( "onClientKey", root,  
function(button,press)  
     
    if button == "F11" then 
        removeEventHandler("onClientHUDRender", getRootElement(), HudOpening) 
        else 
    addEventHandler("onClientHUDRender", getRootElement(), HudOpening)   
    end 
     
end ) 

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