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

Solved Zombile event

movement
Code:
local config = {
    playerCount = 2001, -- Global storage for counting the players in the event
    maxPlayers = 15, -- Max players who can participate
  
    }
  
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if getGlobalStorageValue(config.playerCount) < config.maxPlayers then
        setGlobalStorageValue(config.playerCount, getGlobalStorageValue(config.playerCount)+1)
        if getGlobalStorageValue(config.playerCount) == config.maxPlayers then
            doBroadcastMessage("The Big foot event is now full [" .. getGlobalStorageValue(config.playerCount) .. " players]! The event will soon start.")
        else  
            doBroadcastMessage(getPlayerName(cid) .. " entered the Big foot event! Currently " .. getGlobalStorageValue(config.playerCount) .. " players have joined!", MESSAGE_STATUS_CONSOLE_RED)
        end  
    else
        addEvent(tpBack, 1000, cid, fromPosition)
        doPlayerSendCancel(cid, "The event is full. There is already " .. config.maxPlayers .. " players participating in the quest.")
        return false
    end
    print(getStorage(config.playerCount) .. " Players in the Big foot event.")
    return true
end

function tpBack(cid, fromPosition)
    doTeleportThing(cid, fromPosition, true)
    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
end
 
oxMQGoexK.png


?
 
Last edited by a moderator:
You can remove the player count part in the broadcast message that is not in the addEvent, when the event starts, it always have 0 players because the teleport is just created.
For the other error, add return true above the end that closes function onThink.
 
so no way to make brodcast like i need
Code:
01:14 Big foot event starting in 1 minutes. x players joined the evnt.The teleport will be closed when the event start!
??

22Ek1Dahg.png

why this appear in console when event start after this msg
01:47{owner} entered the Big foot event! Currently 1 players have joined!
if event start or no this msg must come :S
 
Last edited by a moderator:
Keep them in the loop with addEvent, remove the one above, or at least the player count part since that will be always 0 at the start.
 
No, just the part from the textmessage.
Change this
Code:
doBroadcastMessage("Big foot event starting in " .. config.timeToStartEvent .. " minutes " .. getGlobalStorageValue(config.playerCount) .. " players have joined The teleport will be closed when the event start!", MESSAGE_STATUS_WARNING)
for x = 1, config.timeToStartEvent - 1 do
      addEvent(doBroadcastMessage, x * 60 * 1000, "Big foot event starting in " .. (config.timeToStartEvent - x) .. " minutes " .. getGlobalStorageValue(config.playerCount) .. " players have joined The teleport will be closed when the event start!", MESSAGE_STATUS_WARNING)
end
To this
Code:
doBroadcastMessage("Big foot event starting in " .. config.timeToStartEvent .. " minutes. The teleport will be closed when the event start!", MESSAGE_STATUS_WARNING)
for x = 1, config.timeToStartEvent - 1 do
      addEvent(doBroadcastMessage, x * 60 * 1000, "Big foot event starting in " .. (config.timeToStartEvent - x) .. " minutes, " .. getGlobalStorageValue(config.playerCount) .. " players have joined. The teleport will be closed when the event start!", MESSAGE_STATUS_WARNING)
end

About the 0 in console, look for a print message that gets a number of something.
 
8SRP1egWM.png

still get this msg :S
and still not work when player join there was 2 player in event
12:37 Big foot event starting in 1 minutes, 0 players have joined. The teleport will be closed when the event start!

when event finish get this msg in consol :S
ZRthVWN_0.png
 
Last edited by a moderator:
Code:
local config = {
    playerCount = 2001, -- Global storage for counting the players left/entered in the event
    zombieCount = 2002, -- Global storage for counting the zombies in the event
    teleportActionId = 2000, -- Action id of the teleport needed for the movement script
    teleportPosition = {x = 1003, y = 996, z = 7, stackpos = 1}, -- Where the teleport will be created
    teleportsPosition = {x = 997, y = 996, z = 7, stackpos = 1}, -- Where the teleport will be created
    teleportToPosition = {x = 1050, y = 1919, z = 7}, -- Where the teleport will take you
    teleportId = 1387, -- Id of the teleport
    timeToStartEvent = 3, -- Minutes, after these minutes the teleport will be removed and the event will be declared started
    timeBetweenSpawns = 20, -- Seconds between each spawn of zombie
    zombieName = "Big foot", -- Name of the zombie that should be summoned
    playersNeededToStartEvent = 2, -- Players needed before the zombies can spawn.
   
    -- Should be the same as in the creaturescript!
    -- The zombies will spawn randomly inside this area
     fromPosition = {x = 978, y = 1870, z = 7}, -- top left cornor of the playground
    toPosition = {x = 1077, y = 1954, z = 7}, -- bottom right cornor of the playground
    }

function onThink(interval, lastExecution, thinkInterval)
    local tp = doCreateTeleport(config.teleportId, config.teleportToPosition, config.teleportPosition)
    doItemSetAttribute(tp, "aid", config.teleportActionId)
    local tp = doCreateTeleport(config.teleportId, config.teleportToPosition, config.teleportsPosition)
doItemSetAttribute(tp, "aid", config.teleportActionId)
    doBroadcastMessage("Big foot event starting in " .. config.timeToStartEvent .. " minutes. The teleport will be closed when the event start!", MESSAGE_STATUS_WARNING)
for x = 1, config.timeToStartEvent - 1 do
      addEvent(doBroadcastMessage, x * 60 * 1000, "Big foot event starting in " .. (config.timeToStartEvent - x) .. " minutes, " .. getGlobalStorageValue(config.playerCount) .. " players have joined. The teleport will be closed when the event start!", MESSAGE_STATUS_WARNING)
end
    setGlobalStorageValue(config.playerCount, 0)
    setGlobalStorageValue(config.zombieCount, 0)
    addEvent(startEvent, config.timeToStartEvent * 1000 * 60)
    print(getGlobalStorageValue(2001))
    return true
end

function startEvent()
    local get = getTileItemById(config.teleportPosition, config.teleportId).uid
if get > 0 then
     doRemoveItem(get, 1)
end
local get = getTileItemById(config.teleportsPosition, config.teleportId).uid
if get > 0 then
     doRemoveItem(get, 1)
end
   
    local fromp, top = config.fromPosition, config.toPosition

    if getGlobalStorageValue(config.playerCount) >= config.playersNeededToStartEvent then
        addEvent(spawnZombie, config.timeBetweenSpawns * 1000)
        doBroadcastMessage("Good luck in the Big foot event " .. getGlobalStorageValue(config.playerCount) .. " players have joined. The teleport has closed!", MESSAGE_STATUS_WARNING)
       
        for x = fromp.x, top.x do
            for y = fromp.y, top.y do
                for z = fromp.z, top.z do
                    areapos = {x = x, y = y, z = z, stackpos = 253}
                   getPlayers = getTopCreature(areapos)
                   print(getPlayers.uid)
                    if isPlayer(getPlayers.uid) then
                        doPlayerSendTextMessage(getPlayers.uid, MESSAGE_EVENT_ADVANCE, "The first Big foot will spawn in " .. config.timeBetweenSpawns .. " seconds! Good luck!")
                    end
                end
            end
        end
    else
        doBroadcastMessage("The Big foot event could not start because of to few players participating.\n At least " .. config.playersNeededToStartEvent .. " players is needed!", MESSAGE_STATUS_WARNING)
        for x = fromp.x, top.x do
            for y = fromp.y, top.y do
                for z = fromp.z, top.z do
                    areapos = {x = x, y = y, z = z, stackpos = 253}
                    getPlayers = getTopCreature(areapos)
                    print(getPlayers.uid)
                    if isPlayer(getPlayers.uid) then
                        doTeleportThing(getPlayers.uid, getTownTemplePosition(getPlayerTown(getPlayers.uid)), false)
                        doSendMagicEffect(getPlayerPosition(getPlayers.uid), CONST_ME_TELEPORT)
                    end
                end
            end
        end
    end
end

function spawnZombie()
    if getGlobalStorageValue(config.playerCount) >= 2 then
       pos = {x = math.random(config.fromPosition.x, config.toPosition.x), y = math.random(config.fromPosition.y, config.toPosition.y), z = math.random(config.fromPosition.z, config.toPosition.z)}
        doSummonCreature(config.zombieName, pos)
        doSendMagicEffect(pos, CONST_ME_MORTAREA)
        setGlobalStorageValue(config.zombieCount, getGlobalStorageValue(config.zombieCount)+1)
        for _, pid in ipairs(getPlayersOnline()) do
     if isInRange(getPlayerPosition(pid), config.fromPosition, config.toPosition) then
         doPlayerSendChannelMessage(pid, "", "A Big foot has spawned! There is currently " .. getGlobalStorageValue(config.zombieCount) .. " Big foot in the Big foot event!", TALKTYPE_CHANNEL_RN,12)
     end
end
        addEvent(spawnZombie, config.timeBetweenSpawns * 1000)
    end
end
 
no thing changed :S
msg of 0 come again in consel and 02:23 Big foot event starting in 1 minutes, 0 players have joined. The teleport will be closed when the event start!

?
 
Last edited by a moderator:
What is the interval of the globalevent? You can also look in other globalevent scripts for lines with print and remove it, or creaturescripts with type think.
 
globalevent name="zombieevent" interval="500000" event="script" value="bigfoot.lua"/>

??? nothing fixed when change interval

???????????

Pumb
 
Last edited by a moderator:
Look for other global events scripts and creaturescripts with type think if there are any lines with print and remove it.
The reason it spams 0 in your console is because you have a line with print and a value that is 0 in a script that repeats itself.
 
i have this in creaturscript.xml
Code:
<event type="think" name="Idle" event="script" value="idle.lua"/>
<event type="think" name="SkullCheck" event="script" value="skullcheck.lua"/>
 
You can look in those scripts if there is a line with print, also look in globalevents scripts. After removing the lines with print, make sure to save the scripts and restart your server.
 
i don't have any line with print just in big foot event emove it ? print(getPlayers.uid)
i searched in all scipts
 
Back
Top