cara tem como colocar so para vip poder usar isso ?
- Fórum
- OTServ
- Recursos
- Scripting
- Actions e Talkactions
- Returning Talkaction
info
Grupo: Campones
Registrado: 13/01/13
Posts: 78
Reputação: 0

info
Grupo: Marquês
Registrado: 02/08/12
Posts: 1k
Reputação: +234
Char no Tibia: Maurolkit

vc usa q sismtema vip?
info
Grupo: Campones
Registrado: 13/01/13
Posts: 78
Reputação: 0

como assim que sistema vip ?
info
Grupo: Marquês
Registrado: 02/08/12
Posts: 1k
Reputação: +234
Char no Tibia: Maurolkit

O sistema vip que você usa, você queria que eu colocasse só para vip's usarem.
info
Grupo: Campones
Registrado: 13/01/13
Posts: 78
Reputação: 0

eu não sei que sistema que eu uso sou novo nesse negocio de ots
info
Grupo: Marquês
Registrado: 22/07/12
Posts: 1.1k
Reputação: +400
Gênero: Masculino
Char no Tibia: Luck Oake

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 11 por LuckOake
info
Grupo: Marquês
Registrado: 02/08/12
Posts: 1k
Reputação: +234
Char no Tibia: Maurolkit

Fiz ele rapidin o xtibia fica bugando a identação
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.
info
Grupo: Infante
Registrado: 04/03/11
Posts: 1.6k
Reputação: +393
Char no Tibia: No Have

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
info
Grupo: Marquês
Registrado: 02/08/12
Posts: 1k
Reputação: +234
Char no Tibia: Maurolkit

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
info
Grupo: Visconde
Registrado: 12/09/10
Posts: 416
Reputação: +160
Char no Tibia: Draky Lucas

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 ¬¬
info
Grupo: Príncipe
Registrado: 19/08/10
Posts: 4k
Reputação: +1.1k
Gênero: Masculino

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
info
Grupo: Marquês
Registrado: 02/08/12
Posts: 1k
Reputação: +234
Char no Tibia: Maurolkit

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






info
Grupo: Marquês
Registrado: 02/08/12
Posts: 1k
Reputação: +234
Char no Tibia: Maurolkit
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.
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) endagora 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 ende 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 endqlr 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.