Ir para conteúdo

Featured Replies

Postado

Gostaria de colocar este script para TFS 1.0 atualmente eu peguei ele na versão do TFS 1.2 mas infelizmente não consigo colocar pra ele contar o tempo e mover o jogador caso ele tiver parado pelo tempo determinado no script, acontece que não da erro no distro ele só não move, alguém poderia me ajudar?

 

local config = {
	time = 15, -- minutes
	str = 98765, -- storage
	pos = {x = 31373, y = 32780, z = 7} -- position
}

function onStepIn(creature, item, position, fromPosition)
	local player = creature:getPlayer()
	if not player or player:isInGhostMode() then
		return true
	end

	local function isTraining(uid)
		local self = Player(uid)
		if not self then return false end
		return self:getStorageValue(config.str) > 0 and self:teleportTo(config.pos) or true
	end

	check = addEvent(isTraining, config.time * 60 * 1000, player:getGuid())
	player:sendTextMessage(MESSAGE_EVENT_ADVANCE, '[Treiner]: Movimente-se a cada ' .. config.time .. ' minutos, caso contrario, voce sera teleportado ao templo.')
	return player:setStorageValue(config.str, 1)
end

function onStepOut(creature, item, position, fromPosition)
	local player = creature:getPlayer()
	if not player or player:isInGhostMode() then
		return true
	end

	return stopEvent(check) and player:setStorageValue(config.str, -1)
end

Eu devo ter postado ele no lugar errado antes de postar aqui.. :\

Postado

istraining.lua (data\movements\scripts)

local time, key = 3, 98765 -- minutes, storage
local pos = {x = 5, y = 6, z = 7} -- position

function onStepIn(cid)
    local function isTraining(uid)
        return getPlayerStorageValue(uid, key) > 0 and doTeleportThing(uid, pos) or true
    end
    
    check = addEvent(isTraining, 1000 * 60 * time, cid)
    return setPlayerStorageValue(cid, key, 1)
end

function onStepOut(cid)
    return stopEvent(check) and setPlayerStorageValue(cid, key, -1)
end

movements.xml (data\movements)

<movevent event="StepIn" actionid="XXXXX" script="istraining.lua"/>
<movevent event="StepOut" actionid="XXXXX" script="istraining.lua"/>

O actionid deve ser posto no tile dos trainers, onde os players ficam sob.

 

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo