scaryface87 Posted August 25, 2015 Share Posted August 25, 2015 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
Dealman Posted August 25, 2015 Share Posted August 25, 2015 Read about these 2 functions; triggerServerEvent triggerClientEvent Link to comment
Walid Posted August 25, 2015 Share Posted August 25, 2015 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
scaryface87 Posted August 25, 2015 Author Share Posted August 25, 2015 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 Link to comment
Walid Posted August 25, 2015 Share Posted August 25, 2015 you need to use guiSetEnabled() -- Example function functionName (vipPlayer) if (vipPlayer) then guiSetEnabled (yourButtonHere, false ) else guiSetEnabled (yourButtonHere, true ) end end Link to comment
scaryface87 Posted August 25, 2015 Author Share Posted August 25, 2015 Hello , Im sorry but vipPlayer wont be defined by now? Sorry im still learning (didnt test the code tought) Greetings Link to comment
Castillo Posted August 25, 2015 Share Posted August 25, 2015 You could use element data, when the player logins, check if VIP, then set the element data. Link to comment
scaryface87 Posted August 25, 2015 Author Share Posted August 25, 2015 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. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now