Jump to content

getAccountData Extra Data?


GhostXoP

Recommended Posts

local _getAccountData = getAccountData 
local _setAccountData = setAccountData 
  
function getAccountData(account, key, json) 
    if (not json) then json = false end 
  
    if (json) then 
        local count = _getAccountData(account, key) 
        local jsonstring = "" 
        if (tonumber(count)) then 
            for i = 1, count do 
                local jsonsub = _getAccountData(account, key + i) 
                jsonstring = jsonstring + jsonsub 
            end 
        end 
        return fromJSON(jsonstring) 
    else 
        return _getAccountData(account, key) 
    end 
end 

Try test it, I can't test myself.

Edited by Guest
Link to comment

--

No. I already wrote my version, if i didn't, i wouldn't be here.

The data DOES SAVE, I get

--

EXAMPLE

HelloWorld, I am not Human <- as it should be

HelloWorld rld, I am not Human. this is just an example of how it comes out, over lapped. My bottom code retrieving the blocks, do as they should and retrieve in order but, it comes out over lapped. (Which means Look at Retrieval code)

In a nut shell, --, turn the string into an array, then return it. Its returning it over lapped. This is not the fault of my save code, because i have showing (in the image) proof that it saved correctly, with the correct key number order.

Edited by Guest
Link to comment

I had printed the data out to debug and it is all intact! it looks exactly as it should before JSONing it, but when i do, it says the sub array Weapons does not contain a --, it says its nil. Is there a chance fromJSON isnt completely creating the array?

Edited by Guest
Link to comment
local _getAccountData = getAccountData 
local _setAccountData = setAccountData 
  
function getAccountData(account, key) 
    local checkifhasjson = false 
     
    local number = _getAccountData(account, key) 
    if (tonumber(number)) then 
        local json = _getAccountData(account, key .. "0") 
        if (#json ~= 0 and json ~= "") then checkifhasjson = true end 
    end 
     
    if (checkifhasjson) then 
        local count = _getAccountData(account, key) 
        local jsonstring = "" 
        if (tonumber(count)) then 
            for i = 0, count do 
                local jsonsub = _getAccountData(account, key .. i) 
                jsonstring = jsonstring .. jsonsub 
            end 
        end 
        return fromJSON(jsonstring) 
    else 
        return _getAccountData(account, key) 
    end 
end 
  
function setAccountData(account, key, value) 
    local jsonstring = toJSON(value) 
    if (tostring(key) and tostring(value)) then 
        if (#jsonstring >= 128) then 
            local count = 0 
            while (true) do              
                _setAccountData(account, key .. count, string.sub(jsonstring, count * 64 + 1, (count + 1) * 64)) 
                if (not (#string.sub(jsonstring, count * 64 + 1, (count + 1) * 64) >= 64)) then 
                    break 
                end 
                count = count + 1 
            end 
            _setAccountData(account, key, count) 
        else 
            _setAccountData(account, key, value) 
        end 
    end 
end 

You should use my new function that allowed json without limits.

Link to comment

Yours basically stores in blocks, using json right?

Because its exactly what mine does, and mine does everything correctly, stand by and ill have pictures

--

See, it works. I fromJSON the string, and send it to the client, the client gets the array and then it says the variables ammo and id within the array [22] within Weapons does not exist. Why is this? Its right there in the string, in good format, isn't it?

Edited by Guest
Link to comment
Edit: Good boy, No Cussing.

What do you really think , all your posts is barely stupid questions..

next time read the wiki
It's simple to read
It says password is optional, but required. It says if its not specified i can still get the account whatever the password is. otherwise the password must match the account.
I have tried to use
warpPedIntoVehicle(source, VEHICLE) 

and this does not seem to be working

How can i spawn the player into a vehicle otherwise?(This is server side within an event handler triggered by the player)

edit: if you think i'm a little kid like you , then you better back it off

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