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

CTF not working probably

Ray Rewind

Doctor
Joined
Jun 6, 2009
Messages
1,349
Reaction score
76
Location
Germany
I always get message in Console CTF is Starting in 1 Minute also ingame as Broadcast. But nothing happnds


Creature Scripts

stats_Ctf
Code:
local t = {
    redPos = {x = 100, y = 200, z = 7},
    bluePos = {x = 100, y = 200, z = 7},
    redStorage = 15000,
    blueStorage = 15001,
    redFlag = 8000,
    blueFlag = 9000
}
function onStatsChange(cid, attacker, type, combat, value)
    if type == 1 then
        if getCreatureHealth(cid) <= value then
            if isPlayer(cid) and isCreature(attacker) then
                if getGlobalStorageValue(t.redFlag) == 1 and getPlayerStorageValue(cid, t.redFlag) == 1 then
                    setPlayerStorageValue(cid, t.redFlag, -1)
                    setGlobalStorageValue(t.redFlag, -1)
                    doBroadcastMessage(getCreatureName(cid) .. " has lost the Red Flag!")
                elseif getGlobalStorageValue(t.blueFlag) == 1 and getPlayerStorageValue(cid, t.blueFlag) == 1 then
                    setPlayerStorageValue(cid, t.blueFlag, -1)
                    setGlobalStorageValue(t.blueFlag, -1)
                    doBroadcastMessage(getCreatureName(cid) .. " has lost the Blue Flag!")
                end
                if getPlayerStorageValue(cid, t.redStorage) == 1 then
                    doTeleportThing(cid, t.redPos, true)
                elseif getPlayerStorageValue(cid, t.blueStorage) == 1 then
                    doTeleportThing(cid, t.bluePos, true)
                end
            end
            return false
        end
    end
    return true
end


ctf_Target
Code:
local t = {
    redStorage = 15000,
    blueStorage = 15001
}
function onCombat(cid, target)
    if isPlayer(cid) and isPlayer(target) then
        if getPlayerStorageValue(cid, t.redStorage) == 1 and getPlayerStorageValue(target, t.redStorage) == 1 then
            return doPlayerSendCancel(cid, "You may not attack your team mates.") and false
        elseif getPlayerStorageValue(cid, t.blueStorage) == 1 and getPlayerStorageValue(target, t.blueStorage) == 1 then
            return doPlayerSendCancel(cid, "You may not attack your team mates.") and false
        end
    end
    return true
end


Code:
    <event type="statschange" name="stats_ctf" event="script" value="ctf/stats_ctf.lua"/>
    <event type="combat" name="ctf_target" event="script" value="ctf/ctf_target.lua"/>



Global events

Code:
local t = {
    redPos = {x = 809, y = 1166, z = 7},
    bluePos = {x = 879, y = 1201, z = 7},
    redStorage = 15000,
    blueStorage = 15001,
    fromPos = {x = 787, y = 1028, z = 7},
    toPos = {x = 792, y = 1033, z = 7}
}
local conditionBlue = createConditionObject(CONDITION_OUTFIT)
    setConditionParam(conditionBlue, CONDITION_PARAM_TICKS, 1800 * 1000)
    addOutfitCondition(conditionBlue, {lookType = 130, lookHead = 87, lookBody = 87, lookLegs = 87, lookFeet = 87})
local conditionRed = createConditionObject(CONDITION_OUTFIT)
    setConditionParam(conditionRed, CONDITION_PARAM_TICKS, 1800 * 1000)
    addOutfitCondition(conditionRed, {lookType = 130, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94})
local function teleportThing(minutes)
    local event = 0
    if minutes <= 0 then
        for _, cid in ipairs(getPlayersOnline()) do
            if isInRange(getThingPos(cid), t.fromPos, t.toPos) then
                if math.random(1, 3) < 3 then
                    setPlayerStorageValue(cid, t.redStorage, 1)
                    doAddCondition(cid, conditionRed)
                    doTeleportThing(cid, t.redPos, true)
                else
                    setPlayerStorageValue(cid, t.blueStorage, 1)
                    doAddCondition(cid, conditionBlue)
                    doTeleportThing(cid, t.bluePos, true)
                end
            end
        end
        return true
    end
    if minutes == 1 then
        doBroadcastMessage("Capture The Flag will begin in " .. minutes .. " minute!")
    elseif minutes <= 3 then
        doBroadcastMessage("Capture The Flag will begin in " .. minutes .. " minutes!")
    else
        doBroadcastMessage("Capture The Flag will begin in " .. minutes .. " minutes!")
    end
    event = addEvent(teleportThing, 60, minutes - 1)
    return true
end
function onThink(interval, lastExecution)
    return teleportThing(math.abs(math.ceil(1)))
end


Code:
    <!--CTF -->
    <globalevent name="ctf_event" interval="120" event="script" value="ctf/ctf.lua"/>
 
sorry doublepost 1k chars per post only

Movements

Code:
local t = {
    redStorage = 15000,
    blueStorage = 15001,
    redFlag = 18000,
    blueFlag = 18001,
    redGoal = 19000,
    blueGoal = 19001
}
local function repeatFlagOnPlayer(cid)
    local k = getThingPos(cid)
    local r = {
        {pos = {x = k.x + 2, y = k.y - 2, z = k.z}, delay = 300},
        {pos = {x = k.x + 2, y = k.y + 2, z = k.z}, delay = 300},
        {pos = {x = k.x - 2, y = k.y + 2, z = k.z}, delay = 300},
        {pos = {x = k.x - 2, y = k.y, z = k.z}, delay = 300},
        {pos = {x = k.x - 2, y = k.y - 2, z = k.z}, delay = 300},
        {pos = {x = k.x, y = k.y - 2, z = k.z}, delay = 300}
    }
    local effects = {27, 28, 29, 30}
    if isPlayer(cid) then
        if getPlayerStorageValue(cid, t.blueStorage) == 1 and getPlayerStorageValue(cid, t.redFlag) == 1 and getGlobalStorageValue(t.redFlag) == 1 then
            for i = 1, 6 do
                addEvent(doSendDistanceShoot, r[i].delay, r[i].pos, k, CONST_ME_FIREWORK_YELLOW)
            end
            for i = 1, 4 do
                addEvent(doSendMagicEffect, 1000, getThingPos(cid), effects[i])
            end
            return addEvent(repeatFlagOnPlayer, 1000, cid)
        elseif getPlayerStorageValue(cid, t.redStorage) == 1 and getPlayerStorageValue(cid, t.blueFlag) == 1 and getGlobalStorageValue(t.blueFlag) == 1 then
            for i = 1, 6 do
                addEvent(doSendDistanceShoot, r[i].delay, r[i].pos, k, CONST_ME_FIREWORK_YELLOW)
            end
            for i = 1, 4 do
                addEvent(doSendMagicEffect, 1000, getThingPos(cid), effects[i])
            end
            return addEvent(repeatFlagOnPlayer, 1000, cid)
        else
            return false
        end
    else
        return false
    end
end
function onStepIn(cid, item, position, fromPosition, toPosition, lastPosition, actor)
    if isPlayer(cid) then
        if item.actionid == 6000 then
            if getPlayerStorageValue(cid, t.redStorage) == 1 then
                if getPlayerStorageValue(cid, t.blueFlag) == -1 and getGlobalStorageValue(t.blueFlag) == -1 then
                    setPlayerStorageValue(cid, t.blueFlag, 1)
                    setGlobalStorageValue(t.blueFlag, 1)
                    repeatFlagOnPlayer(cid)
                    doBroadcastMessage(getCreatureName(cid) .. " has stolen the Blue Flag!")
                else
                    doCreatureSay(cid, "The flag is not at home.", 19)
                    doTeleportThing(cid, fromPosition, false)
                end
            else
                doCreatureSay(cid, "You may only pick up the opposite team flag.", 19)
                doTeleportThing(cid, fromPosition, false)
            end
        elseif item.actionid == 6001 then
            if getPlayerStorageValue(cid, t.blueStorage) == 1 then
                if getPlayerStorageValue(cid, t.redFlag) == -1 and getGlobalStorageValue(t.redFlag) == -1 then
                    setPlayerStorageValue(cid, t.redFlag, 1)
                    setGlobalStorageValue(t.redFlag, 1)
                    repeatFlagOnPlayer(cid)
                    doBroadcastMessage(getCreatureName(cid) .. " has stolen the Red flag!")
                else
                    doCreatureSay(cid, "The flag is not at home.", 19)
                    doTeleportThing(cid, fromPosition, false)
                end
            else
                doCreatureSay(cid, "The flag is not at home.", 19)
                doTeleportThing(cid, fromPosition, false)
            end
        end
        if item.actionid == 6002 then
            if getPlayerStorageValue(cid, t.redStorage) == 1 then
                if getPlayerStorageValue(cid, t.blueFlag) == 1 and getGlobalStorageValue(t.blueFlag) == 1 then
                    setGlobalStorageValue(t.blueFlag, -1)
                    setPlayerStorageValue(cid, t.blueFlag, -1)
                    setGlobalStorageValue(t.redGoal, getGlobalStorageValue(t.redGoal)+1)
                    doBroadcastMessage("Current CTF Game Score:\nRed Team: " .. getGlobalStorageValue(t.redGoal) .. "\nBlue Team: " .. getGlobalStorageValue(t.blueGoal) .. "\nTen Scores to win!", 20)
                    doBroadcastMessage(getCreatureName(cid) .. " has scored 1 point for the Red Team!")
                else
                    doCreatureSay(cid, "You dont have the flag.", 19)
                    doTeleportThing(cid, fromPosition, false)
                end
            elseif getPlayerStorageValue(cid, t.blueStorage) == 1 then
                if getPlayerStorageValue(cid, t.redFlag) == 1 and getGlobalStorageValue(t.redFlag) == 1 then
                    setGlobalStorageValue(t.redFlag, -1)
                    setPlayerStorageValue(cid, t.redFlag, -1)
                    setGlobalStorageValue(t.blueGoal, getGlobalStorageValue(t.blueGoal)+1)
                    doBroadcastMessage("Current CTF Game Score:\nRed Team: " .. getGlobalStorageValue(t.redGoal) .. "\nBlue Team: " .. getGlobalStorageValue(t.blueGoal) .. "\nTen Scores to win!", 20)
                    doBroadcastMessage(getCreatureName(cid) .. " has scored 1 point for the Blue Team!")
                else
                    doCreatureSay(cid, "You dont have the flag.", 19)
                    doTeleportThing(cid, fromPosition, false)
                end
            end
            for _, cid in ipairs(getPlayersOnline()) do
                if getGlobalStorageValue(t.blueGoal) == 10 and getGlobalStorageValue(t.redGoal) < 10 then
                    if getPlayerStorageValue(cid, t.blueStorage) == 1 then
                        setPlayerStorageValue(cid, t.blueStorage, -1)
                        doPlayerAddItem(cid, 9020, math.random(1, 6))
                    elseif getPlayerStorageValue(cid, t.redStorage) == 1 then
                        setPlayerStorageValue(cid, t.redStorage, -1)
                    end
                    doRemoveCondition(cid, CONDITION_OUTFIT)
                    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
                    setGlobalStorageValue(t.redGoal, 0)
                    setGlobalStorageValue(t.blueGoal, 0)
                elseif getGlobalStorageValue(t.redGoal) == 10 and getGlobalStorageValue(t.blueGoal) < 10 then
                    if getPlayerStorageValue(cid, t.redStorage) == 1 then
                        setPlayerStorageValue(cid, t.redStorage, -1)
                        doPlayerAddItem(cid, 9020, math.random(1, 6))
                    elseif getPlayerStorageValue(cid, t.blueStorage) == 1 then
                        setPlayerStorageValue(cid, t.blueStorage, -1)
                    end
                    doRemoveCondition(cid, CONDITION_OUTFIT)
                    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
                    setGlobalStorageValue(t.redGoal, 0)
                    setGlobalStorageValue(t.blueGoal, 0)
                end
            end
        end
    else
        doRemoveCreature(cid)
    end
    return true
end


USING TFS 0.3.6 Crying DAMSON v8
 
sorry doublepost 1k chars per post only

Movements

Code:
local t = {
    redStorage = 15000,
    blueStorage = 15001,
    redFlag = 18000,
    blueFlag = 18001,
    redGoal = 19000,
    blueGoal = 19001
}
local function repeatFlagOnPlayer(cid)
    local k = getThingPos(cid)
    local r = {
        {pos = {x = k.x + 2, y = k.y - 2, z = k.z}, delay = 300},
        {pos = {x = k.x + 2, y = k.y + 2, z = k.z}, delay = 300},
        {pos = {x = k.x - 2, y = k.y + 2, z = k.z}, delay = 300},
        {pos = {x = k.x - 2, y = k.y, z = k.z}, delay = 300},
        {pos = {x = k.x - 2, y = k.y - 2, z = k.z}, delay = 300},
        {pos = {x = k.x, y = k.y - 2, z = k.z}, delay = 300}
    }
    local effects = {27, 28, 29, 30}
    if isPlayer(cid) then
        if getPlayerStorageValue(cid, t.blueStorage) == 1 and getPlayerStorageValue(cid, t.redFlag) == 1 and getGlobalStorageValue(t.redFlag) == 1 then
            for i = 1, 6 do
                addEvent(doSendDistanceShoot, r[i].delay, r[i].pos, k, CONST_ME_FIREWORK_YELLOW)
            end
            for i = 1, 4 do
                addEvent(doSendMagicEffect, 1000, getThingPos(cid), effects[i])
            end
            return addEvent(repeatFlagOnPlayer, 1000, cid)
        elseif getPlayerStorageValue(cid, t.redStorage) == 1 and getPlayerStorageValue(cid, t.blueFlag) == 1 and getGlobalStorageValue(t.blueFlag) == 1 then
            for i = 1, 6 do
                addEvent(doSendDistanceShoot, r[i].delay, r[i].pos, k, CONST_ME_FIREWORK_YELLOW)
            end
            for i = 1, 4 do
                addEvent(doSendMagicEffect, 1000, getThingPos(cid), effects[i])
            end
            return addEvent(repeatFlagOnPlayer, 1000, cid)
        else
            return false
        end
    else
        return false
    end
end
function onStepIn(cid, item, position, fromPosition, toPosition, lastPosition, actor)
    if isPlayer(cid) then
        if item.actionid == 6000 then
            if getPlayerStorageValue(cid, t.redStorage) == 1 then
                if getPlayerStorageValue(cid, t.blueFlag) == -1 and getGlobalStorageValue(t.blueFlag) == -1 then
                    setPlayerStorageValue(cid, t.blueFlag, 1)
                    setGlobalStorageValue(t.blueFlag, 1)
                    repeatFlagOnPlayer(cid)
                    doBroadcastMessage(getCreatureName(cid) .. " has stolen the Blue Flag!")
                else
                    doCreatureSay(cid, "The flag is not at home.", 19)
                    doTeleportThing(cid, fromPosition, false)
                end
            else
                doCreatureSay(cid, "You may only pick up the opposite team flag.", 19)
                doTeleportThing(cid, fromPosition, false)
            end
        elseif item.actionid == 6001 then
            if getPlayerStorageValue(cid, t.blueStorage) == 1 then
                if getPlayerStorageValue(cid, t.redFlag) == -1 and getGlobalStorageValue(t.redFlag) == -1 then
                    setPlayerStorageValue(cid, t.redFlag, 1)
                    setGlobalStorageValue(t.redFlag, 1)
                    repeatFlagOnPlayer(cid)
                    doBroadcastMessage(getCreatureName(cid) .. " has stolen the Red flag!")
                else
                    doCreatureSay(cid, "The flag is not at home.", 19)
                    doTeleportThing(cid, fromPosition, false)
                end
            else
                doCreatureSay(cid, "The flag is not at home.", 19)
                doTeleportThing(cid, fromPosition, false)
            end
        end
        if item.actionid == 6002 then
            if getPlayerStorageValue(cid, t.redStorage) == 1 then
                if getPlayerStorageValue(cid, t.blueFlag) == 1 and getGlobalStorageValue(t.blueFlag) == 1 then
                    setGlobalStorageValue(t.blueFlag, -1)
                    setPlayerStorageValue(cid, t.blueFlag, -1)
                    setGlobalStorageValue(t.redGoal, getGlobalStorageValue(t.redGoal)+1)
                    doBroadcastMessage("Current CTF Game Score:\nRed Team: " .. getGlobalStorageValue(t.redGoal) .. "\nBlue Team: " .. getGlobalStorageValue(t.blueGoal) .. "\nTen Scores to win!", 20)
                    doBroadcastMessage(getCreatureName(cid) .. " has scored 1 point for the Red Team!")
                else
                    doCreatureSay(cid, "You dont have the flag.", 19)
                    doTeleportThing(cid, fromPosition, false)
                end
            elseif getPlayerStorageValue(cid, t.blueStorage) == 1 then
                if getPlayerStorageValue(cid, t.redFlag) == 1 and getGlobalStorageValue(t.redFlag) == 1 then
                    setGlobalStorageValue(t.redFlag, -1)
                    setPlayerStorageValue(cid, t.redFlag, -1)
                    setGlobalStorageValue(t.blueGoal, getGlobalStorageValue(t.blueGoal)+1)
                    doBroadcastMessage("Current CTF Game Score:\nRed Team: " .. getGlobalStorageValue(t.redGoal) .. "\nBlue Team: " .. getGlobalStorageValue(t.blueGoal) .. "\nTen Scores to win!", 20)
                    doBroadcastMessage(getCreatureName(cid) .. " has scored 1 point for the Blue Team!")
                else
                    doCreatureSay(cid, "You dont have the flag.", 19)
                    doTeleportThing(cid, fromPosition, false)
                end
            end
            for _, cid in ipairs(getPlayersOnline()) do
                if getGlobalStorageValue(t.blueGoal) == 10 and getGlobalStorageValue(t.redGoal) < 10 then
                    if getPlayerStorageValue(cid, t.blueStorage) == 1 then
                        setPlayerStorageValue(cid, t.blueStorage, -1)
                        doPlayerAddItem(cid, 9020, math.random(1, 6))
                    elseif getPlayerStorageValue(cid, t.redStorage) == 1 then
                        setPlayerStorageValue(cid, t.redStorage, -1)
                    end
                    doRemoveCondition(cid, CONDITION_OUTFIT)
                    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
                    setGlobalStorageValue(t.redGoal, 0)
                    setGlobalStorageValue(t.blueGoal, 0)
                elseif getGlobalStorageValue(t.redGoal) == 10 and getGlobalStorageValue(t.blueGoal) < 10 then
                    if getPlayerStorageValue(cid, t.redStorage) == 1 then
                        setPlayerStorageValue(cid, t.redStorage, -1)
                        doPlayerAddItem(cid, 9020, math.random(1, 6))
                    elseif getPlayerStorageValue(cid, t.blueStorage) == 1 then
                        setPlayerStorageValue(cid, t.blueStorage, -1)
                    end
                    doRemoveCondition(cid, CONDITION_OUTFIT)
                    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
                    setGlobalStorageValue(t.redGoal, 0)
                    setGlobalStorageValue(t.blueGoal, 0)
                end
            end
        end
    else
        doRemoveCreature(cid)
    end
    return true
end


USING TFS 0.3.6 Crying DAMSON v8

This is not the global events script that starts the event, or talkaction that starts the event, Where are you using this from? some scripts are set to use command to join.
 
I need the one that you use in order to tell you what's going on? Not some random one in resources then I have more work to make it work with your stuff
 
lets try this.
Make sure you update the coordinates in the local t table that I tagged.
Code:
local t = {
    redPos = {x = 809, y = 1166, z = 7},
    bluePos = {x = 879, y = 1201, z = 7},
    redStorage = 15000,
    blueStorage = 15001,
    tpDestination = {x = 789, y = 1030, z = 7}, -- Where the teleporter will bring the player (middle of waiting area).
    tpSpawn = {x = 879, y = 1201, z = 7}, -- Where the teleporter will be created.
    fromPos = {x = 787, y = 1028, z = 7}, -- Top left of waiting area.
    toPos = {x = 792, y = 1033, z = 7} -- Bottom right of waiting area.
}

local conditionBlue = createConditionObject(CONDITION_OUTFIT)
    setConditionParam(conditionBlue, CONDITION_PARAM_TICKS, 1800 * 1000)
    addOutfitCondition(conditionBlue, {lookType = 130, lookHead = 87, lookBody = 87, lookLegs = 87, lookFeet = 87})
   
local conditionRed = createConditionObject(CONDITION_OUTFIT)
    setConditionParam(conditionRed, CONDITION_PARAM_TICKS, 1800 * 1000)
    addOutfitCondition(conditionRed, {lookType = 130, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94})

local function teleportThing(minutes)
    doCreateTeleport(1387, t.tpDestination, t.tpSpawn)
    local event = 0
    if minutes <= 0 then
        local tp = getTileItemById(t.tpSpawn, 1387).uid
        doRemoveItem(tp)
        for _, cid in ipairs(getPlayersOnline()) do
            if isInRange(getThingPos(cid), t.fromPos, t.toPos) then
                if math.random(1, 3) < 3 then
                    setPlayerStorageValue(cid, t.redStorage, 1)
                    doAddCondition(cid, conditionRed)
                    doTeleportThing(cid, t.redPos, true)
                else
                    setPlayerStorageValue(cid, t.blueStorage, 1)
                    doAddCondition(cid, conditionBlue)
                    doTeleportThing(cid, t.bluePos, true)
                end
            end
        end
        return true
    end
    if minutes == 1 then
        doBroadcastMessage("Capture The Flag will begin in " .. minutes .. " minute!")
    elseif minutes <= 3 then
        doBroadcastMessage("Capture The Flag will begin in " .. minutes .. " minutes!")
    else
        doBroadcastMessage("Capture The Flag will begin in " .. minutes .. " minutes!")
    end
    event = addEvent(teleportThing, 60, minutes - 1)
    return true
end
function onThink(interval, lastExecution)
    return teleportThing(math.abs(math.ceil(1)))
end
 
[01/02/2014 16:48:57] > Broadcasted message: "Capture The Flag will begin in 1 minute!".

same problem
Lol same problem with no errors? I don't think so, did you update the positions like I said? If there is no error then you did not add it correctly.
 
I changed the coordinates but can you help me with movements?

script of movements


Code:
local t = {
    redStorage = 15000,
    blueStorage = 15001,
    redFlag = 18000,
    blueFlag = 18001,
    redGoal = 19000,
    blueGoal = 19001
}
local function repeatFlagOnPlayer(cid)
    local k = getThingPos(cid)
    local r = {
        {pos = {x = k.x + 2, y = k.y - 2, z = k.z}, delay = 300},
        {pos = {x = k.x + 2, y = k.y + 2, z = k.z}, delay = 300},
        {pos = {x = k.x - 2, y = k.y + 2, z = k.z}, delay = 300},
        {pos = {x = k.x - 2, y = k.y, z = k.z}, delay = 300},
        {pos = {x = k.x - 2, y = k.y - 2, z = k.z}, delay = 300},
        {pos = {x = k.x, y = k.y - 2, z = k.z}, delay = 300}
    }
    local effects = {27, 28, 29, 30}
    if isPlayer(cid) then
        if getPlayerStorageValue(cid, t.blueStorage) == 1 and getPlayerStorageValue(cid, t.redFlag) == 1 and getGlobalStorageValue(t.redFlag) == 1 then
            for i = 1, 6 do
                addEvent(doSendDistanceShoot, r[i].delay, r[i].pos, k, CONST_ME_FIREWORK_YELLOW)
            end
            for i = 1, 4 do
                addEvent(doSendMagicEffect, 1000, getThingPos(cid), effects[i])
            end
            return addEvent(repeatFlagOnPlayer, 1000, cid)
        elseif getPlayerStorageValue(cid, t.redStorage) == 1 and getPlayerStorageValue(cid, t.blueFlag) == 1 and getGlobalStorageValue(t.blueFlag) == 1 then
            for i = 1, 6 do
                addEvent(doSendDistanceShoot, r[i].delay, r[i].pos, k, CONST_ME_FIREWORK_YELLOW)
            end
            for i = 1, 4 do
                addEvent(doSendMagicEffect, 1000, getThingPos(cid), effects[i])
            end
            return addEvent(repeatFlagOnPlayer, 1000, cid)
        else
            return false
        end
    else
        return false
    end
end
function onStepIn(cid, item, position, fromPosition, toPosition, lastPosition, actor)
    if isPlayer(cid) then
        if item.actionid == 6000 then
            if getPlayerStorageValue(cid, t.redStorage) == 1 then
                if getPlayerStorageValue(cid, t.blueFlag) == -1 and getGlobalStorageValue(t.blueFlag) == -1 then
                    setPlayerStorageValue(cid, t.blueFlag, 1)
                    setGlobalStorageValue(t.blueFlag, 1)
                    repeatFlagOnPlayer(cid)
                    doBroadcastMessage(getCreatureName(cid) .. " has stolen the Blue Flag!")
                else
                    doCreatureSay(cid, "The flag is not at home.", 19)
                    doTeleportThing(cid, fromPosition, false)
                end
            else
                doCreatureSay(cid, "You may only pick up the opposite team flag.", 19)
                doTeleportThing(cid, fromPosition, false)
            end
        elseif item.actionid == 6001 then
            if getPlayerStorageValue(cid, t.blueStorage) == 1 then
                if getPlayerStorageValue(cid, t.redFlag) == -1 and getGlobalStorageValue(t.redFlag) == -1 then
                    setPlayerStorageValue(cid, t.redFlag, 1)
                    setGlobalStorageValue(t.redFlag, 1)
                    repeatFlagOnPlayer(cid)
                    doBroadcastMessage(getCreatureName(cid) .. " has stolen the Red flag!")
                else
                    doCreatureSay(cid, "The flag is not at home.", 19)
                    doTeleportThing(cid, fromPosition, false)
                end
            else
                doCreatureSay(cid, "The flag is not at home.", 19)
                doTeleportThing(cid, fromPosition, false)
            end
        end
        if item.actionid == 6002 then
            if getPlayerStorageValue(cid, t.redStorage) == 1 then
                if getPlayerStorageValue(cid, t.blueFlag) == 1 and getGlobalStorageValue(t.blueFlag) == 1 then
                    setGlobalStorageValue(t.blueFlag, -1)
                    setPlayerStorageValue(cid, t.blueFlag, -1)
                    setGlobalStorageValue(t.redGoal, getGlobalStorageValue(t.redGoal)+1)
                    doBroadcastMessage("Current CTF Game Score:\nRed Team: " .. getGlobalStorageValue(t.redGoal) .. "\nBlue Team: " .. getGlobalStorageValue(t.blueGoal) .. "\nTen Scores to win!", 20)
                    doBroadcastMessage(getCreatureName(cid) .. " has scored 1 point for the Red Team!")
                else
                    doCreatureSay(cid, "You dont have the flag.", 19)
                    doTeleportThing(cid, fromPosition, false)
                end
            elseif getPlayerStorageValue(cid, t.blueStorage) == 1 then
                if getPlayerStorageValue(cid, t.redFlag) == 1 and getGlobalStorageValue(t.redFlag) == 1 then
                    setGlobalStorageValue(t.redFlag, -1)
                    setPlayerStorageValue(cid, t.redFlag, -1)
                    setGlobalStorageValue(t.blueGoal, getGlobalStorageValue(t.blueGoal)+1)
                    doBroadcastMessage("Current CTF Game Score:\nRed Team: " .. getGlobalStorageValue(t.redGoal) .. "\nBlue Team: " .. getGlobalStorageValue(t.blueGoal) .. "\nTen Scores to win!", 20)
                    doBroadcastMessage(getCreatureName(cid) .. " has scored 1 point for the Blue Team!")
                else
                    doCreatureSay(cid, "You dont have the flag.", 19)
                    doTeleportThing(cid, fromPosition, false)
                end
            end
            for _, cid in ipairs(getPlayersOnline()) do
                if getGlobalStorageValue(t.blueGoal) == 10 and getGlobalStorageValue(t.redGoal) < 10 then
                    if getPlayerStorageValue(cid, t.blueStorage) == 1 then
                        setPlayerStorageValue(cid, t.blueStorage, -1)
                        doPlayerAddItem(cid, 9020, math.random(1, 6))
                    elseif getPlayerStorageValue(cid, t.redStorage) == 1 then
                        setPlayerStorageValue(cid, t.redStorage, -1)
                    end
                    doRemoveCondition(cid, CONDITION_OUTFIT)
                    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
                    setGlobalStorageValue(t.redGoal, 0)
                    setGlobalStorageValue(t.blueGoal, 0)
                elseif getGlobalStorageValue(t.redGoal) == 10 and getGlobalStorageValue(t.blueGoal) < 10 then
                    if getPlayerStorageValue(cid, t.redStorage) == 1 then
                        setPlayerStorageValue(cid, t.redStorage, -1)
                        doPlayerAddItem(cid, 9020, math.random(1, 6))
                    elseif getPlayerStorageValue(cid, t.blueStorage) == 1 then
                        setPlayerStorageValue(cid, t.blueStorage, -1)
                    end
                    doRemoveCondition(cid, CONDITION_OUTFIT)
                    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
                    setGlobalStorageValue(t.redGoal, 0)
                    setGlobalStorageValue(t.blueGoal, 0)
                end
            end
        end
    else
        doRemoveCreature(cid)
    end
    return true
end

<!-- CTF -->
<movevent type="StepIn" actionid="6000-6002" event="script" value="ctf/ctf.lua"/>

where to set these action id's?
 
I changed the coordinates but can you help me with movements?

script of movements


Code:
local t = {
    redStorage = 15000,
    blueStorage = 15001,
    redFlag = 18000,
    blueFlag = 18001,
    redGoal = 19000,
    blueGoal = 19001
}
local function repeatFlagOnPlayer(cid)
    local k = getThingPos(cid)
    local r = {
        {pos = {x = k.x + 2, y = k.y - 2, z = k.z}, delay = 300},
        {pos = {x = k.x + 2, y = k.y + 2, z = k.z}, delay = 300},
        {pos = {x = k.x - 2, y = k.y + 2, z = k.z}, delay = 300},
        {pos = {x = k.x - 2, y = k.y, z = k.z}, delay = 300},
        {pos = {x = k.x - 2, y = k.y - 2, z = k.z}, delay = 300},
        {pos = {x = k.x, y = k.y - 2, z = k.z}, delay = 300}
    }
    local effects = {27, 28, 29, 30}
    if isPlayer(cid) then
        if getPlayerStorageValue(cid, t.blueStorage) == 1 and getPlayerStorageValue(cid, t.redFlag) == 1 and getGlobalStorageValue(t.redFlag) == 1 then
            for i = 1, 6 do
                addEvent(doSendDistanceShoot, r[i].delay, r[i].pos, k, CONST_ME_FIREWORK_YELLOW)
            end
            for i = 1, 4 do
                addEvent(doSendMagicEffect, 1000, getThingPos(cid), effects[i])
            end
            return addEvent(repeatFlagOnPlayer, 1000, cid)
        elseif getPlayerStorageValue(cid, t.redStorage) == 1 and getPlayerStorageValue(cid, t.blueFlag) == 1 and getGlobalStorageValue(t.blueFlag) == 1 then
            for i = 1, 6 do
                addEvent(doSendDistanceShoot, r[i].delay, r[i].pos, k, CONST_ME_FIREWORK_YELLOW)
            end
            for i = 1, 4 do
                addEvent(doSendMagicEffect, 1000, getThingPos(cid), effects[i])
            end
            return addEvent(repeatFlagOnPlayer, 1000, cid)
        else
            return false
        end
    else
        return false
    end
end
function onStepIn(cid, item, position, fromPosition, toPosition, lastPosition, actor)
    if isPlayer(cid) then
        if item.actionid == 6000 then
            if getPlayerStorageValue(cid, t.redStorage) == 1 then
                if getPlayerStorageValue(cid, t.blueFlag) == -1 and getGlobalStorageValue(t.blueFlag) == -1 then
                    setPlayerStorageValue(cid, t.blueFlag, 1)
                    setGlobalStorageValue(t.blueFlag, 1)
                    repeatFlagOnPlayer(cid)
                    doBroadcastMessage(getCreatureName(cid) .. " has stolen the Blue Flag!")
                else
                    doCreatureSay(cid, "The flag is not at home.", 19)
                    doTeleportThing(cid, fromPosition, false)
                end
            else
                doCreatureSay(cid, "You may only pick up the opposite team flag.", 19)
                doTeleportThing(cid, fromPosition, false)
            end
        elseif item.actionid == 6001 then
            if getPlayerStorageValue(cid, t.blueStorage) == 1 then
                if getPlayerStorageValue(cid, t.redFlag) == -1 and getGlobalStorageValue(t.redFlag) == -1 then
                    setPlayerStorageValue(cid, t.redFlag, 1)
                    setGlobalStorageValue(t.redFlag, 1)
                    repeatFlagOnPlayer(cid)
                    doBroadcastMessage(getCreatureName(cid) .. " has stolen the Red flag!")
                else
                    doCreatureSay(cid, "The flag is not at home.", 19)
                    doTeleportThing(cid, fromPosition, false)
                end
            else
                doCreatureSay(cid, "The flag is not at home.", 19)
                doTeleportThing(cid, fromPosition, false)
            end
        end
        if item.actionid == 6002 then
            if getPlayerStorageValue(cid, t.redStorage) == 1 then
                if getPlayerStorageValue(cid, t.blueFlag) == 1 and getGlobalStorageValue(t.blueFlag) == 1 then
                    setGlobalStorageValue(t.blueFlag, -1)
                    setPlayerStorageValue(cid, t.blueFlag, -1)
                    setGlobalStorageValue(t.redGoal, getGlobalStorageValue(t.redGoal)+1)
                    doBroadcastMessage("Current CTF Game Score:\nRed Team: " .. getGlobalStorageValue(t.redGoal) .. "\nBlue Team: " .. getGlobalStorageValue(t.blueGoal) .. "\nTen Scores to win!", 20)
                    doBroadcastMessage(getCreatureName(cid) .. " has scored 1 point for the Red Team!")
                else
                    doCreatureSay(cid, "You dont have the flag.", 19)
                    doTeleportThing(cid, fromPosition, false)
                end
            elseif getPlayerStorageValue(cid, t.blueStorage) == 1 then
                if getPlayerStorageValue(cid, t.redFlag) == 1 and getGlobalStorageValue(t.redFlag) == 1 then
                    setGlobalStorageValue(t.redFlag, -1)
                    setPlayerStorageValue(cid, t.redFlag, -1)
                    setGlobalStorageValue(t.blueGoal, getGlobalStorageValue(t.blueGoal)+1)
                    doBroadcastMessage("Current CTF Game Score:\nRed Team: " .. getGlobalStorageValue(t.redGoal) .. "\nBlue Team: " .. getGlobalStorageValue(t.blueGoal) .. "\nTen Scores to win!", 20)
                    doBroadcastMessage(getCreatureName(cid) .. " has scored 1 point for the Blue Team!")
                else
                    doCreatureSay(cid, "You dont have the flag.", 19)
                    doTeleportThing(cid, fromPosition, false)
                end
            end
            for _, cid in ipairs(getPlayersOnline()) do
                if getGlobalStorageValue(t.blueGoal) == 10 and getGlobalStorageValue(t.redGoal) < 10 then
                    if getPlayerStorageValue(cid, t.blueStorage) == 1 then
                        setPlayerStorageValue(cid, t.blueStorage, -1)
                        doPlayerAddItem(cid, 9020, math.random(1, 6))
                    elseif getPlayerStorageValue(cid, t.redStorage) == 1 then
                        setPlayerStorageValue(cid, t.redStorage, -1)
                    end
                    doRemoveCondition(cid, CONDITION_OUTFIT)
                    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
                    setGlobalStorageValue(t.redGoal, 0)
                    setGlobalStorageValue(t.blueGoal, 0)
                elseif getGlobalStorageValue(t.redGoal) == 10 and getGlobalStorageValue(t.blueGoal) < 10 then
                    if getPlayerStorageValue(cid, t.redStorage) == 1 then
                        setPlayerStorageValue(cid, t.redStorage, -1)
                        doPlayerAddItem(cid, 9020, math.random(1, 6))
                    elseif getPlayerStorageValue(cid, t.blueStorage) == 1 then
                        setPlayerStorageValue(cid, t.blueStorage, -1)
                    end
                    doRemoveCondition(cid, CONDITION_OUTFIT)
                    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
                    setGlobalStorageValue(t.redGoal, 0)
                    setGlobalStorageValue(t.blueGoal, 0)
                end
            end
        end
    else
        doRemoveCreature(cid)
    end
    return true
end

<!-- CTF -->
<movevent type="StepIn" actionid="6000-6002" event="script" value="ctf/ctf.lua"/>

where to set these action id's?
These action ids are part of map, if you're using map with the distro and copied, then it should be fine, as for teleport sorry I been busy, I will try and see why, it's weird that it wouldn't teleport, unless the destination was a spot that the server doesn't like.
 
Back
Top