• 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 Swimming TFS 036.. problem

Kavvson

Gdy boli cie glowa wez
Joined
Jun 25, 2008
Messages
1,177
Reaction score
72
Location
Poland
PHP:
  local outfit =  {lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}

local BORDERS = {
        [7943] = {x = 0, y = -2, back = SOUTH},
        [7944] = {x = -2, y = 0, back = EAST},
        [7945] = {x = 0, y = 2, back = NORTH},
        [7946] = {x = 2, y = 0, back = WEST},
        [7947] = {x = 2, y = 1, back = WEST},
        [7948] = {x = -2, y = 1, back = NORTH},
        [7949] = {x = 2, y = -1, back = WEST},
        [7950] = {x = -2, y = -1, back = WEST},
        [7951] = {x = 2, y = 2, back = WEST},
        [7952] = {x = -2, y = 2, back = NORTH},
        [7953] = {x = 2, y = -2, back = WEST},
        [7954] = {x = -2, y = -2, back = SOUTH}
}

BORDERS[4828] = BORDERS[7943]
BORDERS[4829] = BORDERS[7946]
BORDERS[4830] = BORDERS[7945]
BORDERS[4831] = BORDERS[7944]

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
        if(not isPlayer(cid)) then
                return true
        end

        local border = BORDERS[item.itemid]
        if(not border) then
                return false
        end
        if hasCondition(cid, CONDITION_INFIGHT) then
                return doPlayerSendCancel(cid, "You are in a fight.") and doTeleportThing(cid, fromPosition)
        end

        local pos, newPos = getCreaturePosition(cid), {}
        newPos = pos
        newPos.x = pos.x + border.x
        newPos.y = pos.y + border.y

        if(hasCondition(cid, CONDITION_OUTFIT) and getCreatureOutfit(cid).lookType == outfit.lookType) then
                doMoveCreature(cid, border.back)
                doRemoveCondition(cid, CONDITION_OUTFIT)
        else
                if(doTileQueryAdd(cid, pos, 4) ~= RETURNVALUE_NOERROR) then
                        return false
                end

                doRemoveConditions(cid, true)

                doSendMagicEffect(pos, CONST_ME_POFF)
                doTeleportThing(cid, newPos)
                doSendMagicEffect(pos, CONST_ME_WATERSPLASH)

                doSetCreatureOutfit(cid, outfit, -1)
        end

        return true
end

Why the scripts causes abnormally save time? The server was making server save like every 30 sec?
 
Back
Top