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

Swap + non-pvp

Djowz

Djowz's Style
Joined
Dec 29, 2011
Messages
47
Reaction score
1
I have a problem on my server, I created a practice area for the players they would have to stay on top of each other in order to train. most players can not stay insides of each other in non-pvp tiles someone could help me?
and also like to know if anyone would know how to add a swaping system
thank you
 
Just make the ground around the training place non-pvp? Theres a tool in the mapeditor for that.

Lua:
local combat = createCombatObject()

local config = {
    notAllowed = {"training monk", "sizaro", "neon", "peroxide", "leftwing", "sharp", "aftonbladet", "illusion", "mackan"},
    exhaustStorage = 1338,
    exhaustTime = 5,
    slowStorage = 1339,
    slowTime = 3,
    slowSpeed = 100,
    }

function effect(cid, var, targetpos, mypos, target)
    doSendMagicEffect(mypos, CONST_ME_ENERGYHIT)
    doSendMagicEffect(targetpos, CONST_ME_ENERGYHIT)
end

function slowed(cid, speed)
    doChangeSpeed(cid, getPlayerStorageValue(cid, config.slowStorage) - getCreatureSpeed(cid))
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
end

function onCastSpell(cid, var)
    setPlayerStorageValue(cid, config.slowStorage, getCreatureSpeed(cid))
    local mypos = getCreaturePosition(cid)
    local target = getCreatureTarget(cid)
    local targetpos = getCreaturePosition(target)
    if not exhaustion.get(cid, config.exhaustStorage) then
        for _,v in ipairs(config.notAllowed) do
            if string.find(getCreatureName(target):lower(), v) then
                doPlayerSendCancel(cid, "You can't swap " .. getCreatureName(target) .. "!")
                doSendMagicEffect(mypos, CONST_ME_POFF)
                return false
            else
                doTeleportThing(cid, targetpos)
                doTeleportThing(target, mypos)
                doChangeSpeed(cid, -getCreatureSpeed(cid)+config.slowSpeed)
                doSendDistanceShoot(mypos, targetpos, CONST_ANI_ENERGYBALL)
                doSendDistanceShoot(targetpos, mypos, CONST_ANI_ENERGYBALL)
                addEvent(effect, 150, cid, var, targetpos, mypos, target)
                addEvent(slowed, config.slowTime * 1000, cid, speed)
                exhaustion.set(cid, config.exhaustStorage, config.exhaustTime)
            end
        end
    else
        doPlayerSendCancel(cid, "You have to wait " .. exhaustion.get(cid, config.exhaustStorage) .. " seconds to swap positions again!")
        return false
    end
    doCombat(cid, combat, var)
    return true
end

Credits goes to the creator, I can't remember who he is but if you search "swap" on otland you will find it in spells scripts section.
 
I've done this, if I put the tiles where the non-pvp players shall go tiles train and pz zone around most players can not stay on top of each other
 
Back
Top