• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

(MOD) Fire Storm Event

kozmo

Member
Joined
Jan 30, 2009
Messages
443
Solutions
2
Reaction score
23
I had this mod working fine in my 9.1 server , i switched and started working on a 8.6 server i just recently tried adding this event/mod in and it all seems to work fine accept after it says Get ready, The Event will start in 30 seconds... 30 seconds later the fire does not even start dropping so i have no clue why this wouldn't be working, If anyone knows why this is not working or what i have to edit in the script to fix it that would help a lot.

XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Fire Storm Event" version="1.0" author="iFate" contact="otland.net/members/iFate/" enabled="yes">

    <config name="lms_config">
        <![CDATA[
            configFire = {
                storage = 8998, -- set free storage
                eventStorage = 6254, -- set free storage
                joinEventStorage = 5535, -- set free storage
                countPlayerStorage = 7373, -- set free storage
                exhaustStorage = 8387,

                maxPlayers = 50, -- max players in event
                teleportPos = {x=1110 ,y=1174,z=7}, -- position to which player is teleporting
                rewardID = {9693},  -- reward id which player can win (reward is random)
                minLevel = 1, -- minimum of level with which player can join to event
                days = {
                    ['Monday'] = {'18:00:00'},
                    ['Tuesday'] = {'18:00:00'}, 
                    ['Wednesday'] = {'18:00:00'},
                    ['Thursday'] = {'18:00:00'}, 
                    ['Friday'] = {'18:00:00'},
                    ['Saturday'] = {'18:00:00'},
                    ['Sunday'] = {'18:00:00'}
                },
                minPlayers = 2,

                delayTime = 3.0, -- time in which players who joined to event are teleporting to teleport position
                timeToStartEvent = 30 -- time from teleport to start event
            }

            arena = {fromPos = {x=1090,y=1165,z=7}, -- left top corner of event room
                    toPos = {x=1132,y=1182,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, The Event will start in ' .. configFire.timeToStartEvent .. ' seconds.')
                        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('The fire storm event has not started because not enough players joined.', 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 cannot join The Fire Storm 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 cannot join The Fire Storm Event if you are not in a Protection Zone.')
                    end
                    
                    if exhaustion.check(cid, configFire.exhaustStorage) ~= false then
                        return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You must wait' .. exhaustion.get(cid, configFire.exhaustStorage) .. ' seconds.')
                    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 the fire storm event.' or count == 1 and 'There is 1 player in fire storm event.' or count > 1 and 'There are '.. count ..' players in fire storm event.')
                                doCreatureSetStorage(cid, configFire.storage, 1)
                                
                                doCreatureSetNoMove(cid, true)
                                local condition = createConditionObject(CONDITION_INFIGHT,-1)
                                
                                doAddCondition(cid, condition)
                                doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have joined the Fire Storm Event, You may not move until the Event has started please wait patiently...')
                            else
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'Max players in event have been reached.')
                            end
                        else
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You already joined the Event, Wait patiently for it to 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 have left the Fire Run Event, And you can move now.')
                        else
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You cannot leave The Fire Storm Event.')
                        end
                    end
                else
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You cannot join/leave The Fire Storm 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 .. ' minutes. You can join the Fire Storm Event by using this command "!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 ..' minutes. You can join the event by typing "!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 Won the 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 have lost the Fire Storm Event.')
                        return false
                    end
                end
                return true
            end
        ]]>
    </event>
</mod>
 
Last edited by a moderator:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Fire Storm Event" version="1.0" author="iFate" contact="otland.net/members/iFate/" enabled="yes">

<config name="lms_config">
<![CDATA[
configFire = {
storage = 8998, -- set free storage
eventStorage = 6254, -- set free storage
joinEventStorage = 5535, -- set free storage
countPlayerStorage = 7373, -- set free storage
exhaustStorage = 8387,

maxPlayers = 50, -- max players in event
teleportPos = {x=1611 ,y=1649,z=7}, -- position to which player is teleporting
rewardID = {9020}, -- reward id which player can win (reward is random)
minLevel = 1, -- minimum of level with which player can join to event
days = {
['Monday'] = {'12:47:00'},
['Tuesday'] = {'12:47:00'},
['Wednesday'] = {'12:47:00'},
['Thursday'] = {'12:47:00'},
['Friday'] = {'12:47:00'},
['Saturday'] = {'12:47:00'},
['Sunday'] = {'12:47:00'}
},
minPlayers = 2,

delayTime = 3.0, -- time in which players who joined to event are teleporting to teleport position
timeToStartEvent = 30 -- time from teleport to start event
}

arena = {fromPos = {x=1606,y=1644,z=7}, -- left top corner of event room
toPos = {x=1616,y=1654,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, The Event will start in ' .. configFire.timeToStartEvent .. ' seconds.')
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('The fire storm event has not started because not enough players joined.', 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 cannot join The Fire Storm 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 cannot join The Fire Storm Event if you are not in a Protection Zone.')
end

if exhaustion.check(cid, configFire.exhaustStorage) ~= false then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You must wait' .. exhaustion.get(cid, configFire.exhaustStorage) .. ' seconds.')
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 the fire storm event.' or count == 1 and 'There is 1 player in fire storm event.' or count > 1 and 'There are '.. count ..' players in fire storm event.')
doCreatureSetStorage(cid, configFire.storage, 1)

doCreatureSetNoMove(cid, true)
local condition = createConditionObject(CONDITION_INFIGHT,-1)

doAddCondition(cid, condition)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have joined the Fire Storm Event, You may not move until the Event has started please wait patiently...')
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'Max players in event have been reached.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You already joined the Event, Wait patiently for it to 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 have left the Fire Run Event, And you can move now.')
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You cannot leave The Fire Storm Event.')
end
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You cannot join/leave The Fire Storm 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 .. ' minutes. You can join the Fire Storm Event by using this command "!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 ..' minutes. You can join the event by typing "!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(cid, itemid, count)
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 Won the 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 have lost the Fire Storm Event.')
return false
end
end
return true
end
]]>
</event>
</mod>
 
@Imfreezing this script work for 0.3.6. and i am sure of that because i used it before just try it and tell me the error
well i dont get teleported and
Code:
[22/01/2014 17:50:06] [Error - TalkAction Interface]
[22/01/2014 17:50:06] buffer:onSay
[22/01/2014 17:50:06] Description:
[22/01/2014 17:50:06] (luaCreateConditionObject) This function can only be used while loading the script.

[22/01/2014 17:50:06] [Error - TalkAction Interface]
[22/01/2014 17:50:06] buffer:onSay
[22/01/2014 17:50:06] Description:
[22/01/2014 17:50:06] (luaDoAddCondition) Condition not found
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Fire Storm Event" version="1.0" author="iFate" contact="otland.net/members/iFate/" enabled="yes">

<config name="lms_config">
<![CDATA[
configFire = {
storage = 8998, -- set free storage
eventStorage = 6254, -- set free storage
joinEventStorage = 5535, -- set free storage
countPlayerStorage = 7373, -- set free storage
exhaustStorage = 8387,

maxPlayers = 50, -- max players in event
teleportPos = {x=1611 ,y=1649,z=7}, -- position to which player is teleporting
rewardID = {9020}, -- reward id which player can win (reward is random)
minLevel = 1, -- minimum of level with which player can join to event
days = {
['Monday'] = {'12:47:00'},
['Tuesday'] = {'12:47:00'},
['Wednesday'] = {'12:47:00'},
['Thursday'] = {'12:47:00'},
['Friday'] = {'12:47:00'},
['Saturday'] = {'12:47:00'},
['Sunday'] = {'12:47:00'}
},
minPlayers = 2,

delayTime = 3.0, -- time in which players who joined to event are teleporting to teleport position
timeToStartEvent = 30 -- time from teleport to start event
}

arena = {fromPos = {x=1606,y=1644,z=7}, -- left top corner of event room
toPos = {x=1616,y=1654,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, The Event will start in ' .. configFire.timeToStartEvent .. ' seconds.')
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('The fire storm event has not started because not enough players joined.', 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 cannot join The Fire Storm 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 cannot join The Fire Storm Event if you are not in a Protection Zone.')
end

if exhaustion.check(cid, configFire.exhaustStorage) ~= false then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You must wait' .. exhaustion.get(cid, configFire.exhaustStorage) .. ' seconds.')
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 the fire storm event.' or count == 1 and 'There is 1 player in fire storm event.' or count > 1 and 'There are '.. count ..' players in fire storm event.')
doCreatureSetStorage(cid, configFire.storage, 1)

doCreatureSetNoMove(cid, true)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have joined the Fire Storm Event, You may not move until the Event has started please wait patiently...')
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'Max players in event have been reached.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You already joined the Event, Wait patiently for it to 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 have left the Fire Run Event, And you can move now.')
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You cannot leave The Fire Storm Event.')
end
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You cannot join/leave The Fire Storm 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 .. ' minutes. You can join the Fire Storm Event by using this command "!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 ..' minutes. You can join the event by typing "!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(cid, itemid, count)
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 Won the 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 have lost the Fire Storm Event.')
return false
end
end
return true
end
]]>
</event>
</mod>
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Fire Storm Event" version="1.0" author="iFate" contact="otland.net/members/iFate/" enabled="yes">

<config name="lms_config">
<![CDATA[
configFire = {
storage = 8998, -- set free storage
eventStorage = 6254, -- set free storage
joinEventStorage = 5535, -- set free storage
countPlayerStorage = 7373, -- set free storage
exhaustStorage = 8387,

maxPlayers = 50, -- max players in event
teleportPos = {x=1611 ,y=1649,z=7}, -- position to which player is teleporting
rewardID = {9020}, -- reward id which player can win (reward is random)
minLevel = 1, -- minimum of level with which player can join to event
days = {
['Monday'] = {'12:47:00'},
['Tuesday'] = {'12:47:00'},
['Wednesday'] = {'12:47:00'},
['Thursday'] = {'12:47:00'},
['Friday'] = {'12:47:00'},
['Saturday'] = {'12:47:00'},
['Sunday'] = {'12:47:00'}
},
minPlayers = 2,

delayTime = 3.0, -- time in which players who joined to event are teleporting to teleport position
timeToStartEvent = 30 -- time from teleport to start event
}

arena = {fromPos = {x=1606,y=1644,z=7}, -- left top corner of event room
toPos = {x=1616,y=1654,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, The Event will start in ' .. configFire.timeToStartEvent .. ' seconds.')
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('The fire storm event has not started because not enough players joined.', 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 cannot join The Fire Storm 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 cannot join The Fire Storm Event if you are not in a Protection Zone.')
end

if exhaustion.check(cid, configFire.exhaustStorage) ~= false then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You must wait' .. exhaustion.get(cid, configFire.exhaustStorage) .. ' seconds.')
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 the fire storm event.' or count == 1 and 'There is 1 player in fire storm event.' or count > 1 and 'There are '.. count ..' players in fire storm event.')
doCreatureSetStorage(cid, configFire.storage, 1)

doCreatureSetNoMove(cid, true)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have joined the Fire Storm Event, You may not move until the Event has started please wait patiently...')
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'Max players in event have been reached.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You already joined the Event, Wait patiently for it to 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 have left the Fire Run Event, And you can move now.')
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You cannot leave The Fire Storm Event.')
end
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You cannot join/leave The Fire Storm 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 .. ' minutes. You can join the Fire Storm Event by using this command "!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 ..' minutes. You can join the event by typing "!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(cid, itemid, count)
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 Won the 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 have lost the Fire Storm Event.')
return false
end
end
return true
end
]]>
</event>
</mod>

Have errros. :(

Mod 100% and not need query mysql

HTML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Fire Storm Event" version="1.0" author="iFate" contact="otland.net/members/iFate/" enabled="yes">
 
<config name="lms_config">
<![CDATA[
configFire = {
storage = 8998, -- set free storage
eventStorage = 6254, -- set free storage
joinEventStorage = 5535, -- set free storage
countPlayerStorage = 7373, -- set free storage
exhaustStorage = 8387,
 
maxPlayers = 50, -- max players in event
teleportPos = {x=196 ,y=1323,z=7}, -- position to which player is teleporting
rewardID = {9693}, -- reward id which player can win (reward is random)
minLevel = 80, -- minimum of level with which player can join to event
days = {
['Monday'] = {'18:00:00'},
['Tuesday'] = {'18:00:00'},
['Wednesday'] = {'18:00:00'},
['Thursday'] = {'18:00:00'},
['Friday'] = {'18:00:00'},
['Saturday'] = {'22:20:00'},
['Sunday'] = {'18:00:00'}
},
minPlayers = 2,
 
delayTime = 1.0, -- time in which players who joined to event are teleporting to teleport position
timeToStartEvent = 30 -- time from teleport to start event
}
 
arena = {fromPos = {x=164,y=1289,z=7}, -- left top corner of event room
toPos = {x=232,y=1340,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, The Event will start in ' .. configFire.timeToStartEvent .. ' seconds.')
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('The fire storm event has not started because not enough players joined.', MESSAGE_EVENT_ADVANCE)
end
 
doSetStorage(configFire.countPlayerStorage, 0)
end
]]>
</lib>
 
<talkaction words="!firestorm" 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: "!firestorm join").')
end
 
if configFire.minLevel ~= nil then
if getPlayerLevel(cid) < configFire.minLevel then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You cannot join The Fire Storm 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 cannot join The Fire Storm Event if you are not in a Protection Zone.')
end
 
if exhaustion.check(cid, configFire.exhaustStorage) ~= false then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You must wait' .. exhaustion.get(cid, configFire.exhaustStorage) .. ' seconds.')
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 the fire storm event.' or count == 1 and 'There is 1 player in fire storm event.' or count > 1 and 'There are '.. count ..' players in fire storm event.')
doCreatureSetStorage(cid, configFire.storage, 1)
 
doCreatureSetNoMove(cid, true)
local condition = createConditionObject(CONDITION_INFIGHT,-1)
 
doAddCondition(cid, condition)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have joined the Fire Storm Event, You may not move until the Event has started please wait patiently...')
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'Max players in event have been reached.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You already joined the Event, Wait patiently for it to 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 have left the Fire Run Event, And you can move now.')
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You cannot leave The Fire Storm Event.')
end
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You cannot join/leave The Fire Storm Event yet.')
end
 
exhaustion.set(cid, configFire.exhaustStorage, 5)
 
return true
end
]]>
</talkaction>
 
<talkaction words="/startfirestorm" 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 .. ' minutes. You can join the Fire Storm Event by using this command "!firestorm 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 ..' minutes. You can join the event by typing "!firestorm 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)
db.executeQuery("INSERT INTO `firestorm` (`event_name`, `winner_name`, `won_item`, `time_win`) VALUES (\"Fire\", \"' .. getCreatureName(playerTable[1]) .. '\", \"' .. getItemNameById(configFire.rewardID[prize]) .. '\", ' .. getStorage(configFire.storages.countEvent) ..');")
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 Won the 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 have lost the Fire Storm Event.')
return false
end
end
return true
end
]]>
</event>
</mod>
 
Last edited by a moderator:
Code:
[13:28:42.220] [Error - TalkAction Interface]
[13:28:42.222] domodlib("lms_config")

[13:28:42.222] function onSay(cid, words, param)
[13:28:42.223] local storage, playerJoined, counter = getCreatureStorage(cid, configFire.storage), {}, getStorage(configFire.countPlayerStorage)

[13:28:42.224] if getStorage(configFire.joinEventStorage) == 1 then
[13:28:42.225] if(param == '') then
[13:28:42.225] return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'Command param required (say: "!event join" or "!event leave").')
[13:28:42.226] end

[13:28:42.226] if configFire.minLevel ~= nil then
[13:28:42.227] if getPlayerLevel(cid) < configFire.minLevel then
[13:28:42.227] return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You cannot join The Fire Storm Event if you do not have a require level. [' .. configFire.minLevel .. ']')
[13:28:42.228] end
[13:28:42.228] end

[13:28:42.230] if getTileInfo(getThingPos(cid)).protection ~= true then
[13:28:42.233] return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You cannot join The Fire Storm Event if you are not in a Protection Zone.')
[13:28:42.233] end

[13:28:42.234] if exhaustion.check(cid, configFire.exhaustStorage) ~= false then
[13:28:42.235] return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You must wait' .. exhaustion.get(cid, configFire.exhaustStorage) .. ' seconds.')
[13:28:42.235] end

[13:28:42.236] if param == 'join' then
[13:28:42.236] if storage <= 0 then
[13:28:42.236] if counter ~= configFire.maxPlayers - 1 then
[13:28:42.237] doSetStorage(configFire.countPlayerStorage, 0)
[13:28:42.237] for _, pid in ipairs(getPlayersOnline()) do
[13:28:42.238] if getCreatureStorage(pid, configFire.storage) > 0 then
[13:28:42.238] table.insert(playerJoined, pid)
[13:28:42.239] doSetStorage(configFire.countPlayerStorage, #playerJoined)
[13:28:42.239] end
[13:28:42.239] end
[13:28:42.240] local count = getStorage(configFire.countPlayerStorage)
[13:28:42.243] doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, count == 0 and 'You are first in the fire storm event.' or count == 1 and 'There is 1 player in fire storm event.' or count > 1 and 'There are '.. count ..' players in fire storm event.')
[13:28:42.244] doCreatureSetStorage(cid, configFire.storage, 1)

[13:28:42.247] doCreatureSetNoMove(cid, true)
[13:28:42.248] local condition = createConditionObject(CONDITION_INFIGHT,-1)

[13:28:42.250] doAddCondition(cid, condition)
[13:28:42.250] doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have joined the Fire Storm Event, You may not move until the Event has started please wait patiently...')
[13:28:42.251] else
[13:28:42.251] doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'Max players in event have been reached.')
[13:28:42.254] end
[13:28:42.254] else
[13:28:42.255] doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You already joined the Event, Wait patiently for it to start.')
[13:28:42.256] end
[13:28:42.256] elseif param == 'leave' then
[13:28:42.256] if storage > 0 then
[13:28:42.257] doCreatureSetNoMove(cid, false)
[13:28:42.258] doRemoveCondition(cid, CONDITION_INFIGHT)
[13:28:42.259] doCreatureSetStorage(cid, configFire.storage, -1)
[13:28:42.260] doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'You have left the Fire Run Event, And you can move now.')
[13:28:42.260] else
[13:28:42.261] doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You cannot leave The Fire Storm Event.')
[13:28:42.261] end
[13:28:42.262] end
[13:28:42.265] else
[13:28:42.267] doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You cannot join/leave The Fire Storm Event yet.')
[13:28:42.269] end

[13:28:42.270] exhaustion.set(cid, configFire.exhaustStorage, 5)

[13:28:42.271] return true
[13:28:42.272] end
[13:28:42.272] :onSay
[13:28:42.273] Description:
[13:28:42.276] data/lib/034-exhaustion.lua:8: field 'day' missing in date table
[13:28:42.276] stack traceback:
[13:28:42.277]  [C]: in function 'time'
[13:28:42.277]  data/lib/034-exhaustion.lua:8: in function 'check'
[13:28:42.278]  [string "LuaInterface::loadBuffer"]:21: in function <[string "LuaInterface::loadBuffer"]:3>



anyone knows this? tfs 0.4
 
Back
Top