• 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!

Lua Zombie Event Stones & other console error 0.4

Yusuf El-Shora

Herizona-Ots
Joined
Jul 19, 2015
Messages
170
Reaction score
6
Location
Lala-Land
hey there i'm using tfs 0.4 ..
and facing some problems,

first of all it's the zombie event, it's working okay but there is a stones closing the zombie area and when I say /zombie start

the stones are removed automatic duo to this script :

Lua:
function getZombiesEventPlayers()
    local players = {}
    for _, zid in pairs(getPlayersOnline()) do
        if getPlayerStorageValue(zid, 1288) == 1 then
            table.insert(players, zid)
        end
    end
    return players
end

local players = getZombiesEventPlayers()
  
function onSay(cid, words, param, channel)
local t = split(param, ',')

local stones = {
{x = 1054, y = 1183, z = 7},
{x = 1055, y = 1183, z = 7},
{x = 1056, y = 1183, z = 7},
{x = 1057, y = 1183, z = 7}
}

local pumkins = {
{x = 1053, y = 1172, z = 7},
{x = 1062, y = 1174, z = 7},
{x = 1057, y = 1167, z = 7},
{x = 1044, y = 1173, z = 7}
}

---------------------------------------------------------------------------------------------------------------------------
if (t[1] == 'start') then

local storage = getGlobalStorageValue(1285)

if  storage == 1 then


for _, bid in pairs(getPlayersOnline()) do
if getCreatureStorage(bid, 1288) == 1 and getPlayerAccess(bid) < 3 then
local newpos = {x = 1055, y = 1182, z = 7}
doTeleportThing(bid, newpos)
end
end

for i = 1, 4 do
doSendMagicEffect(stones[i], 35)
doRemoveItem(getTileItemById({x = 1054, y = 1183, z = 7}, 1285).uid)
doRemoveItem(getTileItemById({x = 1055, y = 1183, z = 7}, 1285).uid)
doRemoveItem(getTileItemById({x = 1056, y = 1183, z = 7}, 1285).uid)
doRemoveItem(getTileItemById({x = 1057, y = 1183, z = 7}, 1285).uid)
doSendAnimatedText(stones[i], "RUN", 240)
end

doRemoveItem(getTileItemById({x = 991, y = 1000, z = 7}, 1387).uid)
setGlobalStorageValue(1285, 2)
doBroadcastMessage("".. getCreatureName(cid) .." has started zombie event and removed teleport in temple", MESSAGE_EVENT_ADVANCE)

for f = 1, 6 do
    doSummonCreature("Psycho Pumpkin", pumkins[f])
end
else
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Open zombie teleport first with /zombie waiting.")
end
---------------------------------------------------------------------------------------------------------------------
elseif (t[1] == 'end') then

local storage = getGlobalStorageValue(1285)

if  storage ~= 0 then

function CleanPlayers()
for x = 1052, 1059 do
for y = 1183, 1187 do

local newpos = {x = 994, y = 993, z = 7}
local a = getTopCreature({x=x, y=y, z=7}).uid
if a ~= 0 and isPlayer(a) then
doTeleportThing(a, newpos)
doSendMagicEffect(newpos, CONST_ME_POFF)
end
end
end
end

for _, aid in pairs(getPlayersOnline()) do
if getCreatureStorage(aid, 1288) == 1 and getPlayerAccess(aid) < 3 then
doCreatureSetStorage(aid, 1288, 0)
end
end

CleanPlayers()
doRemoveItem(getTileItemById({x = 991, y = 1000, z = 7}, 1387).uid)
setGlobalStorageValue(1285, 0)

function CleanArena()
for x = 1042, 1070 do
for y = 1165, 1186 do

local newpos = {x = 994, y = 993, z = 7}
local a = getTopCreature({x=x, y=y, z=7}).uid
if a ~= 0 and isMonster(a) then
doRemoveCreature(a)
elseif a ~= 0 and isPlayer(a) then
doTeleportThing(a, newpos)
doSendMagicEffect(newpos, CONST_ME_POFF)
end
a = getThingfromPos({x=x, y=y, z=7, stackpos=254}).uid
if a ~= 0 then
doRemoveItem(a)
end
end
end
return true
end

CleanArena()
else
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Zombie event is not open atm.")
end
--------------------------------------------------------------------------------------------------------------------------------------
elseif (t[1] == 'waiting') then

function getZombiesEventPlayers()
local players = {}
for _, zid in pairs(getPlayersOnline()) do
if getCreatureStorage(zid, 1288) == 1 and getPlayerAccess(zid) < 3 then
table.insert(players, zid)
end
end
return players
end
  
local storage = getGlobalStorageValue(1285)
local tp =     doCreateTeleport(1387, {x = 1055, y = 1185, z = 7}, {x = 991, y = 1000, z = 7})
if  storage ~= 1 then
    setGlobalStorageValue(1285, 1)
    doItemSetAttribute(tp, "aid", 1285)
    doBroadcastMessage("".. getCreatureName(cid) .." has started zombie event to enter go temple teleport on south", MESSAGE_EVENT_ADVANCE)
else
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Zombie is already waiting for players.")
end
elseif (t[1] == 'check') then
    local players = getZombiesEventPlayers()
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[".. #players .."] players with zombie storage")
elseif (t[1] == 'kick') then
    local kid = getPlayerByNameWildcard(t[2])
    if(not kid) then
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have to enter player name after kick.")
    else
        if getCreatureStorage(kid, 1288) == 1 then
               doBroadcastMessage("" .. getCreatureName(cid) .. " has kicked [" .. getCreatureName(kid) .. "] from zombie event!", MESSAGE_STATUS_CONSOLE_RED)
            doCreatureSetStorage(kid, 1288, 0)
            doTeleportThing(kid, {x = 994, y = 993, z = 7})
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[".. getCreatureName(kid) .."] not in zombie event.")
        end
    end
end
return true
end

I wand to edit it as i say /zombie end , the stones are back automatic and I dont need to go and put stones again after the event ends ..
....................

Second problem is shown in the picture, tried to remove the item from map but it's the Depot, and the location is not exist, it's out of the map boundary.


C2CqBmZ.png



tried to empty (tiles/ tiles_items) in php but already nothing in there ..


Thanks in Advance ..
 
Solution
Try this.

And please, for the love of god, keep your scripts tabbed.
Lua:
function getZombiesEventPlayers()
    local players = {}
    for _, zid in pairs(getPlayersOnline()) do
        if getPlayerStorageValue(zid, 1288) == 1 then
            table.insert(players, zid)
        end
    end
    return players
end
local players = getZombiesEventPlayers()
function onSay(cid, words, param, channel)
    local t = split(param, ',')
    local stones = {
        {x = 1054, y = 1183, z = 7},
        {x = 1055, y = 1183, z = 7},
        {x = 1056, y = 1183, z = 7},
        {x = 1057, y = 1183, z = 7}
    }
    local pumkins = {
        {x = 1053, y = 1172, z = 7},
        {x = 1062, y = 1174, z = 7},
        {x = 1057, y = 1167, z = 7},
        {x...
Try this.

And please, for the love of god, keep your scripts tabbed.
Lua:
function getZombiesEventPlayers()
    local players = {}
    for _, zid in pairs(getPlayersOnline()) do
        if getPlayerStorageValue(zid, 1288) == 1 then
            table.insert(players, zid)
        end
    end
    return players
end
local players = getZombiesEventPlayers()
function onSay(cid, words, param, channel)
    local t = split(param, ',')
    local stones = {
        {x = 1054, y = 1183, z = 7},
        {x = 1055, y = 1183, z = 7},
        {x = 1056, y = 1183, z = 7},
        {x = 1057, y = 1183, z = 7}
    }
    local pumkins = {
        {x = 1053, y = 1172, z = 7},
        {x = 1062, y = 1174, z = 7},
        {x = 1057, y = 1167, z = 7},
        {x = 1044, y = 1173, z = 7}
    }
---------------------------------------------------------------------------------------------------------------------------
    if (t[1] == 'start') then
        local storage = getGlobalStorageValue(1285)
        if  storage == 1 then
            for _, bid in pairs(getPlayersOnline()) do
                if getCreatureStorage(bid, 1288) == 1 and getPlayerAccess(bid) < 3 then
                    local newpos = {x = 1055, y = 1182, z = 7}
                    doTeleportThing(bid, newpos)
                end
            end
            for i = 1, 4 do
                doSendMagicEffect(stones[i], 35)
                doRemoveItem(getTileItemById({x = 1054, y = 1183, z = 7}, 1285).uid)
                doRemoveItem(getTileItemById({x = 1055, y = 1183, z = 7}, 1285).uid)
                doRemoveItem(getTileItemById({x = 1056, y = 1183, z = 7}, 1285).uid)
                doRemoveItem(getTileItemById({x = 1057, y = 1183, z = 7}, 1285).uid)
                doSendAnimatedText(stones[i], "RUN", 240)
            end
            doRemoveItem(getTileItemById({x = 991, y = 1000, z = 7}, 1387).uid)
            setGlobalStorageValue(1285, 2)
            doBroadcastMessage("".. getCreatureName(cid) .." has started zombie event and removed teleport in temple", MESSAGE_EVENT_ADVANCE)
            for f = 1, 6 do
                doSummonCreature("Psycho Pumpkin", pumkins[f])
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Open zombie teleport first with /zombie waiting.")
        end
---------------------------------------------------------------------------------------------------------------------
    elseif (t[1] == 'end') then
        local storage = getGlobalStorageValue(1285)
        if  storage ~= 0 then
            function CleanPlayers()
                for x = 1052, 1059 do
                    for y = 1183, 1187 do
                        local newpos = {x = 994, y = 993, z = 7}
                        local a = getTopCreature({x=x, y=y, z=7}).uid
                        if a ~= 0 and isPlayer(a) then
                            doTeleportThing(a, newpos)
                            doSendMagicEffect(newpos, CONST_ME_POFF)
                        end
                    end
                end
            end
            for _, aid in pairs(getPlayersOnline()) do
                if getCreatureStorage(aid, 1288) == 1 and getPlayerAccess(aid) < 3 then
                    doCreatureSetStorage(aid, 1288, 0)
                end
            end
            CleanPlayers()
            doRemoveItem(getTileItemById({x = 991, y = 1000, z = 7}, 1387).uid)
            setGlobalStorageValue(1285, 0)
            function CleanArena()
                for x = 1042, 1070 do
                    for y = 1165, 1186 do
                        local newpos = {x = 994, y = 993, z = 7}
                        local a = getTopCreature({x=x, y=y, z=7}).uid
                        if a ~= 0 and isMonster(a) then
                            doRemoveCreature(a)
                        elseif a ~= 0 and isPlayer(a) then
                            doTeleportThing(a, newpos)
                            doSendMagicEffect(newpos, CONST_ME_POFF)
                        end
                        a = getThingfromPos({x=x, y=y, z=7, stackpos=254}).uid
                        if a ~= 0 then
                            doRemoveItem(a)
                        end
                    end
                end
                return true
            end
            CleanArena()
            doCreateItem(1285, 1, {x = 1054, y = 1183, z = 7})
            doCreateItem(1285, 1, {x = 1055, y = 1183, z = 7})
            doCreateItem(1285, 1, {x = 1056, y = 1183, z = 7})
            doCreateItem(1285, 1, {x = 1057, y = 1183, z = 7})
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Zombie event is not open atm.")
        end
--------------------------------------------------------------------------------------------------------------------------------------
    elseif (t[1] == 'waiting') then
        function getZombiesEventPlayers()
            local players = {}
            for _, zid in pairs(getPlayersOnline()) do
                if getCreatureStorage(zid, 1288) == 1 and getPlayerAccess(zid) < 3 then
                    table.insert(players, zid)
                end
            end
            return players
        end
        local storage = getGlobalStorageValue(1285)
        local tp =     doCreateTeleport(1387, {x = 1055, y = 1185, z = 7}, {x = 991, y = 1000, z = 7})
        if  storage ~= 1 then
            setGlobalStorageValue(1285, 1)
            doItemSetAttribute(tp, "aid", 1285)
            doBroadcastMessage("".. getCreatureName(cid) .." has started zombie event to enter go temple teleport on south", MESSAGE_EVENT_ADVANCE)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Zombie is already waiting for players.")
        end
    elseif (t[1] == 'check') then
        local players = getZombiesEventPlayers()
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[".. #players .."] players with zombie storage")
    elseif (t[1] == 'kick') then
        local kid = getPlayerByNameWildcard(t[2])
        if(not kid) then
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have to enter player name after kick.")
        else
            if getCreatureStorage(kid, 1288) == 1 then
                doBroadcastMessage("" .. getCreatureName(cid) .. " has kicked [" .. getCreatureName(kid) .. "] from zombie event!", MESSAGE_STATUS_CONSOLE_RED)
                doCreatureSetStorage(kid, 1288, 0)
                doTeleportThing(kid, {x = 994, y = 993, z = 7})
            else
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[".. getCreatureName(kid) .."] not in zombie event.")
            end
        end
    end
    return true
end
 
Solution
Try this.

And please, for the love of god, keep your scripts tabbed.
Lua:
function getZombiesEventPlayers()
    local players = {}
    for _, zid in pairs(getPlayersOnline()) do
        if getPlayerStorageValue(zid, 1288) == 1 then
            table.insert(players, zid)
        end
    end
    return players
end
local players = getZombiesEventPlayers()
function onSay(cid, words, param, channel)
    local t = split(param, ',')
    local stones = {
        {x = 1054, y = 1183, z = 7},
        {x = 1055, y = 1183, z = 7},
        {x = 1056, y = 1183, z = 7},
        {x = 1057, y = 1183, z = 7}
    }
    local pumkins = {
        {x = 1053, y = 1172, z = 7},
        {x = 1062, y = 1174, z = 7},
        {x = 1057, y = 1167, z = 7},
        {x = 1044, y = 1173, z = 7}
    }
---------------------------------------------------------------------------------------------------------------------------
    if (t[1] == 'start') then
        local storage = getGlobalStorageValue(1285)
        if  storage == 1 then
            for _, bid in pairs(getPlayersOnline()) do
                if getCreatureStorage(bid, 1288) == 1 and getPlayerAccess(bid) < 3 then
                    local newpos = {x = 1055, y = 1182, z = 7}
                    doTeleportThing(bid, newpos)
                end
            end
            for i = 1, 4 do
                doSendMagicEffect(stones[i], 35)
                doRemoveItem(getTileItemById({x = 1054, y = 1183, z = 7}, 1285).uid)
                doRemoveItem(getTileItemById({x = 1055, y = 1183, z = 7}, 1285).uid)
                doRemoveItem(getTileItemById({x = 1056, y = 1183, z = 7}, 1285).uid)
                doRemoveItem(getTileItemById({x = 1057, y = 1183, z = 7}, 1285).uid)
                doSendAnimatedText(stones[i], "RUN", 240)
            end
            doRemoveItem(getTileItemById({x = 991, y = 1000, z = 7}, 1387).uid)
            setGlobalStorageValue(1285, 2)
            doBroadcastMessage("".. getCreatureName(cid) .." has started zombie event and removed teleport in temple", MESSAGE_EVENT_ADVANCE)
            for f = 1, 6 do
                doSummonCreature("Psycho Pumpkin", pumkins[f])
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Open zombie teleport first with /zombie waiting.")
        end
---------------------------------------------------------------------------------------------------------------------
    elseif (t[1] == 'end') then
        local storage = getGlobalStorageValue(1285)
        if  storage ~= 0 then
            function CleanPlayers()
                for x = 1052, 1059 do
                    for y = 1183, 1187 do
                        local newpos = {x = 994, y = 993, z = 7}
                        local a = getTopCreature({x=x, y=y, z=7}).uid
                        if a ~= 0 and isPlayer(a) then
                            doTeleportThing(a, newpos)
                            doSendMagicEffect(newpos, CONST_ME_POFF)
                        end
                    end
                end
            end
            for _, aid in pairs(getPlayersOnline()) do
                if getCreatureStorage(aid, 1288) == 1 and getPlayerAccess(aid) < 3 then
                    doCreatureSetStorage(aid, 1288, 0)
                end
            end
            CleanPlayers()
            doRemoveItem(getTileItemById({x = 991, y = 1000, z = 7}, 1387).uid)
            setGlobalStorageValue(1285, 0)
            function CleanArena()
                for x = 1042, 1070 do
                    for y = 1165, 1186 do
                        local newpos = {x = 994, y = 993, z = 7}
                        local a = getTopCreature({x=x, y=y, z=7}).uid
                        if a ~= 0 and isMonster(a) then
                            doRemoveCreature(a)
                        elseif a ~= 0 and isPlayer(a) then
                            doTeleportThing(a, newpos)
                            doSendMagicEffect(newpos, CONST_ME_POFF)
                        end
                        a = getThingfromPos({x=x, y=y, z=7, stackpos=254}).uid
                        if a ~= 0 then
                            doRemoveItem(a)
                        end
                    end
                end
                return true
            end
            CleanArena()
            doCreateItem(1285, 1, {x = 1054, y = 1183, z = 7})
            doCreateItem(1285, 1, {x = 1055, y = 1183, z = 7})
            doCreateItem(1285, 1, {x = 1056, y = 1183, z = 7})
            doCreateItem(1285, 1, {x = 1057, y = 1183, z = 7})
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Zombie event is not open atm.")
        end
--------------------------------------------------------------------------------------------------------------------------------------
    elseif (t[1] == 'waiting') then
        function getZombiesEventPlayers()
            local players = {}
            for _, zid in pairs(getPlayersOnline()) do
                if getCreatureStorage(zid, 1288) == 1 and getPlayerAccess(zid) < 3 then
                    table.insert(players, zid)
                end
            end
            return players
        end
        local storage = getGlobalStorageValue(1285)
        local tp =     doCreateTeleport(1387, {x = 1055, y = 1185, z = 7}, {x = 991, y = 1000, z = 7})
        if  storage ~= 1 then
            setGlobalStorageValue(1285, 1)
            doItemSetAttribute(tp, "aid", 1285)
            doBroadcastMessage("".. getCreatureName(cid) .." has started zombie event to enter go temple teleport on south", MESSAGE_EVENT_ADVANCE)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Zombie is already waiting for players.")
        end
    elseif (t[1] == 'check') then
        local players = getZombiesEventPlayers()
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[".. #players .."] players with zombie storage")
    elseif (t[1] == 'kick') then
        local kid = getPlayerByNameWildcard(t[2])
        if(not kid) then
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have to enter player name after kick.")
        else
            if getCreatureStorage(kid, 1288) == 1 then
                doBroadcastMessage("" .. getCreatureName(cid) .. " has kicked [" .. getCreatureName(kid) .. "] from zombie event!", MESSAGE_STATUS_CONSOLE_RED)
                doCreatureSetStorage(kid, 1288, 0)
                doTeleportThing(kid, {x = 994, y = 993, z = 7})
            else
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[".. getCreatureName(kid) .."] not in zombie event.")
            end
        end
    end
    return true
end

it's working, thanks mate
but the players did really die and lose lvl, when the got hitted the just die not teleported to temple without death ..
and no one wins or gets a reward
 
it's working, thanks mate
but the players did really die and lose lvl, when the got hitted the just die not teleported to temple without death ..
and no one wins or gets a reward
I can only I can only fix errors you tell me about. You can add a PVP area into that section and they will teleport it to Temple without dying. As for the reward I don't know how the actual event work.
 
I can only I can only fix errors you tell me about. You can add a PVP area into that section and they will teleport it to Temple without dying. As for the reward I don't know how the actual event work.

last survivor should be the winner .. like firestorm event last player still alive wins the reward ..
i got that firestorm script if you want to check the last survivor condition.

Fire_storm: Lua code - 331 lines - codepad
 
last survivor should be the winner .. like firestorm event last player still alive wins the reward ..
i got that firestorm script if you want to check the last survivor condition.

Fire_storm: Lua code - 331 lines - codepad
line 118.
Some sort of database query bullshit.
I don't do that. lol

@ your other problem though.. with the map.
Code:
DELETE FROM `tile_items` WHERE `itemtype` = NULL
 
Back
Top