Nome do Script: Zombie Event MOD
Tipo do Script: Nao sei!
Versão Utilizada: 8.60
Servidor Utilizado: TheLostServer
Nível de Experiência: Complicado.
Informações Extras: --
To com esse evento só que esta com um problema, ele inicia normalmente, mas quando eu falo !zombie não acontece nada, ele nao me manda para a area do evento, alguem sabe como resolver?
Obs: Esse evento em mod axo que é novidade
Abraçossss
<?xml version='1.0' encoding='UTF-8'?> <mod name='Zombie Event' version='2.0' author='Oskar' contact='http://tibia.net.pl/members/oskar.html' enabled='yes'> <config name='zombieEvent_conf'><![CDATA[ ZE_REWARDS = { random = false, rew = {2160,5,2645,1} } rewards = { [60] = { {8306, 1}, {"crystal coin",40}, {12466, 3} }, [25] = { {"crystal coin",60}, {12466, 5} }, [15] = { {"crystal coin",100}, {11144, 1}, {5795, 1}, {12466, 10}, {9004, 1}, {9693, 1}, {12659, 1}} } ZE_MAX_PLAYERS = 2 --number of player how much is need to start event ZE_MIN_PLAYERS = 1 ZE_ACCESS_TO_IGNORE_ARENA = 3 timeOnJoinToEvent = 3 --in minutes -- POSITIONS ZE_kickPosition = {x=1050,y=1080,z=7} ZE_enterPosition = {x=1124,y=1052,z=7} ZE_centerRoomPosition = {x=1124,y=1052,z=7} ZE_rX_rY = {22,18} ZE_STATUS = 13300 maxTime=3 ZOMBIE = { ['horned mutant'] = {20,1}, ['vile centurion'] = {15,2}, ['daidalost'] = {10,4}, ['mongrel man'] = {5,8}, ['propell zombie'] = {2,16}, ['scrathclaw'] = {1,32} } ZOMBIES = {} for k, v in pairs(ZOMBIE) do table.insert(ZOMBIES, k) end function chooseMonster() local monster = false for k, v in pairs(ZOMBIE) do monster = monster or (math.random(100) <= v[1] and k or false) end return monster or chooseMonster() end function isWalkable(pos, creature, proj, pz) if getTileThingByPos({x=pos.x,y=pos.y,z=pos.z,stackpos=0}).itemid == 0 then return false end if getTopCreature(pos).uid > 0 and creature then return false end if getTileInfo(pos).protection and pz then return false, true end local n = not proj and 3 or 2 for i = 0, 255 do pos.stackpos = i local tile = getTileThingByPos(pos) if tile.itemid ~= 0 and not isCreature(tile.uid) then if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then return false end end end return true end function getPlayerZombiesEventStatus(cid) return getCreatureStorage(cid, ZE_STATUS) end function setPlayerZombiesEventStatus(cid, value) doCreatureSetStorage(cid, ZE_STATUS, value) end function getZombiesEventPlayers() local players = {} for _, cid in pairs(getPlayersOnline()) do if getPlayerZombiesEventStatus(cid) == 1 then table.insert(players, cid) end end if players then return players else return false end end function kickPlayerFromZombiesArea(cid) doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT) doTeleportThing(cid, ZE_kickPosition, false, true) doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT) return setPlayerZombiesEventStatus(cid, 0) end function getPercent() rand= math.random(1,100) prev = 0 chosenItem = 0 for k, v in pairs(rewards) do if rand > prev and rand <= k+prev then chosenItem = k break else prev = k+prev end end return chosenItem end function giveReward(cid) percent = getPercent() randomizer = rewards[percent][math.random(1,#rewards[percent])] item = not tonumber(randomizer[1]) and getItemIdByName(randomizer[1]) or randomizer[1] count = isItemStackable(item) and math.min(randomizer[2],100) or 1 msg = "You have won ".. (count == 1 and "a" or count) .." " .. getItemNameById(item) .. "" .. (count == 1 and "" or "s").."." doBroadcastMessage(getPlayerName(cid).." have won ".. (count == 1 and "a" or count) .." " .. getItemNameById(item) .. "" .. (count == 1 and "" or "s")..".") doPlayerAddItem(cid,item,count) doPlayerSendTextMessage(cid,MESSAGE_TYPES["white"],msg) end function LessTime() if getStorage(ZE_STATUS) ~= 1 then return true end if #getZombiesEventPlayers() >= ZE_MIN_PLAYERS then doSetStorage(ZE_STATUS, 2) spawnNewZombie() for _, v in ipairs(getZombiesEventPlayers()) do addPlayerToZombiesArea(v) doCreatureSetNoMove(v, false) end doBroadcastMessage('Zombie Event is started!') return true else doBroadcastMessage("Zombie Event was cancelled because less than "..ZE_MIN_PLAYERS.." players joined.") doSetStorage(ZE_STATUS, 1) end end function loseOnZombieArena(cid) local players, msg = getZombiesEventPlayers(), '' doCreatureSetStorage(cid, ZE_STATUS+1, 0) kickPlayerFromZombiesArea(cid) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You are dead.') if(#getZombiesEventPlayers() <= 1) then local winner = getZombiesEventPlayers()[1] or players[1] if winner then giveReward(winner) doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, 'You won zombie event.') msg = getCreatureName(winner) .. ' won Zombie Event' kickPlayerFromZombiesArea(winner) if getSpectators(ZE_centerRoomPosition, ZE_rX_rY[1], ZE_rX_rY[2]) then for _, v in ipairs(getSpectators(ZE_centerRoomPosition, ZE_rX_rY[1], ZE_rX_rY[2])) do if isMonster(v) then doRemoveThing(v) end end end else msg = 'Zombie event finished! No one win!' end doSetStorage(ZE_STATUS, 0) end doBroadcastMessage(msg) return true end function addPlayerToZombiesArea(cid) doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT) doTeleportThing(cid, ZE_enterPosition, false, true) doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT) if getPlayerAccess(cid) < ZE_ACCESS_TO_IGNORE_ARENA then setPlayerZombiesEventStatus(cid, 1) end return true end function spawnNewZombie(fromPosition, n) local n, pos = n or 0, {x = ZE_centerRoomPosition.x + math.random(-ZE_rX_rY[1],ZE_rX_rY[1]), y = ZE_centerRoomPosition.y + math.random(-ZE_rX_rY[2],ZE_rX_rY[2]), z = ZE_centerRoomPosition.z} if isWalkable(pos, true, true, true) then local monster = chooseMonster() local cid = doCreateMonster((monster == '' and 'horned mutant' or monster), pos, false, false, false) doSendMagicEffect(pos, CONST_ME_MORTAREA) return (isMonster(cid) and registerCreatureEvent(cid, 'zombieEventDeath') and registerCreatureEvent(cid, 'zombieEventThink')) and (fromPosition and doSendDistanceShoot(fromPosition, pos, CONST_ANI_SUDDENDEATH) or true) end return (n < 200 and spawnNewZombie(fromPosition, n+1) or true) end function getExhausted(cid, storage) return os.time() >= getCreatureStorage(cid, storage) and true or false end function setExhausted(cid, storage, cooldown) return doCreatureSetStorage(cid, storage, os.time() + cooldown) end function LessTime() if getStorage(ZE_STATUS) ~= 1 then return true end if #getZombiesEventPlayers() >= ZE_MIN_PLAYERS then doSetStorage(ZE_STATUS, 2) spawnNewZombie() for _, v in ipairs(getZombiesEventPlayers()) do addPlayerToZombiesArea(v) doCreatureSetNoMove(v, false) end doBroadcastMessage('Zombie Event is started!') return true else doBroadcastMessage("Zombie Event was cancelled because less than "..ZE_MIN_PLAYERS.." players joined.") doSetStorage(ZE_STATUS, 1) end end ]]></config> <event type='death' name='zombieEventDeath' event='script'><![CDATA[ domodlib('zombieEvent_conf') function onDeath(cid) for i = 1, math.random(1,4) do spawnNewZombie(getThingPos(cid)) end doSendMagicEffect(getThingPos(cid), CONST_ME_MORTAREA) return doCreatureSay(cid, 'I\'ll be back!', TALKTYPE_ORANGE_1) end ]]></event> <event type='statschange' name='zombieEventStatsChange' event='script'><![CDATA[ domodlib('zombieEvent_conf') function onStatsChange(target, cid, changetype, combat, value) if isMonster(cid) and isPlayer(target) and isInArray(ZOMBIES, getCreatureName(cid):lower()) and changetype == STATSCHANGE_HEALTHLOSS and math.abs(value) >= getCreatureHealth(target) then doCreatureAddHealth(target, getCreatureMaxHealth(target)) return loseOnZombieArena(target) and false end return true end ]]></event> <globalevent name='zombieStart' type='start' event='script'><![CDATA[ domodlib('zombieEvent_conf') function onStartup() return doSetStorage(ZE_STATUS, 0) end ]]></globalevent> <moveevent type='stepIn' uniqueid='3000' event='script'><![CDATA[ domodlib('zombieEvent_conf') function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) local msg = '' if isPlayer(cid) then if getCreatureCondition(cid, CONDITION_INFIGHT) and getPlayerAccess(cid) <= ZE_ACCESS_TO_IGNORE_ARENA then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You are in PZ!') end if getPlayerAccess(cid) > ZE_ACCESS_TO_IGNORE_ARENA then if getStorage(ZE_STATUS) ~= 1 then doSetStorage(ZE_STATUS, 1) addEvent(LessTime, 1000*60*maxTime) for i=1, maxTime-1 do addEvent(doBroadcastMessage,1000*60*i,(maxTime-i)..' minutes to Zombie Arena Event started. If you want join to event say !zombie join or enter the teleport in depot. We wait on '..ZE_MAX_PLAYERS..' players.') end doBroadcastMessage('Zombie Arena Event is started. If you want join to event say !zombie join or enter the teleport in depot. We wait on '..ZE_MAX_PLAYERS..' players.') end return addPlayerToZombiesArea(cid) elseif #getZombiesEventPlayers() < ZE_MAX_PLAYERS and getStorage(ZE_STATUS) == 1 then setPlayerZombiesEventStatus(cid, 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You are player of number '..#getZombiesEventPlayers()..', which join to event.') if #getZombiesEventPlayers() == ZE_MAX_PLAYERS then doSetStorage(ZE_STATUS, 2) spawnNewZombie() for _, v in ipairs(getZombiesEventPlayers()) do addPlayerToZombiesArea(cid) end msg = 'Zombie Event is started.' else msg = getCreatureName(cid) .. ' has entered a Zombie Arena. We still need ' .. ZE_MAX_PLAYERS - players_on_arena_count .. ' players.' end return (msg ~= '' and doBroadcastMessage(msg) or true) else return doTeleportThing(cid, fromPosition, false, true) and doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Arena is full.') end end return true end ]]></moveevent> <talkaction words='!zombie' event='script'><![CDATA[ domodlib('zombieEvent_conf') function onSay(cid, words, param, channel) local msg = '' if param:lower() == 'join' then if getCreatureCondition(cid, CONDITION_INFIGHT) and getPlayerAccess(cid) <= ZE_ACCESS_TO_IGNORE_ARENA then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You are in PZ!') end if getPlayerAccess(cid) > ZE_ACCESS_TO_IGNORE_ARENA then if getStorage(ZE_STATUS) ~= 1 then doSetStorage(ZE_STATUS, 1) addEvent(LessTime, 1000*60*maxTime) for i=1, maxTime-1 do addEvent(doBroadcastMessage,1000*60*i,(maxTime-i)..' minutes to Zombie Arena Event started. If you want join to event say !zombie join or enter the teleport in depot. We wait on '..ZE_MAX_PLAYERS..' players.') end doBroadcastMessage('Zombie Arena Event is started. If you want join to event say !zombie join or enter the teleport in depot. We wait on '..ZE_MAX_PLAYERS..' players.') end return addPlayerToZombiesArea(cid) elseif #getZombiesEventPlayers() < ZE_MAX_PLAYERS and getStorage(ZE_STATUS) == 1 then doCreatureSetNoMove(cid, true) setPlayerZombiesEventStatus(cid, 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You are player of number '..#getZombiesEventPlayers()..', which join to event.') if #getZombiesEventPlayers() == ZE_MAX_PLAYERS then doSetStorage(ZE_STATUS, 2) spawnNewZombie() for _, v in ipairs(getZombiesEventPlayers()) do addPlayerToZombiesArea(v) doCreatureSetNoMove(v, false) end msg = 'Zombie Event is started.' else msg = getCreatureName(cid) .. ' has entered a Zombie Arena. We still need more players.' end doBroadcastMessage(msg) return true else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Arena is full.') return true end elseif param:lower() == 'leave' then if getStorage(ZE_STATUS) < 2 then setPlayerZombiesEventStatus(cid, 0) return doCreatureSetNoMove(cid, false) end return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You are on arena.') end return true end ]]></talkaction> <globalevent name="zombieTime" time="21:47" event="script"><![CDATA[ domodlib("zombieEvent_conf") function onTimer() doSetStorage(ZE_STATUS, 1) addEvent(LessTime, 1000*60*maxTime) for i=1, maxTime-1 do addEvent(doBroadcastMessage,1000*60*i,(maxTime-i)..' minutes to Zombie Arena Event started. If you want join to event say !zombie join or enter the teleport in depot. We wait on '..ZE_MAX_PLAYERS..' players.') end return doBroadcastMessage('Zombie Arena Event is started. If you want join to event say !zombie join or enter the teleport in depot. We wait on '..ZE_MAX_PLAYERS..' players.') end ]]></globalevent> <event type="login" name="zombieEventLogin" event="buffer"><![CDATA[ domodlib("zombieEvent_conf") function onLogin(cid) registerCreatureEvent(cid, 'zombieEventStatsChange') return true end ]]></event> </mod>