CesarZ
Well-Known Member
- Joined
- Sep 20, 2012
- Messages
- 268
- Solutions
- 4
- Reaction score
- 63
Alright the log is clean no errors appeared but its seems like is not executing the function because the players are dying.
I took the script from a old TFS 1.0 and I'm trying to change it to TFS 1.3.
I'm not running this in script folder I'm running it on XML file.
i saw the function registered in the cpp files
i have it registered on XML as
let me know whats wrong thanks!.
I took the script from a old TFS 1.0 and I'm trying to change it to TFS 1.3.
I'm not running this in script folder I'm running it on XML file.
Lua:
function onLogin(cid)
local player = Player(cid)
player:registerEvent("Arena_Death")
return true
end
local arena = {
from = {x=822, y=1056, z=9}, -- left top corner of arena
to = {x=857, y=1072, z=9}, -- right bottom corner of arena
temple = { x = 787, y = 1012, z = 7 } -- change it to temple pos
}
local conditions = {CONDITION_POISON,
CONDITION_FIRE,
CONDITION_ENERGY,
CONDITION_PARALYZE,
CONDITION_DRUNK,
CONDITION_DROWN,
CONDITION_FREEZING,
CONDITION_DAZZLED,
CONDITION_INFIGHT,
CONDITION_EXHAUST_HEAL,
CONDITION_SPELLCOOLDOWN,
CONDITION_SPELLGROUPCOOLDOWN,
CONDITION_EXHAUST_COMBAT,
CONDITION_EXHAUSTED,
CONDITION_EXHAUST,
CONDITION_EXHAUST_WEAPON,
CONDITION_BLEEDING,
CONDITION_CURSED
}
function onPrepareDeath(cid, killer)
local player = creature(cid)
if isInRange(getPlayerPosition(cid), arena.from,arena.to) then
if isPlayer(cid) then
player:addHealth(player:getMaxHealth())
player:addMana(player:getMaxMana())
player:teleportTo(arena.temple, true)
player:removeCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You Have Exit the PVP-ARENA.")
for _, condition in ipairs(conditions) do
if(player:getCondition(condition)) then
player:removeCondition(condition)
end
end
if isInArray({SKULL_WHITE}, player:getSkull()) then
player:setSkull(SKULL_NONE)
player:setSkullTime(0)
end
return false
end
end
return true
end
function isInRange(pos, fromPos, toPos)
return pos.x >= fromPos.x and pos.y >= fromPos.y and pos.z >= fromPos.z and pos.x <= toPos.x and pos.y <= toPos.y and pos.z <= toPos.z
end
Code:
onPrepareDeath
i have it registered on XML as
Code:
<event type="preparedeath" name="Arena_Death" script="Arena_Death.lua"/>
<event type="login" name="Arena_Login" script="Arena_Death.lua"/>
let me know whats wrong thanks!.