• EZData - Please stop using PData!
    3 replies, posted
[B]What is it?[/B] This is a simple script meant to replace the old PData by restructuring the database table, as well as using SteamID64 over the "irreversible" UniqueID. With that said, it is also much easier to move data to a new table or other storage method using EZData. [B]Example:[/B] [CODE] local oldData = sql.Query "SELECT * FROM ez_data WHERE key = 'NickName'" sql.Begin() for _, player in ipairs( oldData ) do sql.Query( string.format( "INSERT INTO player_identity ( sid, nick ) VALUES( %s, %s )", SQLStr( player.sid ), SQLStr( player.key ) ) ) end sql.Commit() [/CODE] [B]Usage:[/B] Take any PData related code and replace PData with EZData. [CODE] Player:SetEZData( key, value ) Player:GetEZData( key, default ) Player:RemoveEZData( key ) util.SetEZData( steamid, key, value ) util.GetEZData( steamid, key, default ) util.RemoveEZData( steamid, key ) [/CODE] EZData is meant to make addon creation easier, but also allow for data to be moved out of the EZData environment later on. [B]Download:[/B] [URL="https://gist.github.com/xbeastguyx/5e784fbb1e8772e8479adb03ea5a7eee"]Download Here[/URL]
The util.SetEZData will error out if the sid does not exist. You may want to do an insert if it does not exist.
If you could add an option to completely override PData with EZData (So there's no need to edit all modules already using PData), and automatically transfer PData to EZData when players join - That'd be really dope
[QUOTE=JasonMan34;52460705]If you could add an option to completely override PData with EZData (So there's no need to edit all modules already using PData), and automatically transfer PData to EZData when players join - That'd be really dope[/QUOTE] Can't be too bad to do, I'll just have to remember to actually give it a shot.
Sorry, you need to Log In to post a reply to this thread.