Jump to content

getAccountData to clientside?


scaryface87

Recommended Posts

Hello ,

I wanna use getAccountData to save data for a system.

So now i got a problem.

I wanna use getAccountData result into client side (i know its server side only)

So i wanna make a "VIP" button if the getAccountData returns true.

For example

  
function test(playerSource) 
local playerAccount = getPlayerAccount(playerSource) 
if getAccountData(playerAccount,"vip") then 
-- here it should go to client side i guess but then i end up in a problem.(check the next lua box) 
end 
end 
  

  
--- a quick gui 
function theGui() 
        window = guiCreateWindow(216, 118, 387, 281, "", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
  
        button = guiCreateButton(23, 193, 342, 78, "VIP.", false, window) 
--- Here i should make a trigger for getting the account data which i cant due fact getAccountData is server side only 
button = guiCreateButton(23, 193, 342, 78, "Not Vip.", false, window) 
end 
  

Sorry for bad explaination

Link to comment
function FunctionName(playerSource) 
    local playerAccount = getPlayerAccount(playerSource) 
        if playerAccount and not isGuestAccount(playerAccount) then 
            if getAccountData(playerAccount,"vip") then 
            triggerClientEvent(playerSource,"checkVipPlayer",playerSource) 
        end 
    end 
end 
addCommandHandler("vip",FunctionName) 

then do what you want on the client side.

Link to comment

you need to use

guiSetEnabled() 

-- Example

function functionName (vipPlayer)         
        if (vipPlayer) then            
            guiSetEnabled (yourButtonHere, false ) 
        else               
            guiSetEnabled (yourButtonHere, 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...