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.