Jump to content

[INFO] How i can . . .


HunT

Recommended Posts

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

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
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 :D really tnx

Link to comment

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

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