Ir para conteúdo

Evento


Carnavotu

Posts Recomendados

O evento que roda no mod não esta funcionando, o evento começa só que não esta caindo fogo do céu ! TFS 3.6 !

 

Mod:

 

<?xml version="1.0" encoding="UTF-8"?>

<mod name="LMS_Fire_Event" version="1.0" author="VirrageS" contact="otland.net" enabled="yes">

<config name="lms_config">

<![CDATA[

condition = createConditionObject(CONDITION_INFIGHT,-1)

configFire = {

storage = 8998, -- set free storage

eventStorage = 6254, -- set free storage

joinEventStorage = 5535, -- set free storage

countPlayerStorage = 7373, -- set free storage

exhaustStorage = 8387,

maxPlayers = 5, -- max players in event

teleportPos = {x=804 ,y=23285,z=7}, -- posiotion to which player is teleporting

rewardID = {12702, 6391}, -- reward id which player can win (reward is random)

minLevel = 1, -- minimum of level with which player can join to event

days = {

['Friday'] = {'14:59:20'},

['Thursday'] = {'14:59:20'},

['Sunday'] = {'14:59:20'}

},

minPlayers = 2,

delayTime = 1.0, -- time in which players who joined to event are teleporting to teleport position

timeToStartEvent = 10 -- time from teleport to start event

}

arena = {fromPos = {x=788,y=23267,z=7}, -- left top corner of event room

toPos = {x=829,y=23305,z=7} -- right bottom corner of event room

}

 

y, x = 1, 1

]]>

</config>

 

<lib name="lms_fire_lib">

<![CDATA[

function doStartEvent()

doSetStorage(configFire.joinEventStorage, -1)

 

if configFire.minPlayers <= getStorage(configFire.countPlayerStorage) + 1 then

for _, cid in ipairs(getPlayersOnline()) do

if getCreatureStorage(cid, configFire.storage) == 1 then

addEvent(doSetStorage, configFire.timeToStartEvent * 1000, configFire.eventStorage, 1)

doCreatureSetStorage(cid, configFire.storage, -1)

doCreatureSetNoMove(cid, false)

doRemoveCondition(cid, CONDITION_INFIGHT)

doTeleportThing(cid, configFire.teleportPos)

doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Get ready. Event start in ' .. configFire.timeToStartEvent .. ' sec.')

end

end

else

for _, cid in ipairs(getPlayersOnline()) do

if getCreatureStorage(cid, configFire.storage) == 1 then

doCreatureSetNoMove(cid, false)

doRemoveCondition(cid, CONDITION_INFIGHT)

end

end

doBroadcastMessage('Fire Storm have started beacuse there were enough players.', MESSAGE_EVENT_ADVANCE)

end

 

doSetStorage(configFire.countPlayerStorage, 0)

end

]]>

</lib>

<talkaction words="!event" event="script">

<![CDATA[

domodlib("lms_config")

function onSay(cid, words, param)

local storage, playerJoined, counter = getCreatureStorage(cid, configFire.storage), {}, getStorage(configFire.countPlayerStorage)

if getStorage(configFire.joinEventStorage) == 1 then

if(param == '') then

return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'Command param required (say: "!event join" or "!event leave").')

end

 

if configFire.minLevel ~= nil then

if getPlayerLevel(cid) < configFire.minLevel then

return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You can not join to event if you do not have a require level. [' .. configFire.minLevel .. ']')

end

end

 

if getTileInfo(getThingPos(cid)).protection ~= true then

return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You can not join to event if are not in protection zone.')

end

 

if exhaustion.check(cid, configFire.exhaustStorage) ~= false then

return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You must to wait a ' .. exhaustion.get(cid, configFire.exhaustStorage) .. ' sec.')

end

if param == 'join' then

if storage <= 0 then

if counter ~= configFire.maxPlayers - 1 then

doSetStorage(configFire.countPlayerStorage, 0)

for _, pid in ipairs(getPlayersOnline()) do

if getCreatureStorage(pid, configFire.storage) > 0 then

table.insert(playerJoined, pid)

doSetStorage(configFire.countPlayerStorage, #playerJoined)

end

end

local count = getStorage(configFire.countPlayerStorage)

doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, count == 0 and 'You are first in event.' or count == 1 and 'There is 1 player in event.' or count > 1 and 'There are '.. count ..' players in event.')

doCreatureSetStorage(cid, configFire.storage, 1)

 

doCreatureSetNoMove(cid, true)

 

doAddCondition(cid, condition)

doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have joined to event. You can not move until event do not start. Wait patiently for event start.')

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'Max players in event have been reached.')

end

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You arleady joined to event. Wait patiently for start.')

end

elseif param == 'leave' then

if storage > 0 then

doCreatureSetNoMove(cid, false)

doRemoveCondition(cid, CONDITION_INFIGHT)

doCreatureSetStorage(cid, configFire.storage, -1)

doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'You leave from event. And you can moving now.')

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You can not leave from event.')

end

end

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You can not join/leave to event yet.')

end

 

exhaustion.set(cid, configFire.exhaustStorage, 5)

 

return true

end

]]>

</talkaction>

 

<talkaction words="!startfire" access="5" event="script">

<![CDATA[

domodlib("lms_config")

domodlib("lms_fire_lib")

function onSay(cid, words, param)

doBroadcastMessage('Fire Storm Event will start in ' .. configFire.delayTime .. ' min. You can join to event by say "!event join".', MESSAGE_EVENT_ADVANCE)

for _, pid in ipairs(getPlayersOnline()) do

if getCreatureStorage(pid, configFire.storage) == 1 then

doCreatureSetStorage(pid, configFire.storage, -1)

doSetStorage(configFire.countPlayerStorage, 0)

doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)), true)

end

end

doSetStorage(configFire.joinEventStorage, 1)

addEvent(doStartEvent, configFire.delayTime * 60 * 1000)

return true

end

]]>

</talkaction>

<event type="think" name="LMS_Event_Start" event="script">

<![CDATA[

domodlib("lms_config")

domodlib("lms_fire_lib")

local daysOpen = {}

 

for k, v in pairs(configFire.days) do

table.insert(daysOpen, k)

end

 

function onThink(cid, interval)

if isInArray(daysOpen, os.date('%A')) then

if isInArray(configFire.days[os.date('%A')], os.date('%X', os.time())) then

if getStorage(configFire.joinEventStorage) ~= 1 then

doBroadcastMessage('Fire Storm Event will start in '.. configFire.delayTime ..' min. You can join to event by say "!event join".', MESSAGE_EVENT_ADVANCE)

for _, pid in ipairs(getPlayersOnline()) do

if getCreatureStorage(pid, configFire.storage) == 1 then

doCreatureSetStorage(pid, configFire.storage, -1)

doSetStorage(configFire.countPlayerStorage, 0)

doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)), true)

end

end

doSetStorage(configFire.joinEventStorage, 1)

addEvent(doStartEvent, configFire.delayTime * 60 * 1000)

end

end

end

return true

end

]]>

</event>

 

<globalevent name="LMS_Event" interval="1000" event="script">

<![CDATA[

domodlib("lms_config")

function onThink(interval, lastExecution)

if getStorage(configFire.eventStorage) == 1 then

local xTable, yTable, playerTable = {}, {}, {}

for x = arena.fromPos.x, arena.toPos.x do

for y = arena.fromPos.y, arena.toPos.y do

table.insert(xTable, x)

table.insert(yTable, y)

local n, i = getTileInfo({x=x, y=y, z=7}).creatures, 1

if n ~= 0 then

local v = getThingfromPos({x=x, y=y, z=7, stackpos=i}).uid

while v ~= 0 do

if isPlayer(v) then

table.insert(playerTable, v)

if n == #playerTable then

break

end

end

i = i + 1

v = getThingfromPos({x=x, y=y, z=7, stackpos=i}).uid

end

end

end

end

if #playerTable == 1 then

local prize = math.random(#configFire.rewardID)

doTeleportThing(playerTable[1], getTownTemplePosition(getPlayerTown(playerTable[1])), true)

doPlayerAddItem(playerTable[1], configFire.rewardID[prize], 1)

doPlayerSendTextMessage(playerTable[1], MESSAGE_EVENT_ADVANCE, 'You win. Your reward is ' .. getItemNameById(configFire.rewardID[prize]) .. '.')

doBroadcastMessage('Fire Storm Event have finished. The winner is ' .. getCreatureName(playerTable[1]) .. '. Congratulations.', MESSAGE_EVENT_ADVANCE)

doSetStorage(configFire.eventStorage, -1)

 

x, y = 1, 1

elseif #playerTable > 1 then

for a = 1, y do

local pos = {x=xTable[math.random(#xTable)], y=yTable[math.random(#yTable)], z=7}

for _, player in ipairs(playerTable) do

local pPos = getThingPos(player)

if pPos.x == pos.x and pPos.y == pos.y and pPos.z == pos.z then

doCreatureAddHealth(player, - getCreatureMaxHealth(player))

end

end

doSendDistanceShoot({x = pos.x - math.random(4, 6), y = pos.y - 5, z = pos.z}, pos, CONST_ANI_FIRE)

 

addEvent(doSendMagicEffect, 150, pos, CONST_ME_HITBYFIRE)

addEvent(doSendMagicEffect, 150, pos, CONST_ME_FIREAREA)

end

if x == 5 * y then

y = y + 1

end

 

x = x + 1

else

doBroadcastMessage('No one win in Fire Storm Event.', MESSAGE_EVENT_ADVANCE)

doSetStorage(configFire.eventStorage, -1)

x, y = 1, 1

end

end

return true

end

]]>

</globalevent>

<event type="login" name="LMS_Fire_login" event="script">

<![CDATA[

function onLogin(cid)

if getCreatureStorage(cid, configFire.storage) == 1 then

doCreatureSetStorage(cid, configFire.storage, -1)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)

doCreatureSetNoMove(cid, false)

doRemoveCondition(cid, CONDITION_INFIGHT)

end

registerCreatureEvent(cid, "LMS_fire_dead")

registerCreatureEvent(cid, "LMS_Event_Start")

return true

end

]]>

</event>

<event type="statschange" name="LMS_fire_dead" event="script">

<![CDATA[

domodlib("lms_config")

function onStatsChange(cid, attacker, type, combat, value)

if type == 1 and getCreatureHealth(cid) <= value then

if isInRange(getThingPos(cid), arena.fromPos, arena.toPos) then

doCreatureAddHealth(cid, - getCreatureHealth(cid) + 1)

doCreatureAddMana(cid, - getCreatureMana(cid))

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You loss.')

return false

end

end

return true

end

]]>

</event>

</mod>

 

 

Se alguém puder ajudar, agradeço

 

Abrass

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...