Muito útil essa função. Ajuda a criar alguns scripts que seriam um saco sem ela.
- Forums
- OTServ
- Recursos
- Scripting
- Mods, funções e outros
- AccountStorageValue
KI
AccountStorageValue
By Killua, 06 de set. de 2013 in Mods, funções e outros
accountstorage
storagevalue
getaccountstoragevalue
setaccountstoragevalue
accountstoragevalue
4
2k
info
Group: Marquês
Joined: 16/06/07
Posts: 1.2k
Reputation: +377
Gender: Masculino
Tibia Character: Nenhum

09 de setembro de 2013 às 23:19
2 weeks later...
18 de setembro de 2013 às 00:18
.
Edited Setembro 18 by kaximbum
6 months later...
info
Group: Artesão
Joined: 10/11/11
Posts: 118
Reputation: +2

23 de março de 2014 às 20:13
Error ejecutando consulta: near "unsigned": syntax error
<simple query executor>




info
Group: Conde
Joined: 29/04/09
Posts: 904
Reputation: +389
Tibia Character: Jabuti Selvagem
Achei essa função em outro forum e decidi postar aqui pq ela é muuito util.
Antes de qualquer coisa execute essa query na sua db:
E no data/lib/050-function.lua adiciona o codigo
function getAccountStorageValue(accid, key) local value = db.getResult("SELECT `value` FROM `account_storage` WHERE `account_id` = " .. accid .. " and `key` = " .. key .. " LIMIT 1;") if(value:getID() ~= -1) then return value:getDataInt("value") else return -1 end value:free() end function setAccountStorageValue(accid, key, value) local getvalue = db.getResult("SELECT `value` FROM `account_storage` WHERE `account_id` = " .. accid .. " and `key` = " .. key .. " LIMIT 1;") if(getvalue:getID() ~= -1) then db.executeQuery("UPDATE `account_storage` SET `value` = " .. accid .. " WHERE `key`=" .. key .. " LIMIT 1');") getvalue:free() return 1 else db.executeQuery("INSERT INTO `account_storage` (`account_id`, `key`, `value`) VALUES (" .. accid .. ", " .. key .. ", '"..value.."');") return 1 end endModo de uso:
Os créditos são do teckman por criar a função e do Matheus por postar no outro fórum.
Edited Fevereiro 14 by Killua