Jump to content

getAccountData to clientside?


scaryface87

Recommended Posts

Posted

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

Posted

Read about these 2 functions;

triggerServerEvent 
triggerClientEvent 

If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.

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

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

Hello ,

If i do this it wont hide "VIP" button incase he isnt vip or am i wrong? , the gui should popup even if he isnt VIP but the vip button gota be removed

Greetings ,

ScaryFace87

Posted

you need to use

guiSetEnabled() 

-- Example

function functionName (vipPlayer)         
        if (vipPlayer) then            
            guiSetEnabled (yourButtonHere, false ) 
        else               
            guiSetEnabled (yourButtonHere, true ) 
        end 
end 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

You could use element data, when the player logins, check if VIP, then set the element data.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
You could use element data, when the player logins, check if VIP, then set the element data.

Aaah that i didnt think about that.

Thank you very much i'm going to try it.

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