Skymagnum 234 Postado Fevereiro 12, 2013 Share Postado Fevereiro 12, 2013 Tipo: Talkaction. Testado: Não. Breve explicação É uma talkaction, que serve para que quando você está morrendo você use ela, e então quando você morrer, você fala !return, e volta para aonde você morreu ou salvou, é simples assim. Fácil configuração Primeiro vá em data depois em lib e em seguida na pasta 050-FUNCTION então adicione isso lá: MAIN_CONFIG = { POSITION_STORAGE_X = 10090, POSITION_STORAGE_Y = 10091, POSITION_STORAGE_Z = 10092, STORAGE_CHECK = 10093, STORAGE_TIME = 10094, MESSAGE_WAIT = "You need wait " .. getPlayerStorageValue(cid, MAIN_CONFIG.STORAGE_TIME) - os.time() .. " seconds.", MESSAGE_SAVE = "You sucefully save your position, if your down say !return.", MESSAGE_RETURNING = "You has been teleported for you save position", MESSAGE_BATTLE = "?", MESSAGE_PROTECTION = "?", MESSAGE_USING = "?", } e isso também: function resetStatusInTime(cid) local P_ID = getPlayerGUID(cid) local PLAYER = getPlayerByGUID(P_ID) addEvent(function() if isCreature(PLAYER) then setPlayerStorageValue(PLAYER, MAIN_CONFIG.STORAGE_TIME, 0) setPlayerStorageValue(PLAYER, MAIN_CONFIG.STORAGE_CHECK, 0) else db.executeQuery("DELETE FROM `player_storage` WHERE `key` = 10093 AND `player_id` = " .. getPlayerGUID(PLAYER) .. ";") db.executeQuery("DELETE FROM `player_storage` WHERE `key` = 10094 AND `player_id` = " .. getPlayerGUID(PLAYER) .. ";") end end, 360 * 1000) end Não mecha em nada que não tenha MESSAGE agora vá na pasta talkactions crie 2 arquivos um chamado returnPos e coloque isso dentro: function onSay(cid, words, param, channel) local RETURN_PLAYER_POS = {x = getPlayerStorageValue(cid, MAIN_CONFIG.POSITION_STORAGE_X), y = getPlayerStorageValue(cid, MAIN_CONFIG.POSITION_STORAGE_Y), z = getPlayerStorageValue(cid, MAIN_CONFIG.POSITION_STORAGE_Z)} if getPlayerStorageValue(cid, MAIN_CONFIG,STORAGE_CHECK) > 0 then if getCreatureCondition(cid, CONDITION_INFIGHT) then if getTileInfo(getThingPos(cid)).pz then doTeleportThing(cid, RETURN_PLAYER_POS) doPlayerSendTextMessage(cid, 27, MAIN_CONFIG.MESSAGE_RETURNING) setPlayerStorageValue(cid, MAIN_CONFIG.POSITION_STORAGE_X, 0) setPlayerStorageValue(cid, MAIN_CONFIG.POSITION_STORAGE_Y, 0) setPlayerStorageValue(cid, MAIN_CONFIG.POSITION_STORAGE_Z, 0) setPlayerStorageValue(cid, MAIN_CONFIG.STORAGE_CHECK, 0) setPlayerStorageValue(cid, MAIN_CONFIG.STORAGE_TIME, 0) else doPlayerSendCancel(cid, MAIN_CONFIG.MESSAGE_PROTECTION) end else doPlayerSendCancel(cid, MAIN_CONFIG.MESSAGE_BATTLE) end end return true end e o outro savePos e coloque isso dentro: function onSay(cid, words, param, channel) if getPlayerStorageValue(cid, MAIN_CONFIG.STORAGE_TIME) <= os.time() then if getPlayerStorageValue(cid, MAIN_CONFIG.STORAGE_CHECK) <= 0 then setPlayerStorageValue(cid, MAIN_CONFIG.POSITION_STORAGE_X, getThingPos(cid).x) setPlayerStorageValue(cid, MAIN_CONFIG.POSITION_STORAGE_Y, getThingPos(cid).y) setPlayerStorageValue(cid, MAIN_CONFIG.POSITION_STORAGE_Z, getThingPos(cid).z) doPlayerSendTextMessage(cid, 27, MAIN_CONFIG.MESSAGE_SAVE .. "You have 360 seconds for this.") doSendMagicEffect(getThingPos(cid), 28) setPlayerStorageValue(cid, MAIN_CONFIG.STORAGE_CHECK, 1) setPlayerStorageValue(cid, MAIN_CONFIG.STORAGE_TIME, os.time() + 360) resetStatusInTime(cid) else doPlayerSendCancel(cid, MAIN_CONFIG.MESSAGE_USING) end else doPlayerSendCancel(cid, MAIN_CONFIG.MESSAGE_WAIT) end return true end qlr erro posta ai, fiz rapido o script e o topico tbm, ent vlw flws, se ti tbm sapora ai foi mals, vlw flws, ta lgd, flws e vlw. Link para o comentário https://xtibia.com/forum/topic/207397-returning-talkaction/ Compartilhar em outros sites More sharing options...
leoperez011 0 Postado Fevereiro 12, 2013 Share Postado Fevereiro 12, 2013 cara tem como colocar so para vip poder usar isso ? Link para o comentário https://xtibia.com/forum/topic/207397-returning-talkaction/#findComment-1466557 Compartilhar em outros sites More sharing options...
Skymagnum 234 Postado Fevereiro 12, 2013 Autor Share Postado Fevereiro 12, 2013 vc usa q sismtema vip? Link para o comentário https://xtibia.com/forum/topic/207397-returning-talkaction/#findComment-1466560 Compartilhar em outros sites More sharing options...
leoperez011 0 Postado Fevereiro 12, 2013 Share Postado Fevereiro 12, 2013 como assim que sistema vip ? Link para o comentário https://xtibia.com/forum/topic/207397-returning-talkaction/#findComment-1466561 Compartilhar em outros sites More sharing options...
Skymagnum 234 Postado Fevereiro 12, 2013 Autor Share Postado Fevereiro 12, 2013 O sistema vip que você usa, você queria que eu colocasse só para vip's usarem. Link para o comentário https://xtibia.com/forum/topic/207397-returning-talkaction/#findComment-1466566 Compartilhar em outros sites More sharing options...
leoperez011 0 Postado Fevereiro 12, 2013 Share Postado Fevereiro 12, 2013 eu não sei que sistema que eu uso sou novo nesse negocio de ots Link para o comentário https://xtibia.com/forum/topic/207397-returning-talkaction/#findComment-1466568 Compartilhar em outros sites More sharing options...
LuckOake 400 Postado Fevereiro 12, 2013 Share Postado Fevereiro 12, 2013 (editado) Rapaz, legal o sistema, mesmo já existindo outras versões na net, mas você não acha que tá muito pogado não? local pos = 79131 local exha = 79132 local time = 360 -- Tempo para usar a talk local cost = true -- Cobrar? (true / false) local price = 1000 -- Preço local battle = false -- Permitido usar o comando com Battle? (true / false) local protection = true -- É necessário estar em Protection Zone? (true / false) function onSay(cid, words) if words == "!save" then if cost and not doPlayerRemoveMoney(cid, price) then doPlayerSendCancel(cid, "It costs "..price.." gold coins to save your position.") return true elseif battle and hasCondition(cid, CONDITION_INFIGHT) then doPlayerSendCancel(cid, "You can't use this command while in battle.") return true elseif protection and not getTilePzInfo(getCreaturePosition(cid)) then doPlayerSendCancel(cid, "You can only use this command in Protection Zones.") return true end setPlayerStorageValue(cid, pos, "x = "..(getCreaturePos(cid).x)..", y = "..(getCreaturePos(cid).y)..", z = "..(getCreaturePos(cid).z)..",") exhaustion.set(cid, exha, time) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've saved your position successfully. You have "..time.." seconds to return.") elseif words == "!return" then if not exhaustion.check(cid, exha) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sorry, but your time has expired or you've never saved your position.") return true elseif battle and hasCondition(cid, CONDITION_INFIGHT) then doPlayerSendCancel(cid, "You can't use this command while in battle.") return true elseif protection and not getTilePzInfo(getCreaturePosition(cid)) then doPlayerSendCancel(cid, "You can only use this command in Protection Zones.") return true end local stor = getPlayerStorageValue(cid, pos) local posit = {x = tonumber(stor:match("x = (.-),")), y = tonumber(stor:match("y = (.-),")), z = tonumber(stor:match("z = (.-),"))} doTeleportThing(cid, posit) exhaustion.set(cid, exha, 0) setPlayerStorageValue(cid, pos, -1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've returned to your saved position successfully.") doSendMagicEffect(getCreaturePos(cid), 10) end return true end OBS: A identação do seu código tá muito errada. Editado Fevereiro 12, 2013 por LuckOake Link para o comentário https://xtibia.com/forum/topic/207397-returning-talkaction/#findComment-1466569 Compartilhar em outros sites More sharing options...
Skymagnum 234 Postado Fevereiro 12, 2013 Autor Share Postado Fevereiro 12, 2013 Fiz ele rapidin o xtibia fica bugando a identação Link para o comentário https://xtibia.com/forum/topic/207397-returning-talkaction/#findComment-1466588 Compartilhar em outros sites More sharing options...
20cm 70 Postado Fevereiro 12, 2013 Share Postado Fevereiro 12, 2013 legal, mas seria melhor vc salvar a pos quando o jogador morre, e, quando ele da !return, ele zera a pos, pq se nao ele pode ficar voltando e tudo mais e digo isso pq por exemplo, se tiver 1 boss q geral quer matar quando spawnar, o jogador pode dar !save naquela pos e ir pra lá entao acho q é meio falho o script, mas ta valendo, obrigado por compartilhar. Link para o comentário https://xtibia.com/forum/topic/207397-returning-talkaction/#findComment-1466812 Compartilhar em outros sites More sharing options...
caotic 393 Postado Fevereiro 12, 2013 Share Postado Fevereiro 12, 2013 Opa fico legal. E melhor salvar as pos tudo em uma storage depois usar gmatch para procurar os valores(como o script que luck monstro). Mais ta legal sim. Parabéns Link para o comentário https://xtibia.com/forum/topic/207397-returning-talkaction/#findComment-1466889 Compartilhar em outros sites More sharing options...
Skymagnum 234 Postado Fevereiro 12, 2013 Autor Share Postado Fevereiro 12, 2013 Fiz mais só pra zuar mesmo, não curto muito gmatch eu usaria gsub: setPlayerStorageValue(cid, storagePos, ":".. p.x ..",:".. p.y ..",:".. p.z) pra checar local pPos = tostring(getPlayerStorageValue(cid, storagePos)):gsub(':', ''):explode(',') pPos[1] -> x pPos[2] -> y pPos[3] -> z Link para o comentário https://xtibia.com/forum/topic/207397-returning-talkaction/#findComment-1467517 Compartilhar em outros sites More sharing options...
drakylucas 160 Postado Fevereiro 12, 2013 Share Postado Fevereiro 12, 2013 cara, storages também salvam tabela viu.. nao precisa usar gmatch nem gsub... é só salvar todos os dados em uma tabela em uma unica storage ¬¬ Link para o comentário https://xtibia.com/forum/topic/207397-returning-talkaction/#findComment-1467531 Compartilhar em outros sites More sharing options...
Slicer 1070 Postado Fevereiro 12, 2013 Share Postado Fevereiro 12, 2013 e como ficaria isso draky? '--' e eu usaria assim sei la.. local sto = "x: 1000, y: 500, z: 7;" local x, y, z = sto:match("x: (.-), y: (.-), z: (.-);") print(x, y, z) soh um exemplo ta... kk Link para o comentário https://xtibia.com/forum/topic/207397-returning-talkaction/#findComment-1467717 Compartilhar em outros sites More sharing options...
Skymagnum 234 Postado Fevereiro 13, 2013 Autor Share Postado Fevereiro 13, 2013 Ficaria tipo assim então: local pos = getPlayerPosition(cid) local tablePos = {x = pos.x, y = pos.y, z = pos.z} setPlayerStorageValue(cid, 3500, tablePos) sinceramente acho que isso não funciona Link para o comentário https://xtibia.com/forum/topic/207397-returning-talkaction/#findComment-1467914 Compartilhar em outros sites More sharing options...
Slicer 1070 Postado Fevereiro 13, 2013 Share Postado Fevereiro 13, 2013 /\ no meu teste retornou nil... ;x Link para o comentário https://xtibia.com/forum/topic/207397-returning-talkaction/#findComment-1468034 Compartilhar em outros sites More sharing options...
Posts Recomendados