Jump to content

getElementData. offline player


fairyoggy

Recommended Posts

You can not do that, elementData is temporary, what you can that about is using setAccountData (when the player leaves save elementData) and getAccountData (get the data saved by the account)

 

Try this:

-- load elementData
function load(_, account)
    local name = getAccountData(account, "name") or "N/A"

    setElementData(source, "name", name)
end
addEventHandler("onPlayerLogin", getRootElement(), load)

-- save elementData
function save()
    local name = getElementData(source, "name") or "N/A"

    setAccountData(getPlayerAccount(source), "name", name)
end
addEventHandler("onPlayerQuit", getRootElement(), save)

-- find elementAccount
function find (source, cmd, playerAccount)
    if cmd and playerAccount then
        if getAccount(playerAccount) then
            local gName = getAccountData(getAccount(playerAccount), "name")

            outputChatBox("Name of "..playerAccount.." is #FFFFFF"..""..gName, source, 152, 95, 161, true)
        end
    end
end
addCommandHandler("find", find)

EDIT: I do not tested!

Edited by Tommy.
  • Like 1
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...