Hello, iam tired of make this script to work, it should be work but it doesn't and i can't do anythnig.
I want to make a simple script, when monster attack me (POFF) ill be moved to Temple, i tested with onAttack / onCombat / onPrepareDeath and i cant do this script, it doesn't work, please help me, its from Zombie Event.
REP for help guys.
I want to make a simple script, when monster attack me (POFF) ill be moved to Temple, i tested with onAttack / onCombat / onPrepareDeath and i cant do this script, it doesn't work, please help me, its from Zombie Event.
LUA:
local config = {
playerCount = 2001, -- Global storage for counting the players left/entered in the event
moneyReward = {2160, 10, 1},
-- Should be same as in the globalevent!
-- The zombies will spawn randomly inside this area
fromPosition = {x = 341, y = 465, z = 7}, -- top left cornor of the playground
toPosition = {x = 424, y = 520, z = 7}, -- bottom right cornor of the playground
}
function onStatsChange(cid, attacker, type, combat, value)
if isPlayer(cid) and isMonster(attacker) then
if isInArea(getPlayerPosition(cid), config.fromPosition, config.toPosition) then
if getGlobalStorageValue(config.playerCount) >= 2 then
doBroadcastMessage(getPlayerName(cid) .. " have been kicked by Spider!", MESSAGE_STATUS_CONSOLE_RED)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
setGlobalStorageValue(config.playerCount, getGlobalStorageValue(config.playerCount)-1)
elseif getGlobalStorageValue(config.playerCount) == 1 then
if isInArea(getPlayerPosition(cid), config.fromPosition, config.toPosition) then
doBroadcastMessage(getPlayerName(cid) .. " won the Survival event! Congratulations!", MESSAGE_STATUS_WARNING)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
if config.moneyReward[3] == 1 then
doPlayerAddItem(cid, config.moneyReward[1], config.moneyReward[2])
end
end
for x = config.fromPosition.x, config.toPosition.x do
for y = config.fromPosition.y, config.toPosition.y do
for z = config.fromPosition.z, config.toPosition.z do
areapos = {x = x, y = y, z = z, stackpos = 253}
getMonsters = getThingfromPos(areapos)
if isMonster(getMonsters.uid) then
doRemoveCreature(getMonsters.uid)
end
end
end
end
end
return false
end
end
return true
end
REP for help guys.