Jump to content

Cadu12

Retired Staff
  • Posts

    827
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Cadu12

  1. Well, next time, you should write if your isnt FULL code, becuase we can't get know if your code is full. You're welcome
  2. Replace 'source' with 'v'. Next time, fix your eyes
  3. So, is problem already solved?
  4. 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.
  5. If you are using 'getElementsByType("player")' > Use 'getPlayerAccount(v)' becuase 'v' returns 'player', not 'account' Other problem, about your new function, I can't getting understand what you are talking about. Should be 'gang', and not 'data'?
  6. 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.
  7. Do you mean you are making new function for array(toJSON)?
  8. Did you made your own new function?
  9. There is no need to use getPlayerAccount, just use getAccountData(v, "...")
  10. function onPlayerLogin(thePreviousAccount, theCurrentAccount) -- Attempt to load data local theAccountQuery = dbQuery(theHandler, "SELECT * FROM account_stats WHERE player_name='?'", getAccountName(theCurrentAccount)) local theAccountResult = dbPoll(theAccountQuery, -1) if (theAccountResult) then outputChatBox("FOUND ACCOUNT!", source) outputChatBox(theAccountResult[1]['player_name'], source) -- Doesnt Work else outputChatBox("DATA NOT FOUND!", source) end -- Free Query dbFree(theAccountQuery) end addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin) Should it work, I guess. Not tested yet.
  11. Returns the row id if it has been created, false otherwise. Next time, you should read wiki about that function.
  12. Cadu12

    [TUT] SQLite

    executeSQLQuery("DELETE * FROM tableName") -- It will delete all rows
  13. Line at 109: "getaccountdata" replace with "getAccountData"
  14. function ads(player,...) local text = table.concat({...}, " ") if (getPlayerMoney(player) >= 300) then outputChatBox("Advertisment: ".. text .."!", root, 0, 100, 0) takePlayerMoney(player, 300) end end addCommandHandler("ad", ads)
  15. Well, I got ideas how to make when I was in bathroom, but I am not going make. Try go in your bathroom and get your some ideas. Read what myonlake said, and I agree.
  16. Did you changed to client-side for pickup? You can use setTimer
  17. Cadu12

    AFK Script

    Try check your meta.xml.
  18. Agree with Solidsnake. Ontopic: Do it own by yourself, these scripts were not made by you, or just ask NexTreme to fix problems. Im not sure, but you can't use these scripts.
  19. MTA has own limit. Take a look: http://code.google.com/searchframe#KdIe ... q=&l=10494 Limit: 128
  20. Maybe I understand you, are you talking about multi-gamemodes?
  21. If am I right, you can use triggerEventClient after loadstring.
  22. https://dl.dropbox.com/u/69022807/retard.png He sent me when I was sleeping. For me, that guy isn't great becuase of it.
  23. @Anderl: Você está falando que? Aqui em Português, mas tudo bem. I didn't tested what I did rewrite script.
×
×
  • Create New...