kito2
www.masteria.net
Add this to /data/global.lua at the end of the file.
Go to /data/events/player.lua and find function "PlayernChangeZone(zone)", and replace it with this code:
That's all.
Lua:
function addStamina(id, amountStamina, delay)
local event = staminaRegen[id]
local player = Player(id)
if not player then
stopEvent(event)
staminaRegen[id] = nil
return false
end
local actualStamina = player:getStamina()
if actualStamina > 2400 and actualStamina < 2520 then
delay = 12 * 60 * 1000 -- Stamina verde 12 mins
elseif actualStamina == 2520 then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are no longer refilling stamina, because your stamina is already full.")
stopEvent(event)
staminaRegen[id] = nil
return false
end
player:editStamina(actualStamina + 1)
player:sendTextMessage(MESSAGE_STATUS_SMALL, "One minute of stamina has been refilled.")
stopEvent(event)
staminaRegen[id] = addEvent(addStamina, delay, id, amountStamina, delay)
return true
end
Go to /data/events/player.lua and find function "PlayernChangeZone(zone)", and replace it with this code:
Lua:
function Player:onChangeZone(zone)
if not self:isPremium() then
return false
end
local event = staminaRegen[self:getId()]
if zone == ZONE_PROTECTION then
if self:getStamina() < 2520 then
if not event then
local delay = 2
if self:getStamina() > 2400 and self:getStamina() <= 2520 then
delay = 8
end
staminaRegen[self:getId()] = addEvent(addStamina, delay * 60 * 1000, self:getId(), 1, delay * 60 * 1000)
end
end
else
if event then
self:sendTextMessage(MESSAGE_STATUS_SMALL, "You are no longer refilling stamina, since you left a regeneration zone.")
stopEvent(event)
staminaRegen[self:getId()] = nil
end
end
end
That's all.