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

TFS 0.X event teleport problem, only one guy can join

vexler222

Active Member
Joined
Apr 22, 2012
Messages
714
Solutions
15
Reaction score
46
i have problem with event teleport, only one player can join.

Code:
function onStepIn(cid, item, pos)
if cid > 0 then
    if item.actionid == 10533 then
        if(item.itemid == 426) then
            local location = {
                {x=1163, y=883, z=7},
                {x=1167, y=883, z=7},
                {x=1169, y=883, z=7},
                {x=1172, y=883, z=7},
                {x=1162, y=885, z=7},
                {x=1164, y=885, z=7},
                {x=1171, y=885, z=7},
                {x=1173, y=885, z=7},
                {x=1162, y=887, z=7},
                {x=1164, y=887, z=7},
                {x=1171, y=887, z=7},
                {x=1173, y=887, z=7},
                {x=1163, y=889, z=7},
                {x=1167, y=889, z=7},
                {x=1169, y=889, z=7},
                {x=1172, y=889, z=7},
                {x=1165, y=891, z=7},
                {x=1167, y=891, z=7},
                {x=1169, y=891, z=7},
                {x=1171, y=891, z=7},
                {x=1173, y=891, z=7}
            }
            local playerteleported = 1
            for i=1,#location do
                getplayer = getThingFromPos(location[i])
                if getplayer.itemid > 0 then
                    playerteleported = 1
                else
                    doTeleportThing(cid,location[i])
                    doPlayerSendTextMessage(cid,22,"WOW")
                    doPlayerSendTextMessage(cid,21,"YOU JOINED TO EVENT")
                    playerteleported = 0
                end
            end
            if playerteleported > 0 then
                doTeleportThing(cid,{x=1168, y=893, z=7})
                doPlayerSendTextMessage(cid,22,"[AnvilEvent] All player ready, sorry!")
            end
        end
    end
end
end
 
Solution
It work but if i steps on tile, client get crashed everytime :(
There's only 2 reasons why you'd crash.
1) Invalid sprites at the teleport destination
2) The text we are sending is invalid for your tfs version?

Idk the second one sounds stupid, but it's the only one I can test.
soo.. try this I guess
Lua:
local locations = {
    {x = 1163, y = 883, z = 7},
    {x = 1167, y = 883, z = 7},
    {x = 1169, y = 883, z = 7},
    {x = 1172, y = 883, z = 7},
    {x = 1162, y = 885, z = 7},
    {x = 1164, y = 885, z = 7},
    {x = 1171, y = 885, z = 7},
    {x = 1173, y = 885, z = 7},
    {x = 1162, y = 887, z = 7},
    {x = 1164, y = 887, z = 7},
    {x = 1171, y = 887, z = 7},
    {x = 1173, y = 887, z = 7},
    {x = 1163, y = 889, z =...
Can you tell me how this script is supposed to work?

Not what you think is the best way to accomplish it, but what you actually want to happen.

Player X steps on Y tile and..
what then?
 
Can you tell me how this script is supposed to work?

Not what you think is the best way to accomplish it, but what you actually want to happen.

Player X steps on Y tile and..
what then?
Player X steps on tile Y and get free teleport to first position from "local location", if on first position is player, he get teleport to second position.
 
Player X steps on tile Y and get free teleport to first position from "local location", if on first position is player, he get teleport to second position.
try this.
Lua:
local locations = {
    {x = 1163, y = 883, z = 7},
    {x = 1167, y = 883, z = 7},
    {x = 1169, y = 883, z = 7},
    {x = 1172, y = 883, z = 7},
    {x = 1162, y = 885, z = 7},
    {x = 1164, y = 885, z = 7},
    {x = 1171, y = 885, z = 7},
    {x = 1173, y = 885, z = 7},
    {x = 1162, y = 887, z = 7},
    {x = 1164, y = 887, z = 7},
    {x = 1171, y = 887, z = 7},
    {x = 1173, y = 887, z = 7},
    {x = 1163, y = 889, z = 7},
    {x = 1167, y = 889, z = 7},
    {x = 1169, y = 889, z = 7},
    {x = 1172, y = 889, z = 7},
    {x = 1165, y = 891, z = 7},
    {x = 1167, y = 891, z = 7},
    {x = 1169, y = 891, z = 7},
    {x = 1171, y = 891, z = 7},
    {x = 1173, y = 891, z = 7}
}

function onStepIn(cid, item, position, fromPosition)
    for i = 1, locations do
        if getTopCreature(locations[i]).uid < 1 then
            doTeleportThing(cid, locations[i])
            doPlayerSendTextMessage(cid, MESSAGE_DAMAGE_RECEIVED, "WOW")
            doPlayerSendTextMessage(cid, MESSAGE_DAMAGE_DEALT, "YOU JOINED TO EVENT")
            return true
        end
    end
   
    doTeleportThing(cid, fromPosition)
    doPlayerSendTextMessage(cid, MESSAGE_DAMAGE_RECEIVED, "[AnvilEvent] All player ready, sorry!")
    return true
end
 
try this.
Lua:
local locations = {
    {x = 1163, y = 883, z = 7},
    {x = 1167, y = 883, z = 7},
    {x = 1169, y = 883, z = 7},
    {x = 1172, y = 883, z = 7},
    {x = 1162, y = 885, z = 7},
    {x = 1164, y = 885, z = 7},
    {x = 1171, y = 885, z = 7},
    {x = 1173, y = 885, z = 7},
    {x = 1162, y = 887, z = 7},
    {x = 1164, y = 887, z = 7},
    {x = 1171, y = 887, z = 7},
    {x = 1173, y = 887, z = 7},
    {x = 1163, y = 889, z = 7},
    {x = 1167, y = 889, z = 7},
    {x = 1169, y = 889, z = 7},
    {x = 1172, y = 889, z = 7},
    {x = 1165, y = 891, z = 7},
    {x = 1167, y = 891, z = 7},
    {x = 1169, y = 891, z = 7},
    {x = 1171, y = 891, z = 7},
    {x = 1173, y = 891, z = 7}
}

function onStepIn(cid, item, position, fromPosition)
    for i = 1, locations do
        if getTopCreature(locations[i]).uid < 1 then
            doTeleportThing(cid, locations[i])
            doPlayerSendTextMessage(cid, MESSAGE_DAMAGE_RECEIVED, "WOW")
            doPlayerSendTextMessage(cid, MESSAGE_DAMAGE_DEALT, "YOU JOINED TO EVENT")
            return true
        end
    end
  
    doTeleportThing(cid, fromPosition)
    doPlayerSendTextMessage(cid, MESSAGE_DAMAGE_RECEIVED, "[AnvilEvent] All player ready, sorry!")
    return true
end

It work but if i steps on tile, client get crashed everytime :(
 
It work but if i steps on tile, client get crashed everytime :(
There's only 2 reasons why you'd crash.
1) Invalid sprites at the teleport destination
2) The text we are sending is invalid for your tfs version?

Idk the second one sounds stupid, but it's the only one I can test.
soo.. try this I guess
Lua:
local locations = {
    {x = 1163, y = 883, z = 7},
    {x = 1167, y = 883, z = 7},
    {x = 1169, y = 883, z = 7},
    {x = 1172, y = 883, z = 7},
    {x = 1162, y = 885, z = 7},
    {x = 1164, y = 885, z = 7},
    {x = 1171, y = 885, z = 7},
    {x = 1173, y = 885, z = 7},
    {x = 1162, y = 887, z = 7},
    {x = 1164, y = 887, z = 7},
    {x = 1171, y = 887, z = 7},
    {x = 1173, y = 887, z = 7},
    {x = 1163, y = 889, z = 7},
    {x = 1167, y = 889, z = 7},
    {x = 1169, y = 889, z = 7},
    {x = 1172, y = 889, z = 7},
    {x = 1165, y = 891, z = 7},
    {x = 1167, y = 891, z = 7},
    {x = 1169, y = 891, z = 7},
    {x = 1171, y = 891, z = 7},
    {x = 1173, y = 891, z = 7}
}

function onStepIn(cid, item, position, fromPosition)
    for i = 1, locations do
        if getTopCreature(locations[i]).uid < 1 then
            doTeleportThing(cid, locations[i])
            -- doPlayerSendTextMessage(cid, MESSAGE_DAMAGE_RECEIVED, "WOW")
            -- doPlayerSendTextMessage(cid, MESSAGE_DAMAGE_DEALT, "YOU JOINED TO EVENT")
            return true
        end
    end
   
    doTeleportThing(cid, fromPosition)
    -- doPlayerSendTextMessage(cid, MESSAGE_DAMAGE_RECEIVED, "[AnvilEvent] All player ready, sorry!")
    return true
end
 
Solution
There's only 2 reasons why you'd crash.
1) Invalid sprites at the teleport destination
2) The text we are sending is invalid for your tfs version?

Idk the second one sounds stupid, but it's the only one I can test.
soo.. try this I guess
Lua:
local locations = {
    {x = 1163, y = 883, z = 7},
    {x = 1167, y = 883, z = 7},
    {x = 1169, y = 883, z = 7},
    {x = 1172, y = 883, z = 7},
    {x = 1162, y = 885, z = 7},
    {x = 1164, y = 885, z = 7},
    {x = 1171, y = 885, z = 7},
    {x = 1173, y = 885, z = 7},
    {x = 1162, y = 887, z = 7},
    {x = 1164, y = 887, z = 7},
    {x = 1171, y = 887, z = 7},
    {x = 1173, y = 887, z = 7},
    {x = 1163, y = 889, z = 7},
    {x = 1167, y = 889, z = 7},
    {x = 1169, y = 889, z = 7},
    {x = 1172, y = 889, z = 7},
    {x = 1165, y = 891, z = 7},
    {x = 1167, y = 891, z = 7},
    {x = 1169, y = 891, z = 7},
    {x = 1171, y = 891, z = 7},
    {x = 1173, y = 891, z = 7}
}

function onStepIn(cid, item, position, fromPosition)
    for i = 1, locations do
        if getTopCreature(locations[i]).uid < 1 then
            doTeleportThing(cid, locations[i])
            -- doPlayerSendTextMessage(cid, MESSAGE_DAMAGE_RECEIVED, "WOW")
            -- doPlayerSendTextMessage(cid, MESSAGE_DAMAGE_DEALT, "YOU JOINED TO EVENT")
            return true
        end
    end
  
    doTeleportThing(cid, fromPosition)
    -- doPlayerSendTextMessage(cid, MESSAGE_DAMAGE_RECEIVED, "[AnvilEvent] All player ready, sorry!")
    return true
end

Yea, second reason is right :D
 
Back
Top