Jump to content

[INFO] How i can . . .


HunT

Recommended Posts

Posted

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

Posted
wiki will help you

no one not will make it for you

Wiki? :-D

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.

Posted

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.

Posted
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},

}

Posted

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! 

Posted
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

Posted

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

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