Jump to content

[HELP] Show hud after login


aguia

Recommended Posts

There are 2 events to uses in this situation, first one onPlayerJoin that mean when the player join into the server but his account still guest in this case you can hide it

second event is onPlayerLogin as Deelman said, it's about the player who logged in with an account so in this case you can make it visible

Link to comment
function toggleRadar() 
    if isVisible then 
        addEventHandler("onPlayerLogin", root, HUDNAME) 
    else 
        removeEventHandler("onPlayerLogin", root, HUDNAME) 
    end 
    isVisible = not isVisible 
end 

I made this, going to test in game right now

--Not working

* A question:

If I place the event "onPlayerLogin" there, I must to edit the meta file (exporting something from the Login folder)?

Edited by Guest
Link to comment
function toggleRadar() 
    if isVisible then 
        addEventHandler("onPlayerLogin", root, HUDNAME) 
    else 
        removeEventHandler("onPlayerLogin", root, HUDNAME) 
    end 
    isVisible = not isVisible 
end 

I made this, going to test in game right now

--Not working

* A question:

If I place the function "onPlayerLogin" there, I must to edit the meta file (exporting something from the Login folder)?

onPlayerLogin is event not function. Maybe you should spend more time reading the wiki?

https://wiki.multitheftauto.com/wiki/Scripting_Introduction

Link to comment
function showHud() 
    showPlayerHudComponent(source, "radar", true) 
end 
addEventHandler("onPlayerLogin", getRootElement(), showHud) 
  
function hideHud() 
    showPlayerHudComponent(source, "radar", false) 
end 
addEventHandler("onPlayerConnect", getRootElement(), hideHud) 

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