Jump to content

Need Help, Account thing.


Panda

Recommended Posts

Hello everyone,

Well first of all i tried to do when i open my panel it appears ACC NAME : "My Account name".

I really can't do it since i can't use getplayeraccount in Client side so this is a part of my script that is related to acc name thing:

 account = guiCreateLabel(56, 138, 65, 16, "ACC NAME :", false, GUIEditor.window[1]) 
        guiSetFont(account, "default-bold-small") 
        account1 = guiCreateLabel(127, 128, 160, 32, "", false, GUIEditor.window[1]) 

In account1, My account name should appear over there. I want it to appear thanks for helping. This is what i tried to do, stupid thing but i have nothing to do:

guiSetText(account1,"I want a player's account name appear here.") 

Thanks everyone.

Link to comment
  
function onJoin () 
    local account = getPlayerAccount (source) 
    local accountName = getAccountName (account) 
    triggerClientEvent ('handleSetGUIText',source,accountName) 
end 
  

If you can write two lines of code, you can complete this.

Link to comment

Yeah i did that and what about client side ? i should add a new function like this?

function hi() 
    guiSetText(account1,"What should i type here?") 
    end 
    addEvent("handleSetGUIText",true) 
    addEventHandler("handleSetGUIText",root,hi) 

Link to comment

--Client Side.

function handleSetText (accountName) 
    guiSetText (account1,accountName) 
end 
addEvent("handleSetGUIText",true) 
addEventHandler("handleSetGUIText",root,handleSetText ) 

--Server Side.

function onJoin () 
    local account = getPlayerAccount (source) 
    local accountName = getAccountName (account) 
    triggerClientEvent ('handleSetGUIText',source,accountName) 
end 

Not working bro :/

Link to comment

replace your serverside file with this one

    function onJoin () 
        local account = getPlayerAccount (source) 
        local accountName = getAccountName (account) 
        triggerClientEvent ('handleSetGUIText',source,source,accountName) 
    end 
addEventHandler("onPlayerJoin",root,onJoin) 

Link to comment

Mate.. It doesn't work Too D:.. Look at this pic, let me show u!

http://i.imgur.com/ZWz19o2.png

It doesn't appear!

Server Side

addEventHandler ('onPlayerLogin',root, 
    function (_, Account) 
        local accountName = getAccountName( Account ) 
        triggerClientEvent ('handleClient',source,accountName) 
    end 
) 

Client Side

    addEvent ('handleClient',true) 
addEventHandler ('handleClient',root, 
    function (accountName) 
        if tostring (accountName) then 
            guiSetText (account1,'Your account name is '..accountName) 
            outputChatbox (accountName) 
        end 
    end 
) 

Link to comment

The text will change once you login.. using /login command

Do /debugscript 3 and post the errors here.

You can change the server side to:

  
addCommandHandler ("acc", 
function (p) 
local account = getPlayerAccount (p) 
local accountName = getAccountName (account) 
triggerClientEvent ('handleClient',source,accountName) 
end 
) 
  

After you change it, have the GUI opened, and do /acc it should work, if it didn't, post /debugscript 3

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