HunT Posted July 3, 2012 Share Posted July 3, 2012 Hi Guyx. I want make a points system in my new project. But i need the example Type with table [First Beat] = {10000} -- name rank and points number etc. . . And events for give the points onClientGUIClick = give 5 points and other GUI events With set/get Accountdat Link to comment
TwiX! Posted July 3, 2012 Share Posted July 3, 2012 wiki will help you no one not will make it for you Link to comment
HunT Posted July 4, 2012 Author Share Posted July 4, 2012 wiki will help youno one not will make it for you Wiki? The wiki can't help me for this. I know the set/get account data etc. . . I need example only for convert the points for rank. Link to comment
12p Posted July 4, 2012 Share Posted July 4, 2012 Did you know about these functions? toJSON fromJSON You can create tables, compress them as JSON strings, and store them as account data. I can't make an example right now, though. Link to comment
HunT Posted July 4, 2012 Author Share Posted July 4, 2012 Did you know about these functions? toJSON fromJSON You can create tables, compress them as JSON strings, and store them as account data. I can't make an example right now, though. I don't know the json Anyway the table is : local tableconsole = { [1] = {"First Beat",100}, [2] = {"other title",200}, } Link to comment
12p Posted July 4, 2012 Share Posted July 4, 2012 I'll try to make a quick summary about how to use this with accounts data. --SAVING someTable = { 5, 13, 96 } --Any table with values within someAccount = getAccount( ... ) --Just some random account element accountData = toJSON( someTable ) --The table is now ready to be account data! BUT you cannot modify it; it's encrypted setAccountData( someAccount, "someDataName", accountData ) --The account now has your encrypted table stored! --LOADING someAccount = getAccount( ... ) --Just some random account element jsonTable = getAccountData( someAccount, "someDataName" ) --Let's get your encrypted table! someTable = fromJSON( jsonTable ) --Now your table is back! Link to comment
HunT Posted July 4, 2012 Author Share Posted July 4, 2012 I'll try to make a quick summary about how to use this with accounts data. --SAVING someTable = { 5, 13, 96 } --Any table with values within someAccount = getAccount( ... ) --Just some random account element accountData = toJSON( someTable ) --The table is now ready to be account data! BUT you cannot modify it; it's encrypted setAccountData( someAccount, "someDataName", accountData ) --The account now has your encrypted table stored! --LOADING someAccount = getAccount( ... ) --Just some random account element jsonTable = getAccountData( someAccount, "someDataName" ) --Let's get your encrypted table! someTable = fromJSON( jsonTable ) --Now your table is back! This is fantastic really tnx Link to comment
HunT Posted July 5, 2012 Author Share Posted July 5, 2012 I make this solution without Jackson First the click: if (source == button name) then triggerServerEvent ( "givePoints", getLocalPlayer()) function pointToRank () local points = tonumber(getAccountData(source,"points")) If point == nil then setAccountData (source,"rankName","The name") setAccountData (source,"rankNumber","The number") elseif points >= number Points then Etc . . . end end addEventHandler( "givePoints", getRootElement(), -- check the account -- get the account -- set the points PointToRank() -- close the function I can't test I'm in usa, anyway maybe work 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