Fortera Global
Intermediate OT User
- Joined
- Nov 20, 2015
- Messages
- 1,180
- Solutions
- 2
- Reaction score
- 117
tfs 1.x
someone can help me fix?
Code:
Lua Script Error: [Event Interface]
data/events/scripts/player.lua:Player@onChangeZone
data/events/scripts/player.lua:221: attempt to index global 'staminaRegen' (a nil value)
stack traceback:
[C]: in function '__index'
data/events/scripts/player.lua:221: in function <data/events/scripts/player.lua:216>
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
someone can help me fix?