Postado Setembro 27, 2017 7 anos 1 minuto atrás, yanloco70 disse: Altera Storage e vê se resolve poh pode ta em conflito sei la Não sei qual Storage eu coloco, ué ;-; Fala ai uma sla
Postado Setembro 27, 2017 7 anos 1 minuto atrás, MarQuiiM disse: Não sei qual Storage eu coloco, ué ;-; Fala ai uma sla aumenta 1 numero so Desde cedo a mãe da gente fala assim: “Filho, por você jogar Tibia, você tem que ser duas vezes melhor.” Aí passado alguns anos eu pensei: Como fazer 2 vezes melhor, se você tá pelo menos 100 vezes atrasado pelos Nubs, pela história, pelos Items, pelas Guilds, pelos Reds… Por tudo que aconteceu? Duas vezes melhor como ? Ou melhora ou ser o melhor ou o pior de uma vez. E sempre foi assim. Você vai escolher o que tiver mais perto de você, o que tiver dentro da sua realidade. Você vai ser duas vezes melhor como? Quem inventou isso aí? Quem foi o pilantra que inventou isso aí ? Acorda pra vida rapaz. YanLoco Projetos: https://www.facebook.com/Dbo-Here-524519644549602/ 70%
Postado Setembro 28, 2017 7 anos Autor 22 horas atrás, luangop disse: data/talkactions talkactions.xml <talkaction words="/entregar" log="yes" access="6" script="entregar.lua"/> data/talkactions/scripts entregar.lua Mostrar conteúdo oculto function onSay(cid, words, param, channel) local sto = 8445610 -- STORAGE USADO PELO SISTEMA local pontos = 2160 -- ID DOS PONTOS QUE O PLAYER VAI RECEBER local t = string.explode(param, ",") local effect = 506 function forceSetStorage(name, key, value) if not tostring(name) or not tonumber(key) then return nil end local p = getPlayerByName(name) if p then setPlayerStorageValue(p, key, value) else local have = db.storeQuery("SELECT `key` FROM `player_storage` WHERE `player_id` = ".. getPlayerGUIDByName(name) .." and `key` = ".. key) if have then local atual = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id`= ".. getPlayerGUIDByName(name) .." and `key` = ".. key ..";") local temagr = atual:getDataString("value") db.executeQuery("UPDATE `player_storage` SET `value` = '".. temagr + value .."' WHERE `player_id` = '".. getPlayerGUIDByName(name) .."' AND `key` = ".. key) else local pid = getPlayerGUIDByName(name) db.executeQuery("INSERT INTO `player_storage` (`player_id` ,`key` ,`value`) VALUES ('".. pid .."', '".. key .."', '".. value .."');") end end return true end if param == "" or not t[2] then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite /entregar NICK, QUANTIA DE ".. getItemNameById(pontos) .."") end local player = getPlayerByNameWildcard(tostring(t[1])) local pos = getCreaturePosition(player) local quantia = tonumber(t[2]) local file = io.open('data/logs/entregar-log.txt','a') file:write("Dia: "..os.date("%d").."/"..os.date("%m").."/"..os.date("%Y").." Hora: "..os.date("%X").." :::: ".. quantia .." ".. getItemNameById(pontos) .." entregues para '".. t[1] .."'\n") file:close() if not isPlayer(player) then forceSetStorage(t[1], sto, quantia) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Dia: "..os.date("%d").."/"..os.date("%m").."/"..os.date("%Y").." Hora: "..os.date("%X").." :::: ".. quantia .." ".. getItemNameById(pontos) .." entregues para '".. t[1] .."'") return true end local atual = getPlayerStorageValue(cid, sto) if atual <= 0 then tem = 0 else tem = atual end setPlayerStorageValue(player, sto, quantia + tem) doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_BLUE, "".. getPlayerName(cid) .." te entregou ".. quantia .." ".. getItemNameById(pontos) .."'s!\nVa ate o bau para receber.") doSendMagicEffect(pos, effect) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Dia: "..os.date("%d").."/"..os.date("%m").."/"..os.date("%Y").." Hora: "..os.date("%X").." :::: ".. quantia .." ".. getItemNameById(pontos) .." entregues para '".. t[1] .."'") return true end data/actions actions.xml <action actionid="65470" event="script" value="BauDonate.lua"/> *actionid="65470" <~~ Action do bau no map-editor. data/actions/scripts BauDonate.lua Mostrar conteúdo oculto function onUse(cid, item, frompos, item2, topos) local sto = 8445610 -- STORAGE USADO PELO SISTEMA local pontos = 2160 -- ID DOS PONTOS QUE O PLAYER VAI RECEBER local delaySto = 8445611 -- STORAGE USADO PARA DAR DELAY NO BAU local status = getPlayerStorageValue(cid, sto) local statusDelay = getPlayerStorageValue(cid, delaySto) local delay = os.time() + 30 -- TEMPO DE DELAY PARA PODER ABRIR O BAU NOVAMENTE E EVITAR BUG if statusDelay <= os.time() then if status >= 1 then doPlayerAddItem(cid, pontos, sto) setPlayerStorageValue(cid, sto, 0) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce recebeu ".. sto .." ".. getItemNameById(pontos) .."'s!") local file = io.open('data/logs/entregue-log.txt','a') doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Dia: "..os.date("%d").."/"..os.date("%m").."/"..os.date("%Y").." Hora: "..os.date("%X").." :::: ".. sto .." ".. getItemNameById(pontos) .." recebido por '".. getCreatureName(cid) .."'") file:close() setPlayerStorageValue(cid, delaySto, delay) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao tem ".. getItemNameById(pontos) .."'s para receber! Se fez alguma doacao, espere pela confirmacao do ADM.") setPlayerStorageValue(cid, delaySto, delay) return true end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Espere ".. statusDelay - os.time() .." segundos para tentar abrir o bau novamente!") return true end end Observações: O comando que criei pra vc armazena um log em data/logs com nome de entregar-log.txt com todos os detalhes dos pontos entregues. A action do bau armazena um log em data/logs com nome de entregue-log.txt com todos os detalhes de quando alguem recebe os pontos no bau. Qualquer dúvida e só avisar, mas como já deve ter percebido eu demoro um pouco a responder rsrs. O meu meio q funciona so q eu n recebo os pontos
Postado Setembro 28, 2017 7 anos Autor Em 26/09/2017 em 23:41, luangop disse: data/talkactions talkactions.xml <talkaction words="/entregar" log="yes" access="6" script="entregar.lua"/> data/talkactions/scripts entregar.lua Ocultar conteúdo function onSay(cid, words, param, channel) local sto = 8445610 -- STORAGE USADO PELO SISTEMA local pontos = 2160 -- ID DOS PONTOS QUE O PLAYER VAI RECEBER local t = string.explode(param, ",") local effect = 506 function forceSetStorage(name, key, value) if not tostring(name) or not tonumber(key) then return nil end local p = getPlayerByName(name) if p then setPlayerStorageValue(p, key, value) else local have = db.storeQuery("SELECT `key` FROM `player_storage` WHERE `player_id` = ".. getPlayerGUIDByName(name) .." and `key` = ".. key) if have then local atual = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id`= ".. getPlayerGUIDByName(name) .." and `key` = ".. key ..";") local temagr = atual:getDataString("value") db.executeQuery("UPDATE `player_storage` SET `value` = '".. temagr + value .."' WHERE `player_id` = '".. getPlayerGUIDByName(name) .."' AND `key` = ".. key) else local pid = getPlayerGUIDByName(name) db.executeQuery("INSERT INTO `player_storage` (`player_id` ,`key` ,`value`) VALUES ('".. pid .."', '".. key .."', '".. value .."');") end end return true end if param == "" or not t[2] then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite /entregar NICK, QUANTIA DE ".. getItemNameById(pontos) .."") end local player = getPlayerByNameWildcard(tostring(t[1])) local pos = getCreaturePosition(player) local quantia = tonumber(t[2]) local file = io.open('data/logs/entregar-log.txt','a') file:write("Dia: "..os.date("%d").."/"..os.date("%m").."/"..os.date("%Y").." Hora: "..os.date("%X").." :::: ".. quantia .." ".. getItemNameById(pontos) .." entregues para '".. t[1] .."'\n") file:close() if not isPlayer(player) then forceSetStorage(t[1], sto, quantia) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Dia: "..os.date("%d").."/"..os.date("%m").."/"..os.date("%Y").." Hora: "..os.date("%X").." :::: ".. quantia .." ".. getItemNameById(pontos) .." entregues para '".. t[1] .."'") return true end local atual = getPlayerStorageValue(cid, sto) if atual <= 0 then tem = 0 else tem = atual end setPlayerStorageValue(player, sto, quantia + tem) doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_BLUE, "".. getPlayerName(cid) .." te entregou ".. quantia .." ".. getItemNameById(pontos) .."'s!\nVa ate o bau para receber.") doSendMagicEffect(pos, effect) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Dia: "..os.date("%d").."/"..os.date("%m").."/"..os.date("%Y").." Hora: "..os.date("%X").." :::: ".. quantia .." ".. getItemNameById(pontos) .." entregues para '".. t[1] .."'") return true end data/actions actions.xml <action actionid="65470" event="script" value="BauDonate.lua"/> *actionid="65470" <~~ Action do bau no map-editor. data/actions/scripts BauDonate.lua Ocultar conteúdo function onUse(cid, item, frompos, item2, topos) local sto = 8445610 -- STORAGE USADO PELO SISTEMA local pontos = 2160 -- ID DOS PONTOS QUE O PLAYER VAI RECEBER local delaySto = 8445611 -- STORAGE USADO PARA DAR DELAY NO BAU local status = getPlayerStorageValue(cid, sto) local statusDelay = getPlayerStorageValue(cid, delaySto) local delay = os.time() + 30 -- TEMPO DE DELAY PARA PODER ABRIR O BAU NOVAMENTE E EVITAR BUG if statusDelay <= os.time() then if status >= 1 then doPlayerAddItem(cid, pontos, sto) setPlayerStorageValue(cid, sto, 0) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce recebeu ".. sto .." ".. getItemNameById(pontos) .."'s!") local file = io.open('data/logs/entregue-log.txt','a') doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Dia: "..os.date("%d").."/"..os.date("%m").."/"..os.date("%Y").." Hora: "..os.date("%X").." :::: ".. sto .." ".. getItemNameById(pontos) .." recebido por '".. getCreatureName(cid) .."'") file:close() setPlayerStorageValue(cid, delaySto, delay) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao tem ".. getItemNameById(pontos) .."'s para receber! Se fez alguma doacao, espere pela confirmacao do ADM.") setPlayerStorageValue(cid, delaySto, delay) return true end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Espere ".. statusDelay - os.time() .." segundos para tentar abrir o bau novamente!") return true end end Consegui, tinha esquecido de colocar no actions .xml, porem agora qnd abro o bau de donate levo debug Observações: O comando que criei pra vc armazena um log em data/logs com nome de entregar-log.txt com todos os detalhes dos pontos entregues. A action do bau armazena um log em data/logs com nome de entregue-log.txt com todos os detalhes de quando alguem recebe os pontos no bau. Qualquer dúvida e só avisar, mas como já deve ter percebido eu demoro um pouco a responder rsrs.
Postado Setembro 28, 2017 7 anos @Chargustavin Usa assim: Spoiler function onSay(cid, words, param, channel) local sto = 8445610 -- STORAGE USADO PELO SISTEMA local pontos = 2160 -- ID DOS PONTOS QUE O PLAYER VAI RECEBER local t = string.explode(param, ",") local effect = 50 if param == "" or not t[2] then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite /entregar NICK, QUANTIA DE ".. getItemNameById(pontos) .."") end local player = getPlayerByNameWildcard(tostring(t[1])) local quantia = tonumber(t[2]) if not t[2] then quantia = 1 end local file = io.open('data/logs/entregar-log.txt','a') file:write("Dia: "..os.date("%d").."/"..os.date("%m").."/"..os.date("%Y").." Hora: "..os.date("%X").." :::: ".. quantia .." ".. getItemNameById(pontos) .." entregues para '".. t[1] .."'\n") file:close() if not isPlayer(player) then forceSetStorage(t[1], sto, quantia) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Dia: "..os.date("%d").."/"..os.date("%m").."/"..os.date("%Y").." Hora: "..os.date("%X").." :::: ".. quantia .." ".. getItemNameById(pontos) .." entregues para '".. t[1] .."'") return true end if isPlayer(player) then local pos = getCreaturePosition(player) doSendMagicEffect(pos, effect) end local atual = getPlayerStorageValue(cid, sto) if atual <= 0 then tem = 0 else tem = atual end setPlayerStorageValue(player, sto, quantia + tem) doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_BLUE, "".. getPlayerName(cid) .." te entregou ".. quantia .." ".. getItemNameById(pontos) .."'s!\nVa ate o bau para receber.") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Dia: "..os.date("%d").."/"..os.date("%m").."/"..os.date("%Y").." Hora: "..os.date("%X").." :::: ".. quantia .." ".. getItemNameById(pontos) .." entregues para '".. t[1] .."'") return true end function forceSetStorage(name, key, value) if not tostring(name) or not tonumber(key) then return nil end local p = getPlayerByName(name) if p then setPlayerStorageValue(p, key, value) else local have = db.getResult("SELECT `key` FROM `player_storage` WHERE `player_id` = ".. getPlayerGUIDByName(name) .." and `key` = ".. key) if have:getID() == -1 then local pid = getPlayerGUIDByName(name) db.query("INSERT INTO `player_storage` (`player_id` ,`key` ,`value`) VALUES ('".. pid .."', '".. key .."', '".. value .."');") return true end local atual = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id`= ".. getPlayerGUIDByName(name) .." and `key` = ".. key ..";") local temagr = atual:getDataInt("value") db.query("UPDATE `player_storage` SET `value` = '".. temagr + value .."' WHERE `player_id` = '".. getPlayerGUIDByName(name) .."' AND `key` = ".. key) end return true end E para o baú: Spoiler function onUse(cid, item, frompos, item2, topos) local sto = 8445610 -- STORAGE USADO PELO SISTEMA local pontos = 13551 -- ID DOS PONTOS QUE O PLAYER VAI RECEBER local delaySto = 8445611 -- STORAGE USADO PARA DAR DELAY NO BAU local status = getPlayerStorageValue(cid, sto) local statusDelay = getPlayerStorageValue(cid, delaySto) local delay = os.time() + 30 -- TEMPO DE DELAY PARA PODER ABRIR O BAU NOVAMENTE E EVITAR BUG if statusDelay <= os.time() then if status >= 1 then local file = io.open('data/logs/entregue-log.txt','a+') log = file:write("Dia: "..os.date("%d").."/"..os.date("%m").."/"..os.date("%Y").." Hora: "..os.date("%X").." :::: ".. status .." ".. getItemNameById(pontos) .." recebido por '".. getCreatureName(cid) .."'\n") file:close() doPlayerAddItem(cid, pontos, status) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce recebeu ".. status .." ".. getItemNameById(pontos) .."'s!") setPlayerStorageValue(cid, sto, 0) setPlayerStorageValue(cid, delaySto, delay) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao tem ".. getItemNameById(pontos) .."'s para receber! Se fez alguma doacao, espere pela confirmacao do ADM.") setPlayerStorageValue(cid, delaySto, delay) return true end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Espere ".. statusDelay - os.time() .." segundos para tentar abrir o bau novamente!") return true end end Editado Setembro 28, 2017 7 anos por Dwarfer (veja o histórico de edições) 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.