scaryface87 Posted August 25, 2015 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
Dealman Posted August 25, 2015 Posted August 25, 2015 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.
Walid Posted August 25, 2015 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. 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
scaryface87 Posted August 25, 2015 Author 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
Walid Posted August 25, 2015 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 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
scaryface87 Posted August 25, 2015 Author Posted August 25, 2015 Hello , Im sorry but vipPlayer wont be defined by now? Sorry im still learning (didnt test the code tought) Greetings
Castillo Posted August 25, 2015 Posted August 25, 2015 You could use element data, when the player logins, check if VIP, then set the element data. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
scaryface87 Posted August 25, 2015 Author 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.
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