UpInSmoke
Supreme Ruler
- Joined
- Nov 16, 2008
- Messages
- 303
- Reaction score
- 21
So theres something strange with my global events .. It works but only once, so if i reload globalevents the script will work but then stops working.
I am using 9.8 heres the scripts:
any idea whats wrong?
I am using 9.8 heres the scripts:
Code:
<globalevent name="Add" interval="1" script="add.lua"/>
Lua:
function onThink(interval, lastExecution)
for _, name in ipairs(getOnlinePlayers()) do
local player = getPlayerByName(name)
if getTileInfo(getThingPos(player)).protection then
if getPlayerMana(player) < getPlayerMaxMana(player) then
doPlayerAddMana(player, 1)
end
if getCreatureHealth(player) < getCreatureMaxHealth(player) then
doCreatureAddHealth(player, 1)
end
end
end
return true
end