• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

LSM script problem help!

matti450

Member
Joined
Apr 13, 2008
Messages
507
Reaction score
24
Lastman.lua
HTML:
local messages = {
"Last man stand event start now"
}

local i = 0
function onThink(interval, lastExecution)
    local message = messages[(i % #messages) + 1]
    doBroadcastMessage("Information: " .. message,22)
    i = i + 1
    return TRUE
end



Code:
local t = {
    tmp = {
        {x = 1079, y = 910, z = 7}, -- northwest corner of area where players must stand in order to join the event
        {x = 1083, y = 913, z = 7} -- south east corner
    },
    arena = {
        {x = 1085, y = 908, z = 7}, -- nw corner of arena
        {x = 1100, y = 917, z = 7}, -- se corner of arena
        {x = 1093, y = 912, z = 7} -- center of arena
    },
   
    from = {x = 32257, y = 32210, z = 6}, -- top left cornor of the playground (random players teleportation)
    to = {x = 32270, y = 32227, z = 6}, -- bottom right cornor of the playground (random players teleportation)
   
    minPlayers = 2, -- min players required to start the battle
    noPlayers = 1, -- no players
    prize = {6527} -- rewards
}
local kick = 0

function onThink()
    local arenaPlayers = {}

    for x = t.arena[1].x, t.arena[2].x do
        for y = t.arena[1].y, t.arena[2].y do
            for z = t.arena[1].z, t.arena[2].z do
                local pos = {x = x, y = y, z = z}
                local n = getTileInfo(pos).creatures
                if n ~= 0 then
                    pos.stackpos = 1
                    local c = getThingfromPos(pos)
                    while c.uid ~= 0 do
                        if c.itemid == 1 and c.type == 1 then
                            table.insert(arenaPlayers, c.uid)
                            if #arenaPlayers == n then
                                break
                            end
                        end
                        pos.stackpos = pos.stackpos + 1
                        c = getThingfromPos(pos)
                    end
                end
            end
        end
    end

    if #arenaPlayers == 1 then
        local p = getPlayerMasterPos(arenaPlayers[1])
        doTeleportThing(arenaPlayers[1], p)
        doSendMagicEffect(p, CONST_ME_TELEPORT)
        doPlayerSendTextMessage(arenaPlayers[1], MESSAGE_STATUS_CONSOLE_BLUE, "You won a battle and received your reward.")
        doBroadcastMessage(getCreatureName(arenaPlayers[1]) .." won a Last Man Standing battle.")
        doPlayeye0)
        kick = 0
    elseif #arenaPlayers > 1 then
        if kick == 0 then
            kick = os.time()
        else
            if os.time() - kick >= 600 then
                kick = 0
                for i = 1, #arenaPlayers do
                    doTeleportThing(arenaPlayers[i], {x=1000, y=998, z=7})
                    doPlayerSendTextMessage(arenaPlayers[i], MESSAGE_STATUS_WARNING, "Too even, try harder next time.")
                end
            end
        end
    elseif #arenaPlayers == 0 then
        kick = 0
       
        local players = {}
        for x = t.tmp[1].x, t.tmp[2].x do
            for y = t.tmp[1].y, t.tmp[2].y do
                for z = t.tmp[1].z, t.tmp[2].z do
                    local c = getTopCreature({x = x, y = y, z = z})
                    if c.type == 1 then
                        table.insert(players, c.uid)
                    end
                end
            end
        end

        if #players >= t.minPlayers then
            for i = 1, #players do
                local p = {x = math.random(t.from.x, t.to.x), y = math.random(t.from.y, t.to.y), z = math.random(t.from.z, t.to.z)}
                doTeleportThing(players[i], p)
                doSendMagicEffect(p, CONST_ME_TELEPORT)
                doPlayerSendTextMessage(players[i], MESSAGE_STATUS_WARNING, "The battle begins. Survive for glory!")
            end
        --[[else
            for i = 1, #players do
                doTeleportThing(players[i], {x=1000, y=998, z=7})
                doPlayerSendTextMessage(players[i], MESSAGE_STATUS_WARNING, "The event didn't start because there isn't enough players in area!")
            end]]
        end
    end
    return true
end



Code:
 <globalevent name="lastMan" interval="1900"
  <globalevent name="arena" interval="2100"
 
Last edited:
Use code tags and post the errors.
So edit the post, delete the script, paste it again and use code tags so the script doesn't change from how you have it now.

[ code]
script code here
[/code]
Without the space between the [ and c it will look like this.
Code:
script code here
 
Use code tags and post the errors.
So edit the post, delete the script, paste it again and use code tags so the script doesn't change from how you have it now.

[ code]
script code here
[/code]
Without the space between the [ and c it will look like this.
Code:
script code here
i think i did right now or is it the same ?
 
@matti450 if its my script i forget to give u movements file :(
i dont think its your script bro i already had this one in my server and it was with Tp timer so i removed the Timer cause i created a tp to the "room" but i want it to work xD i do not get any error in my Runer so i cant really know whats the problem
 
Add the script in code tags, so it will look like this.
Code:
script code here
Remove the script and add it again, posting the script without code tags changes the script because of other tags/forum features.
Also explain what the problem is, what happens, what should happen, what should be different etc.
 
Add the script in code tags, so it will look like this.
Code:
script code here
Remove the script and add it again, posting the script without code tags changes the script because of other tags/forum features.
Also explain what the problem is, what happens, what should happen, what should be different etc.
xD ok now ?
 
Back
Top