Postado Setembro 28, 2017 7 anos Olá a todos, existe alguma maneira de setar uma storage para a conta inteira? Exemplo: Seria uma quest que só uma conta poderia fazer, ao fazer mais nenhum char de sua conta poderá realiza-la.
Postado Setembro 28, 2017 7 anos acho que tem sim.. mas voce teria que criar uma nova coluna na tabela das contas e no script da quest, definir uma query pra checar se aquela conta tem essa storage.
Postado Setembro 28, 2017 7 anos Solução Vê assim: Spoiler local storage = 11111 local id,count = 2160,10 function onUse(cid, item, fromPosition, itemEx, toPosition) if getStorageAccount(cid, storage, 1) or getPlayerStorageValue(cid, storage) ~= -1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You can do this quest only once by account.") return true end doPlayerAddItem(cid, id, count) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have found " .. count .. " " .. getItemNameById(id) .. ".") setPlayerStorageValue(cid, storage, 1) return true end function getStorageAccount(cid, key, value) local chars = {} local query = db.getResult("SELECT `id` FROM `players` WHERE `account_id` = '"..getPlayerAccountId(cid).."';") if query:getID() == -1 then return true end repeat local player = query:getDataString("id") table.insert(chars, player) until not query:next() query:free() for i = 1, #chars do local check = db.getResult("SELECT * FROM `player_storage` WHERE `player_id` = '"..chars[i].."' and `key` = '"..key.."' and `value` = '"..value.."';") if check:getID() == 0 then return true end end return false end Não testei, qualquer erro diz aí. Contato: Email: [email protected] Discord: Dwarfer#2715
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.