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

GlobalEvent Team battle scripts - Map changing - For war servers!

Serginov

Onkonkoronkonk
Joined
Jun 28, 2008
Messages
1,321
Reaction score
18
Location
Sweden - Dalarna
Ok so here is my scripts for my team battle server I made a while ago, they are tested on tfs 0.3.6 and are fully working.
If you want this to work for tfs 0.4 I think you only need to change all(I think so):
setPlayerStorageValue to doCreatureSetStorage
getPlayerStorageValue to getCreatureStorage
getGlobalStorageValue to getStorage
setGlobalStorageValue to setStorage

Changelog:
Code:
-
Edit; You need this function for the login part to work properly, you can just edit the login part to not give skills or anything if you want. but if you want it to give skills use this function.
050-functions.lua:
Code:
function getPlayerMeleeSkill(cid)
    return {[0] = getPlayerSkillLevel(cid, SKILL_FIST), [1] = getPlayerSkillLevel(cid, SKILL_CLUB), [2] = getPlayerSkillLevel(cid, SKILL_SWORD), [3] = getPlayerSkillLevel(cid, SKILL_AXE)}
end

function doPlayerAddMeleeSkill(cid, amount)
local rate = getConfigInfo('rateSkill')
    for i = 0, 3 do
        doPlayerAddSkillTry(cid, i, math.ceil((getPlayerRequiredSkillTries(cid, i, getPlayerSkillLevel(cid, i) + 1) - getPlayerSkillTries(cid, i)) / rate))
    end
end
Globalevent changeMap.lua:
Code:
function onThink(interval, lastExecution, thinkInterval)
    local maps = {
        [1] = {mapName = "Ignitos", redTemple = {x = 1153, y = 1069, z = 6}, blueTemple = {x = 1146, y = 1120, z = 6}},
        [2] = {mapName = "Dust2", redTemple = {x = 1169, y = 1192, z = 7}, blueTemple = {x = 1107, y = 1176, z = 6}},
        [3] = {mapName = "Fridge", redTemple = {x = 1277, y = 1035, z = 3}, blueTemple = {x = 1225, y = 1035, z = 3}},
    }
    
    local teams = {
        blueName = "Blue Bangbabies",
        redName = "Red Rageboys",
        blueScore = 101,
        redScore = 102,
        bluePlayerScore = 1004,
        redPlayerScore = 1006,
    }
    
    local map = maps[getGlobalStorageValue(100)]

    if getGlobalStorageValue(100) <= 0 then
        setGlobalStorageValue(100, 1)
    elseif getGlobalStorageValue(100) >= math.max(1, #maps) then
        setGlobalStorageValue(100, 1)
    elseif getGlobalStorageValue(100) >= 1 then
        setGlobalStorageValue(100, getGlobalStorageValue(100)+1)
    end
    
    if map then
        for _, cid in ipairs(getPlayersOnline()) do
            if getPlayerStorageValue(cid, 1002) == 1 then
                doTeleportThing(cid, map.blueTemple)
                doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
            elseif getPlayerStorageValue(cid, 1003) == 1 then
                doTeleportThing(cid, map.redTemple)
                doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
            end
            if getGlobalStorageValue(teams.blueScore) > getGlobalStorageValue(teams.redScore) then
                str = "\n\nThe " .. teams.blueName .. "  won!\n\nScores:\n" .. teams.blueName .. " " ..  getGlobalStorageValue(blueScore) .. " - " ..  getGlobalStorageValue(redScore) .. " " .. teams.redName .. "."
            elseif getGlobalStorageValue(teams.redScore) > getGlobalStorageValue(teams.blueScore) then
                str = "\n\nThe " .. teams.redName .. "  won!\n\nScores:\n" .. teams.blueName .. " " ..  getGlobalStorageValue(blueScore) .. " - " ..  getGlobalStorageValue(redScore) .. " " .. teams.redName .. "."
            end
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Map has  been changed to " .. map.mapName .. "! Next map in 30 minutes!" .. str)
        end
        setGlobalStorageValue(teams.blueScore, 0)
        setGlobalStorageValue(teams.redScore, 0)
    end
return true
end
Globalevent teamScores.lua:
Code:
local blueScore = 101
local redScore = 102
local teams = {
    blueName = "Blue Bangbabies",
    redName = "Red Rageboys",
    }

function onThink(interval, lastExecution, thinkInterval)
    if getGlobalStorageValue(blueScore) > getGlobalStorageValue(redScore) then
        str = "The leading team is the " .. teams.blueName ..  "!\n\nScores:\n" .. teams.blueName .. " " ..  getGlobalStorageValue(blueScore) .. " - " ..  getGlobalStorageValue(redScore) .. " " .. teams.redName .. "."
    elseif getGlobalStorageValue(redScore) > getGlobalStorageValue(blueScore) then
        str = "The leading team is the " .. teams.redName ..  "!\n\nScores:\n" .. teams.redName .. " " ..  getGlobalStorageValue(redScore) .. " - " ..  getGlobalStorageValue(blueScore) .. " " .. teams.blueName .. "."
    elseif getGlobalStorageValue(redScore) == getGlobalStorageValue(blueScore) then
        str = "The teams is tied to the lead!\n\nScores:\n" ..  teams.redName .. " " .. getGlobalStorageValue(redScore) .. " - " ..  getGlobalStorageValue(blueScore) .. " " .. teams.blueName .. "."
    end
    doBroadcastMessage(str .. "\n\nPlayers:\n" .. teams.blueName .. " - "  .. getGlobalStorageValue(1000) .. " vs " .. getGlobalStorageValue(1001)  .. " - " .. teams.redName .. ".", MESSAGE_EVENT_ORANGE)
return true
end
Globalevent teams.lua:
Code:
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})

function onThink(interval, lastExecution, thinkInterval)
    for _, cid in ipairs(getPlayersOnline()) do    
        if getPlayerStorageValue(cid, 1002) == 1 then
            doAddCondition(cid, conditionBlue)
        elseif getPlayerStorageValue(cid, 1003) == 1 then
            doAddCondition(cid, conditionRed)
        end
    end
return true
end
Globalevent.xml:
Code:
<globalevent name="changeMap" interval="1800" event="script" value="changeMap.lua"/>
<globalevent name="teamScores" interval="80" event="script" value="teamScores.lua"/>
<globalevent name="teams" interval="1800" event="script" value="teams.lua"/>



Creaturescript teamLogin.lua (sets the team of a player and teleports to the right map):

Code:
local maps = {
        [1] = {mapName = "Ignitos", redTemple = {x = 1153, y = 1069, z = 6}, blueTemple = {x = 1146, y = 1120, z = 6}},
        [2] = {mapName = "Dust2", redTemple = {x = 1169, y = 1192, z = 7}, blueTemple = {x = 1107, y = 1176, z = 6}},
        [3] = {mapName = "Fridge", redTemple = {x = 1277, y = 1035, z = 3}, blueTemple = {x = 1225, y = 1035, z = 3}},
    }
local teams = {
    blueName = "Blue Bangbabies",
    redName = "Red Rageboys",
    blueScore = 101,
    redScore = 102,
    bluePlayerScore = 1004,
    redPlayerScore = 1006,
    }
    
local blueScore = 101
local redScore = 102

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})

function onLogin(cid)
registerCreatureEvent(cid, "fixTeam")
registerCreatureEvent(cid, "scoreDeath")
registerCreatureEvent(cid, "lookScores")
setPlayerStorageValue(cid, 1002, 0)
setPlayerStorageValue(cid, 1003, 0)
local map = maps[getGlobalStorageValue(100)]
    if map then
        if getGlobalStorageValue(1000) > getGlobalStorageValue(1001) then
            setPlayerStorageValue(cid, 1003, 1)
            doAddCondition(cid, conditionRed)
            doTeleportThing(cid, map.redTemple)
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
            setGlobalStorageValue(1001, getGlobalStorageValue(1001)+1)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You were  sent to fight for the " .. teams.redName .. "!\nYour team have scored "  .. getGlobalStorageValue(redScore) .. " kills.\nCurrent map is " ..  map.mapName .. ".")
            
        else
            setPlayerStorageValue(cid, 1002, 1)
            doAddCondition(cid, conditionBlue)
            doTeleportThing(cid, map.blueTemple)
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
            setGlobalStorageValue(1000, getGlobalStorageValue(1000)+1)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You were  sent to fight for the " .. teams.blueName .. "!\nYour team have scored "  .. getGlobalStorageValue(blueScore) .. " kills.\nCurrent map is " ..  map.mapName .. ".")
        end
    end
    if getPlayerStorageValue(cid, 10000) == 1 then
        doPlayerAddExperience(cid, -getPlayerExperience(cid) + getExperienceForLevel(130))
    elseif getPlayerStorageValue(cid, 10000) ~= 1 then
        doPlayerAddExperience(cid, -getPlayerExperience(cid) + getExperienceForLevel(100))
    end
        if isSorcerer(cid) or isDruid(cid) then
            if getPlayerStorageValue(cid, 10000) == 1 then
                setCreatureMaxHealth(cid, 795)
                setCreatureMaxMana(cid, 3695)
                for i = 1, -getPlayerMagLevel(cid)+60 do doPlayerAddMagLevel(cid, 1) end
            else
                setCreatureMaxHealth(cid, 645)
                setCreatureMaxMana(cid, 2795)
                for i = 1, -getPlayerMagLevel(cid)+50 do doPlayerAddMagLevel(cid, 1) end
            end
        elseif isPaladin(cid) then
            if getPlayerStorageValue(cid, 10000) == 1 then
                setCreatureMaxHealth(cid, 1405)
                setCreatureMaxMana(cid, 1865)
                for i = 1, -getPlayerMagLevel(cid)+16 do doPlayerAddMagLevel(cid, 1) end
                for i = 1, -getPlayerSkillLevel(cid, SKILL_DIST)+80 do addEvent(delayDist, 0.2 * 1000, cid) end
            else
                setCreatureMaxHealth(cid, 1105)
                setCreaureMaxMana(cid, 1415)
                for i = 1, -getPlayerMagLevel(cid)+14 do doPlayerAddMagLevel(cid, 1) end
                for i = 1, -getPlayerSkillLevel(cid, SKILL_DIST)+70 do addEvent(delayDist, 0.2 * 1000, cid) end
            end
        elseif isKnight(cid) then
            if getPlayerStorageValue(cid, 10000) == 1 then
                setCreatureMaxHealth(cid, 2015)
                setCreatureMaxMana(cid, 645)
                for i = 1, -getPlayerMagLevel(cid)+9 do doPlayerAddMagLevel(cid, 1) end
                for i = 1, -getPlayerMeleeSkill(cid)+75 do addEvent(delaySkill, 0.2 * 1000, cid) end
                for i = 1, -getPlayerSkillLevel(cid, SKILL_SHIELD)+75 do addEvent(delayShield, 0.2 * 1000, cid) end
            else
                setCreatureMaxHealth(cid, 1565)
                setCreatureMaxMana(cid, 495)
                for i = 1, -getPlayerMagLevel(cid)+8 do doPlayerAddMagLevel(cid, 1) end
                for i = 1, -getPlayerMeleeSkill(cid)+65 do addEvent(delaySkill, 0.2 * 1000, cid) end
                for i = 1, -getPlayerSkillLevel(cid, SKILL_SHIELD)+65 do addEvent(delayShield, 0.2 * 1000, cid) end
            end
            
            doCreatureAddHealth(cid, -getCreatureHealth(cid)+getCreatureMaxHealth(cid))
            doCreatureAddMana(cid, -getCreatureMana(cid)+getCreatureMaxMana(cid))
        end
return true
end

function delaySkill(cid)
    doPlayerAddMeleeSkill(cid, 1)
end

function delayShield(cid)
    doPlayerAddSkill(cid, SKILL_SHIELD, 1)
end

function delayDist(cid)
    doPlayerAddSkill(cid, SKILL_DIST, 1)
end


Creaturescript teamLogout.lua:

Code:
function onLogout(cid)
    if getPlayerStorageValue(cid, 1002) == 1 then
        setGlobalStorageValue(1000, getGlobalStorageValue(1000)-1)
    elseif getPlayerStorageValue(cid, 1003) == 1 then
        setGlobalStorageValue(1001, getGlobalStorageValue(1001)-1)
        setPlayerStorageValue(cid, 1003, -1)
    end
return true
end


Creaturescript fixTeams.lua:

Code:
local maps = {
        [1] = {mapName = "Ignitos", redTemple = {x = 1153, y = 1069, z = 6}, blueTemple = {x = 1146, y = 1120, z = 6}},
        [2] = {mapName = "Dust2", redTemple = {x = 1169, y = 1192, z = 7}, blueTemple = {x = 1107, y = 1176, z = 6}},
        [3] = {mapName = "Fridge", redTemple = {x = 1277, y = 1035, z = 3}, blueTemple = {x = 1225, y = 1035, z = 3}},
    }
local teams = {
    blueName = "Blue Bangbabies",
    redName = "Red Rageboys",
    blueScore = 101,
    redScore = 102,
    bluePlayerScore = 1004,
    bluePlayerDScore = 1005,
    redPlayerScore = 1006,
    redPlayerDScore = 1007,
    }

function onStatsChange(cid, attacker, type, combat, value)
local map = maps[getGlobalStorageValue(100)]
local expGain = (getPlayerLevel(cid) + 50)*0.01 * 50 *  (getPlayerLevel(cid) * getPlayerLevel(cid)) - (5 * getPlayerLevel(cid) +  8)
    if type == 1 then
        if getCreatureHealth(cid) <= value then
            if isPlayer(cid) and isCreature(attacker) then
                if getPlayerStorageValue(cid, 1003) == 1 then
                    local corpse = doCreateItem(3058, 1, getPlayerPosition(cid))
                    doItemSetAttribute(corpse, "description", "You  recognize " .. getCreatureName(cid) .. "[" .. teams.redName .. ", level "  .. getPlayerLevel(cid) .. "]. He was killed by "..(isMonster(attacker)  and "a "..string.lower(getCreatureName(attacker)) or  isCreature(attacker) and getCreatureName(attacker) or "a field  item")..".")
                    doTeleportThing(cid, map.redTemple, true)
                    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You got pwned by the " .. teams.blueName .. "!")
                    doPlayerSendTextMessage(attacker, MESSAGE_EVENT_ADVANCE, "You pwned one of the " .. teams.redName .. "!")
                    setGlobalStorageValue(teams.blueScore, getGlobalStorageValue(teams.blueScore)+1)
                    setPlayerStorageValue(attacker,  teams.bluePlayerScore, getPlayerStorageValue(attacker,  teams.bluePlayerScore)+1)
                    setPlayerStorageValue(cid, teams.bluePlayerDScore, getPlayerStorageValue(cid, teams.bluePlayerDScore)+1)
                    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_STUN)
                    doCreatureAddHealth(cid, getCreatureMaxHealth(cid), true)
                    doCreatureAddMana(cid, getCreatureMaxMana(cid), true)
                    doPlayerAddExperience(attacker, expGain)
                    doPlayerAddExperience(cid, -expGain)
                    doSendAnimatedText(getPlayerPosition(attacker), expGain, TEXTCOLOR_WHITE)
                elseif getPlayerStorageValue(cid, 1002) == 1 then
                    local corpse = doCreateItem(3058, 1, getPlayerPosition(cid))
                    doItemSetAttribute(corpse, "description", "You  recognize " .. getCreatureName(cid) .. "[" .. teams.blueName .. ", level  " .. getPlayerLevel(cid) .. "]. He was killed by  "..(isMonster(attacker) and "a  "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and  getCreatureName(attacker) or "a field item")..".")
                    doTeleportThing(cid, map.blueTemple, true)
                    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You got pwned by the " .. teams.redName .. "!")
                    doPlayerSendTextMessage(attacker, MESSAGE_EVENT_ADVANCE, "You pwned one of the " .. teams.blueName .. "!")
                    setGlobalStorageValue(teams.redScore, getGlobalStorageValue(teams.redScore)+1)
                    setPlayerStorageValue(attacker,  teams.redPlayerScore, getPlayerStorageValue(attacker,  teams.redPlayerScore)+1)
                    setPlayerStorageValue(cid, teams.redPlayerDScore, getPlayerStorageValue(cid, teams.redPlayerDScore)+1)
                    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_STUN)
                    doCreatureAddHealth(cid, getCreatureMaxHealth(cid), true)
                    doCreatureAddMana(cid, getCreatureMaxMana(cid), true)
                    doPlayerAddExperience(attacker, expGain)
                    doPlayerAddExperience(cid, -expGain)
                    doSendAnimatedText(getPlayerPosition(attacker), expGain, TEXTCOLOR_WHITE)
                end
            end
        return false
        end
    end
return true
end
Creaturescript combat.lua
Code:
function onCombat(cid, target)
    if isPlayer(cid) and isPlayer(target) then
        if getPlayerStorageValue(cid, 1003) == 1 and getPlayerStorageValue(target, 1003) == 1 then
            return doPlayerSendCancel(cid, "You may not attack your teammates.") and false
        elseif getPlayerStorageValue(cid, 1002) == 1 and getPlayerStorageValue(target, 1002) == 1 then
            return doPlayerSendCancel(cid, "You may not attack your teammates.") and false
        end
    end
    return true
end
Creaturescript LookScores.lua:
Code:
local teams = {
    blueName = "Blue Bangbabies",
    redName = "Red Rageboys",
    blueScore = 101,
    redScore = 102,
    bluePlayerScore = 1004,
    redPlayerScore = 1006,
    bluePlayerDScore = 1005,
    redPlayerDScore = 1007,
    }

function onLook(cid, thing, position, lookDistance)
    if isPlayer(thing.uid) then
        if getPlayerStorageValue(thing.uid, 1002) == 1 then
            doPlayerSetSpecialDescription(thing.uid, ".\nPwned " ..  getPlayerStorageValue(thing.uid, teams.bluePlayerScore) .. " " ..  teams.redName .. ".\nPwned " .. getPlayerStorageValue(thing.uid,  teams.bluePlayerDScore) .. " times by the " .. teams.redName .. "")
        elseif getPlayerStorageValue(thing.uid, 1003) == 1 then
            doPlayerSetSpecialDescription(thing.uid, ".\nPwned " ..  getPlayerStorageValue(thing.uid, teams.redPlayerScore) .. " " ..  teams.blueName .. ".\nPwned " .. getPlayerStorageValue(thing.uid,  teams.redPlayerDScore) .. " times by the " .. teams.blueName .. "")
        end
    end
return true
end
Creaturescripts.xml:
Code:
    <event type="login" name="teamLogin" event="script" value="teamLogin.lua"/>
    <event type="logout" name="teamLogout" event="script" value="teamLogout.lua"/>
    <event type="combat" name="teamCombat" event="script" value="combat.lua"/>
    <event type="statschange" name="fixTeam" event="script" value="fixTeam.lua"/>
    <event type="look" name="lookScores" event="script" value="lookScores.lua"/>
Just set the interval between the mapchanges in globalevents.xml. 1800 = 30 min in tfs 0.3.6
 
Last edited:
Great release, I was working on a map change too, havnt tested it yet haha.
 
as I can't open a server on my computer(very fawking weird! Something's wrong though). Can someone test this for me?
replace teamLogin.lua in creaturescripts with this(added so almost everything is configurable HEHE):
Code:
local maps = {
        [1] = {mapName = "Ignitos", redTemple = {x = 1153, y = 1069, z = 6}, blueTemple = {x = 1146, y = 1120, z = 6}},
        [2] = {mapName = "Dust2", redTemple = {x = 1169, y = 1192, z = 7}, blueTemple = {x = 1107, y = 1176, z = 6}},
        [3] = {mapName = "Fridge", redTemple = {x = 1277, y = 1035, z = 3}, blueTemple = {x = 1225, y = 1035, z = 3}},
    }

local config = {
    vipKnightMeleeSkill = 75,
    vipKnightShieldSkill = 75,
    vipKnightMagicLevel = 9,
    
    noVipknightMeleeskill = 65,
    noVipknightShieldSkill = 65,
    noVipknightMagicLevel = 8,
    
    vipPaladinDistSkill = 80,
    vipPaladinShieldSkill = 60,
    vipPaladinMagicLevel = 17,
    
    noVipPaladinDistSkill = 70,
    noVipPaladinShieldSkill = 50,
    noVipPaladinMagicLevel = 14,
    
    vipSorcDruidMagicLevel = 60,
    noVipsorcDruidMagicLevel = 50,
    
    vipStorage = 10000,
    vipLevel = 130,
    
    noVipLevel = 100,
    
    paladinHp = (getPlayerLevel(cid) - 8) * 10 + 185
    paladinMana = (getPlayerLevel(cid) - 8) * 15 + 35
    
    sorcDruidHp = (getPlayerLevel(cid) - 8) * 5 + 185
    sorcDruidMana = (getPlayerLevel(cid) - 8) * 30 + 35
    
    knightHp = (getPlayerLevel(cid) - 8) * 15 + 185
    knightMana = getPlayerLevel(cid) * 5
    }

local teams = {
    blueName = "Blue Bangbabies",
    redName = "Red Rageboys",
    blueScore = 101,
    redScore = 102,
    bluePlayerScore = 1004,
    bluePlayerDScore = 1005,
    redPlayerScore = 1006,
    redPlayerDScore = 1007,
    }
    
local blueScore = 101
local redScore = 102

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})

function onLogin(cid)
setPlayerStorageValue(cid, 1002, 0)
setPlayerStorageValue(cid, 1003, 0)
local map = maps[getGlobalStorageValue(100)]
    if map then
        if getGlobalStorageValue(1000) > getGlobalStorageValue(1001) then
            setPlayerStorageValue(cid, 1003, 1)
            doAddCondition(cid, conditionRed)
            doTeleportThing(cid, map.redTemple)
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
            setGlobalStorageValue(1001, getGlobalStorageValue(1001)+1)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You were sent to fight for the " .. teams.redName .. "!\nYour team have scored " .. getGlobalStorageValue(redScore) .. " kills.\nCurrent map is " .. map.mapName .. ".")
            
        else
            setPlayerStorageValue(cid, 1002, 1)
            doAddCondition(cid, conditionBlue)
            doTeleportThing(cid, map.blueTemple)
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
            setGlobalStorageValue(1000, getGlobalStorageValue(1000)+1)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You were sent to fight for the " .. teams.blueName .. "!\nYour team have scored " .. getGlobalStorageValue(blueScore) .. " kills.\nCurrent map is " .. map.mapName .. ".")
        end
    end
    if getPlayerStorageValue(cid, config.vipStorage) == 1 then
        doPlayerAddExperience(cid, -getPlayerExperience(cid) + getExperienceForLevel(130))
    elseif getPlayerStorageValue(cid, config.vipStorage) ~= 1 then
        doPlayerAddExperience(cid, -getPlayerExperience(cid) + getExperienceForLevel(100))
    end
        if isSorcerer(cid) or isDruid(cid) then
            if getPlayerStorageValue(cid, config.vipStorage) == 1 then
                setCreatureMaxHealth(cid, config.sorcDruidHp)
                setCreatureMaxMana(cid, config.sorcDruidMana)
                for i = 1, -getPlayerMagLevel(cid)+config.vipSorcDruidMagicLevel do doPlayerAddMagLevel(cid, 1) end
            else
                setCreatureMaxHealth(cid, config.sorcDruidHp)
                setCreatureMaxMana(cid, config.sorcDruidMana)
                for i = 1, -getPlayerMagLevel(cid)+config.noVipSorcDruidMagicLevel do doPlayerAddMagLevel(cid, 1) end
            end
        elseif isPaladin(cid) then
            if getPlayerStorageValue(cid, config.vipStorage) == 1 then
                setCreatureMaxHealth(cid, config.paladinHp)
                setCreatureMaxMana(cid, config.paladinMana)
                for i = 1, -getPlayerMagLevel(cid)+config.vipPaladinMagicLevel do doPlayerAddMagLevel(cid, 1) end
                for i = 1, -getPlayerSkillLevel(cid, SKILL_DIST)+config.vipPaladinDistSkill do addEvent(delayDist, 0.2 * 1000, cid) end
                for i = 1, -getPlayerSkillLevel(cid, SKILL_SHIELD)+config.vipPaladinShieldSkill do addEvent(delayShield, 0.2 * 1000, cid) end
            else
                setCreatureMaxHealth(cid, config.paladinHp)
                setCreatureMaxMana(cid, config.paladinMana)
                for i = 1, -getPlayerMagLevel(cid)+config.noVipPaladinMagicLevel do doPlayerAddMagLevel(cid, 1) end
                for i = 1, -getPlayerSkillLevel(cid, SKILL_DIST)+config.noVipPaladinDistSkill do addEvent(delayDist, 0.2 * 1000, cid) end
                for i = 1, -getPlayerSkillLevel(cid, SKILL_SHIELD)+config.noVipPaladinShieldSkill do addEvent(delayShield, 0.2 * 1000, cid) end
            end
        elseif isKnight(cid) then
            if getPlayerStorageValue(cid, config.vipStorage) == 1 then
                setCreatureMaxHealth(cid, config.knightHp)
                setCreatureMaxMana(cid, config.knightMana)
                for i = 1, -getPlayerMagLevel(cid)+config.vipKnightMagicLevel do doPlayerAddMagLevel(cid, 1) end
                for i = 1, -getPlayerMeleeSkill(cid)+config.vipKnightMeleeSkill do addEvent(delaySkill, 0.2 * 1000, cid) end
                for i = 1, -getPlayerSkillLevel(cid, SKILL_SHIELD)+config.vipKnightShieldSkill do addEvent(delayShield, 0.2 * 1000, cid) end
            else
                setCreatureMaxHealth(cid, config.knightHp)
                setCreatureMaxMana(cid, config.knightMana)
                for i = 1, -getPlayerMagLevel(cid)+config.noVipKnightMagicLevel do doPlayerAddMagLevel(cid, 1) end
                for i = 1, -getPlayerMeleeSkill(cid)+config.noVipknightMeleeSkill do addEvent(delaySkill, 0.2 * 1000, cid) end
                for i = 1, -getPlayerSkillLevel(cid, SKILL_SHIELD)+config.noVipknightShieldSkill do addEvent(delayShield, 0.2 * 1000, cid) end
            end
            
            doCreatureAddHealth(cid, -getCreatureHealth(cid)+getCreatureMaxHealth(cid))
            doCreatureAddMana(cid, -getCreatureMana(cid)+getCreatureMaxMana(cid))
        end
return true
end

function delaySkill(cid)
    doPlayerAddMeleeSkill(cid, 1)
end

function delayShield(cid)
    doPlayerAddSkill(cid, SKILL_SHIELD, 1)
end

function delayDist(cid)
    doPlayerAddSkill(cid, SKILL_DIST, 1)
end
 
Ok so here is my scripts for my team battle server I made a while ago, they are tested on tfs 0.3.6 and are fully working.
If you want this to work for tfs 0.4 I think you only need to change all:
setPlayerStorageValue to doCreatureSetStorage
getPlayerStorageValue to getCreatureStorage

Changelog:
Code:
-

Edit; You need this function for the login part to work properly, you can just edit the login part to not give skills or anything if you want. but if you want it to give skills use this function.
050-functions.lua:
Code:
function getPlayerMeleeSkill(cid)
    return {[0] = getPlayerSkillLevel(cid, SKILL_FIST), [1] = getPlayerSkillLevel(cid, SKILL_CLUB), [2] = getPlayerSkillLevel(cid, SKILL_SWORD), [3] = getPlayerSkillLevel(cid, SKILL_AXE)}
end

function doPlayerAddMeleeSkill(cid, amount)
local rate = getConfigInfo('rateSkill')
    for i = 0, 3 do
        doPlayerAddSkillTry(cid, i, math.ceil((getPlayerRequiredSkillTries(cid, i, getPlayerSkillLevel(cid, i) + 1) - getPlayerSkillTries(cid, i)) / rate))
    end
end
Globalevent changeMap.lua:
Code:
function onThink(interval, lastExecution, thinkInterval)
    local maps = {
        [1] = {mapName = "Ignitos", redTemple = {x = 1153, y = 1069, z = 6}, blueTemple = {x = 1146, y = 1120, z = 6}},
        [2] = {mapName = "Dust2", redTemple = {x = 1169, y = 1192, z = 7}, blueTemple = {x = 1107, y = 1176, z = 6}},
        [3] = {mapName = "Fridge", redTemple = {x = 1277, y = 1035, z = 3}, blueTemple = {x = 1225, y = 1035, z = 3}},
    }
    
    local teams = {
        blueName = "Blue Bangbabies",
        redName = "Red Rageboys",
        blueScore = 101,
        redScore = 102,
        bluePlayerScore = 1004,
        redPlayerScore = 1006,
    }
    
    local map = maps[getGlobalStorageValue(100)]

    if getGlobalStorageValue(100) <= 0 then
        setGlobalStorageValue(100, 1)
    elseif getGlobalStorageValue(100) >= math.max(1, #maps) then
        setGlobalStorageValue(100, 1)
    elseif getGlobalStorageValue(100) >= 1 then
        setGlobalStorageValue(100, getGlobalStorageValue(100)+1)
    end
    
    if map then
        for _, cid in ipairs(getPlayersOnline()) do
            if getPlayerStorageValue(cid, 1002) == 1 then
                doTeleportThing(cid, map.blueTemple)
                doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
            elseif getPlayerStorageValue(cid, 1003) == 1 then
                doTeleportThing(cid, map.redTemple)
                doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
            end
            if getGlobalStorageValue(teams.blueScore) > getGlobalStorageValue(teams.redScore) then
                str = "\n\nThe " .. teams.blueName .. "  won!\n\nScores:\n" .. teams.blueName .. " " ..  getGlobalStorageValue(blueScore) .. " - " ..  getGlobalStorageValue(redScore) .. " " .. teams.redName .. "."
            elseif getGlobalStorageValue(teams.redScore) > getGlobalStorageValue(teams.blueScore) then
                str = "\n\nThe " .. teams.redName .. "  won!\n\nScores:\n" .. teams.blueName .. " " ..  getGlobalStorageValue(blueScore) .. " - " ..  getGlobalStorageValue(redScore) .. " " .. teams.redName .. "."
            end
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Map has  been changed to " .. map.mapName .. "! Next map in 30 minutes!" .. str)
        end
        setGlobalStorageValue(teams.blueScore, 0)
        setGlobalStorageValue(teams.redScore, 0)
    end
return true
end
Globalevent teamScores.lua:
Code:
local blueScore = 101
local redScore = 102
local teams = {
    blueName = "Blue Bangbabies",
    redName = "Red Rageboys",
    }

function onThink(interval, lastExecution, thinkInterval)
    if getGlobalStorageValue(blueScore) > getGlobalStorageValue(redScore) then
        str = "The leading team is the " .. teams.blueName ..  "!\n\nScores:\n" .. teams.blueName .. " " ..  getGlobalStorageValue(blueScore) .. " - " ..  getGlobalStorageValue(redScore) .. " " .. teams.redName .. "."
    elseif getGlobalStorageValue(redScore) > getGlobalStorageValue(blueScore) then
        str = "The leading team is the " .. teams.redName ..  "!\n\nScores:\n" .. teams.redName .. " " ..  getGlobalStorageValue(redScore) .. " - " ..  getGlobalStorageValue(blueScore) .. " " .. teams.blueName .. "."
    elseif getGlobalStorageValue(redScore) == getGlobalStorageValue(blueScore) then
        str = "The teams is tied to the lead!\n\nScores:\n" ..  teams.redName .. " " .. getGlobalStorageValue(redScore) .. " - " ..  getGlobalStorageValue(blueScore) .. " " .. teams.blueName .. "."
    end
    doBroadcastMessage(str .. "\n\nPlayers:\n" .. teams.blueName .. " - "  .. getGlobalStorageValue(1000) .. " vs " .. getGlobalStorageValue(1001)  .. " - " .. teams.redName .. ".", MESSAGE_EVENT_ORANGE)
return true
end
Globalevent teams.lua:
Code:
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})

function onThink(interval, lastExecution, thinkInterval)
    for _, cid in ipairs(getPlayersOnline()) do    
        if getPlayerStorageValue(cid, 1002) == 1 then
            doAddCondition(cid, conditionBlue)
        elseif getPlayerStorageValue(cid, 1003) == 1 then
            doAddCondition(cid, conditionRed)
        end
    end
return true
end
Globalevent.xml:
Code:
<globalevent name="changeMap" interval="1800" event="script" value="changeMap.lua"/>
<globalevent name="teamScores" interval="80" event="script" value="teamScores.lua"/>
<globalevent name="teams" interval="1800" event="script" value="teams.lua"/>



Creaturescript teamLogin.lua (sets the team of a player and teleports to the right map):

Code:
local maps = {
        [1] = {mapName = "Ignitos", redTemple = {x = 1153, y = 1069, z = 6}, blueTemple = {x = 1146, y = 1120, z = 6}},
        [2] = {mapName = "Dust2", redTemple = {x = 1169, y = 1192, z = 7}, blueTemple = {x = 1107, y = 1176, z = 6}},
        [3] = {mapName = "Fridge", redTemple = {x = 1277, y = 1035, z = 3}, blueTemple = {x = 1225, y = 1035, z = 3}},
    }
local teams = {
    blueName = "Blue Bangbabies",
    redName = "Red Rageboys",
    blueScore = 101,
    redScore = 102,
    bluePlayerScore = 1004,
    redPlayerScore = 1006,
    }
    
local blueScore = 101
local redScore = 102

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})

function onLogin(cid)
setPlayerStorageValue(cid, 1002, 0)
setPlayerStorageValue(cid, 1003, 0)
local map = maps[getGlobalStorageValue(100)]
    if map then
        if getGlobalStorageValue(1000) > getGlobalStorageValue(1001) then
            setPlayerStorageValue(cid, 1003, 1)
            doAddCondition(cid, conditionRed)
            doTeleportThing(cid, map.redTemple)
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
            setGlobalStorageValue(1001, getGlobalStorageValue(1001)+1)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You were  sent to fight for the " .. teams.redName .. "!\nYour team have scored "  .. getGlobalStorageValue(redScore) .. " kills.\nCurrent map is " ..  map.mapName .. ".")
            
        else
            setPlayerStorageValue(cid, 1002, 1)
            doAddCondition(cid, conditionBlue)
            doTeleportThing(cid, map.blueTemple)
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
            setGlobalStorageValue(1000, getGlobalStorageValue(1000)+1)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You were  sent to fight for the " .. teams.blueName .. "!\nYour team have scored "  .. getGlobalStorageValue(blueScore) .. " kills.\nCurrent map is " ..  map.mapName .. ".")
        end
    end
    if getPlayerStorageValue(cid, 10000) == 1 then
        doPlayerAddExperience(cid, -getPlayerExperience(cid) + getExperienceForLevel(130))
    elseif getPlayerStorageValue(cid, 10000) ~= 1 then
        doPlayerAddExperience(cid, -getPlayerExperience(cid) + getExperienceForLevel(100))
    end
        if isSorcerer(cid) or isDruid(cid) then
            if getPlayerStorageValue(cid, 10000) == 1 then
                setCreatureMaxHealth(cid, 795)
                setCreatureMaxMana(cid, 3695)
                for i = 1, -getPlayerMagLevel(cid)+60 do doPlayerAddMagLevel(cid, 1) end
            else
                setCreatureMaxHealth(cid, 645)
                setCreatureMaxMana(cid, 2795)
                for i = 1, -getPlayerMagLevel(cid)+50 do doPlayerAddMagLevel(cid, 1) end
            end
        elseif isPaladin(cid) then
            if getPlayerStorageValue(cid, 10000) == 1 then
                setCreatureMaxHealth(cid, 1405)
                setCreatureMaxMana(cid, 1865)
                for i = 1, -getPlayerMagLevel(cid)+16 do doPlayerAddMagLevel(cid, 1) end
                for i = 1, -getPlayerSkillLevel(cid, SKILL_DIST)+80 do addEvent(delayDist, 0.2 * 1000, cid) end
            else
                setCreatureMaxHealth(cid, 1105)
                setCreaureMaxMana(cid, 1415)
                for i = 1, -getPlayerMagLevel(cid)+14 do doPlayerAddMagLevel(cid, 1) end
                for i = 1, -getPlayerSkillLevel(cid, SKILL_DIST)+70 do addEvent(delayDist, 0.2 * 1000, cid) end
            end
        elseif isKnight(cid) then
            if getPlayerStorageValue(cid, 10000) == 1 then
                setCreatureMaxHealth(cid, 2015)
                setCreatureMaxMana(cid, 645)
                for i = 1, -getPlayerMagLevel(cid)+9 do doPlayerAddMagLevel(cid, 1) end
                for i = 1, -getPlayerMeleeSkill(cid)+75 do addEvent(delaySkill, 0.2 * 1000, cid) end
                for i = 1, -getPlayerSkillLevel(cid, SKILL_SHIELD)+75 do addEvent(delayShield, 0.2 * 1000, cid) end
            else
                setCreatureMaxHealth(cid, 1565)
                setCreatureMaxMana(cid, 495)
                for i = 1, -getPlayerMagLevel(cid)+8 do doPlayerAddMagLevel(cid, 1) end
                for i = 1, -getPlayerMeleeSkill(cid)+65 do addEvent(delaySkill, 0.2 * 1000, cid) end
                for i = 1, -getPlayerSkillLevel(cid, SKILL_SHIELD)+65 do addEvent(delayShield, 0.2 * 1000, cid) end
            end
            
            doCreatureAddHealth(cid, -getCreatureHealth(cid)+getCreatureMaxHealth(cid))
            doCreatureAddMana(cid, -getCreatureMana(cid)+getCreatureMaxMana(cid))
        end
return true
end

function delaySkill(cid)
    doPlayerAddMeleeSkill(cid, 1)
end

function delayShield(cid)
    doPlayerAddSkill(cid, SKILL_SHIELD, 1)
end

function delayDist(cid)
    doPlayerAddSkill(cid, SKILL_DIST, 1)
end


Creaturescript teamLogout.lua:

Code:
function onLogout(cid)
    if getPlayerStorageValue(cid, 1002) == 1 then
        setGlobalStorageValue(1000, getGlobalStorageValue(1000)-1)
    elseif getPlayerStorageValue(cid, 1003) == 1 then
        setGlobalStorageValue(1001, getGlobalStorageValue(1001)-1)
        setPlayerStorageValue(cid, 1003, -1)
    end
return true
end


Creaturescript fixTeams.lua:

Code:
local maps = {
        [1] = {mapName = "Ignitos", redTemple = {x = 1153, y = 1069, z = 6}, blueTemple = {x = 1146, y = 1120, z = 6}},
        [2] = {mapName = "Dust2", redTemple = {x = 1169, y = 1192, z = 7}, blueTemple = {x = 1107, y = 1176, z = 6}},
        [3] = {mapName = "Fridge", redTemple = {x = 1277, y = 1035, z = 3}, blueTemple = {x = 1225, y = 1035, z = 3}},
    }
local teams = {
    blueName = "Blue Bangbabies",
    redName = "Red Rageboys",
    blueScore = 101,
    redScore = 102,
    bluePlayerScore = 1004,
    bluePlayerDScore = 1005,
    redPlayerScore = 1006,
    redPlayerDScore = 1007,
    }

function onStatsChange(cid, attacker, type, combat, value)
local map = maps[getGlobalStorageValue(100)]
local expGain = (getPlayerLevel(cid) + 50)*0.01 * 50 *  (getPlayerLevel(cid) * getPlayerLevel(cid)) - (5 * getPlayerLevel(cid) +  8)
    if type == 1 then
        if getCreatureHealth(cid) <= value then
            if isPlayer(cid) and isCreature(attacker) then
                if getPlayerStorageValue(cid, 1003) == 1 then
                    local corpse = doCreateItem(3058, 1, getPlayerPosition(cid))
                    doItemSetAttribute(corpse, "description", "You  recognize " .. getCreatureName(cid) .. "[" .. teams.redName .. ", level "  .. getPlayerLevel(cid) .. "]. He was killed by "..(isMonster(attacker)  and "a "..string.lower(getCreatureName(attacker)) or  isCreature(attacker) and getCreatureName(attacker) or "a field  item")..".")
                    doTeleportThing(cid, map.redTemple, true)
                    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You got pwned by the " .. teams.blueName .. "!")
                    doPlayerSendTextMessage(attacker, MESSAGE_EVENT_ADVANCE, "You pwned one of the " .. teams.redName .. "!")
                    setGlobalStorageValue(teams.blueScore, getGlobalStorageValue(teams.blueScore)+1)
                    setPlayerStorageValue(attacker,  teams.bluePlayerScore, getPlayerStorageValue(attacker,  teams.bluePlayerScore)+1)
                    setPlayerStorageValue(cid, teams.bluePlayerDScore, getPlayerStorageValue(cid, teams.bluePlayerDScore)+1)
                    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_STUN)
                    doCreatureAddHealth(cid, getCreatureMaxHealth(cid), true)
                    doCreatureAddMana(cid, getCreatureMaxMana(cid), true)
                    doPlayerAddExperience(attacker, expGain)
                    doPlayerAddExperience(cid, -expGain)
                    doSendAnimatedText(getPlayerPosition(attacker), expGain, TEXTCOLOR_WHITE)
                elseif getPlayerStorageValue(cid, 1002) == 1 then
                    local corpse = doCreateItem(3058, 1, getPlayerPosition(cid))
                    doItemSetAttribute(corpse, "description", "You  recognize " .. getCreatureName(cid) .. "[" .. teams.blueName .. ", level  " .. getPlayerLevel(cid) .. "]. He was killed by  "..(isMonster(attacker) and "a  "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and  getCreatureName(attacker) or "a field item")..".")
                    doTeleportThing(cid, map.blueTemple, true)
                    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You got pwned by the " .. teams.redName .. "!")
                    doPlayerSendTextMessage(attacker, MESSAGE_EVENT_ADVANCE, "You pwned one of the " .. teams.blueName .. "!")
                    setGlobalStorageValue(teams.redScore, getGlobalStorageValue(teams.redScore)+1)
                    setPlayerStorageValue(attacker,  teams.redPlayerScore, getPlayerStorageValue(attacker,  teams.redPlayerScore)+1)
                    setPlayerStorageValue(cid, teams.redPlayerDScore, getPlayerStorageValue(cid, teams.redPlayerDScore)+1)
                    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_STUN)
                    doCreatureAddHealth(cid, getCreatureMaxHealth(cid), true)
                    doCreatureAddMana(cid, getCreatureMaxMana(cid), true)
                    doPlayerAddExperience(attacker, expGain)
                    doPlayerAddExperience(cid, -expGain)
                    doSendAnimatedText(getPlayerPosition(attacker), expGain, TEXTCOLOR_WHITE)
                end
            end
        return false
        end
    end
return true
end
Creaturescript combat.lua
Code:
function onCombat(cid, target)
    if isPlayer(cid) and isPlayer(target) then
        if getPlayerStorageValue(cid, 1003) == 1 and getPlayerStorageValue(target, 1003) == 1 then
            return doPlayerSendCancel(cid, "You may not attack your teammates.") and false
        elseif getPlayerStorageValue(cid, 1002) == 1 and getPlayerStorageValue(target, 1002) == 1 then
            return doPlayerSendCancel(cid, "You may not attack your teammates.") and false
        end
    end
    return true
end
Creaturescript LookScores.lua:
Code:
local teams = {
    blueName = "Blue Bangbabies",
    redName = "Red Rageboys",
    blueScore = 101,
    redScore = 102,
    bluePlayerScore = 1004,
    redPlayerScore = 1006,
    }

function onLook(cid, thing, position, lookDistance)
    if isPlayer(thing.uid) then
        if getPlayerStorageValue(thing.uid, 1002) == 1 then
            doPlayerSetSpecialDescription(thing.uid, ".\nPwned " ..  getPlayerStorageValue(thing.uid, teams.bluePlayerScore) .. " " ..  teams.redName .. ".\nPwned " .. getPlayerStorageValue(thing.uid,  teams.bluePlayerDScore) .. " times by the " .. teams.redName .. "")
        elseif getPlayerStorageValue(thing.uid, 1003) == 1 then
            doPlayerSetSpecialDescription(thing.uid, ".\nPwned " ..  getPlayerStorageValue(thing.uid, teams.redPlayerScore) .. " " ..  teams.blueName .. ".\nPwned " .. getPlayerStorageValue(thing.uid,  teams.redPlayerDScore) .. " times by the " .. teams.blueName .. "")
        end
    end
return true
end
Creaturescripts.xml:
Code:
    <event type="login" name="teamLogin" event="script" value="teamLogin.lua"/>
    <event type="logout" name="teamLogout" event="script" value="teamLogout.lua"/>
    <event type="combat" name="teamCombat" event="script" value="combat.lua"/>
    <event type="statschange" name="fixTeam" event="script" value="fixTeam.lua"/>
    <event type="look" name="lookScores" event="script" value="lookScores.lua"/>
Just set the interval between the mapchanges in globalevents.xml. 1800 = 30 min in tfs 0.3.6

Excuse me Slaktaren, do you remember me? You helped me with this, I am actually using 0.4 haha so do i need to change setPlayerStorageValue to doCreatureSetStorage
getPlayerStorageValue to getCreatureStorage
in all the files? :p
 
I think so, I'm not sure though ;p
and maybe
setGlobalStorageValue to setStorage
getGlobalStorageValue to getStorage
 
doesnt work for 0,4 or atleast not for me, the logging on part is messing up. Let's say that the current map is 2, players who logg in gets to town 3.
 
That shouldn't make any difference.. Test recopy the whole thing, I checked everything again! You should login at the current map.
 
Temporary solution for people who are having that problem (players not logging in in the current town but the next).
I cba to look through the scripts so here's a temporary solution, I don't know if it works 100% but when you login you will get to the current town.
Just do like this, in teamLogin.lua, change the ORDER of the towns.
Let's say you have it like this in changeMap.lua
Lua:
    local maps = {
        [1] = {mapName = "Ignitos", redTemple = {x = 1153, y = 1069, z = 6}, blueTemple = {x = 1146, y = 1120, z = 6}},
        [2] = {mapName = "Dust2", redTemple = {x = 1169, y = 1192, z = 7}, blueTemple = {x = 1107, y = 1176, z = 6}},
        [3] = {mapName = "Fridge", redTemple = {x = 1277, y = 1035, z = 3}, blueTemple = {x = 1225, y = 1035, z = 3}},
    }
Then simply change the order of the towns in teamLogin.lua, like this;
Lua:
    local maps = {
        [1] = {mapName = "Fridge", redTemple = {x = 1277, y = 1035, z = 3}, blueTemple = {x = 1225, y = 1035, z = 3}},
        [2] = {mapName = "Ignitos", redTemple = {x = 1153, y = 1069, z = 6}, blueTemple = {x = 1146, y = 1120, z = 6}},
        [3] = {mapName = "Dust2", redTemple = {x = 1169, y = 1192, z = 7}, blueTemple = {x = 1107, y = 1176, z = 6}},
    }
Turn them around,
Map 3 = map 1
Map 1 = map 2
map 2 = map 3

(only change the order in teamLogin.lua!)
 
I dont know how use it o_O', help plx.

Edit

Players never die o_O'
 
Last edited:
Map Change

PHP:
[1] = {mapName = "Edron", redTemple = {x = 478, y = 553, z = 6}, blueTemple = {x = 517, y = 603, z = 7}},
	[2] = {mapName = "Thais", redTemple = {x = 519, y = 184, z = 7}, blueTemple = {x = 552, y = 226, z = 7}},
	[3] = {mapName = "Carlin", redTemple = {x = 814, y = 204, z = 6}, blueTemple = {x = 787, y = 165, z = 7}},
	[4] = {mapName = "Fibula", redTemple = {x = 412, y = 805, z = 7}, blueTemple = {x = 343, y = 741, z = 7}},
	[5] = {mapName = "Venore", redTemple = {x = 654, y = 847, z = 7}, blueTemple = {x = 753, y = 826, z = 7}},
	[6] = {mapName = "Unkown Island", redTemple = {x = 800, y = 558, z = 6}, blueTemple = {x = 793, y = 704, z = 7}},

TeamLogin

PHP:
	[1] = {mapName = "Edron", redTemple = {x = 478, y = 553, z = 6}, blueTemple = {x = 517, y = 603, z = 7}},
	[2] = {mapName = "Thais", redTemple = {x = 519, y = 184, z = 7}, blueTemple = {x = 552, y = 226, z = 7}},
	[3] = {mapName = "Carlin", redTemple = {x = 814, y = 204, z = 6}, blueTemple = {x = 787, y = 165, z = 7}},
	[4] = {mapName = "Fibula", redTemple = {x = 412, y = 805, z = 7}, blueTemple = {x = 343, y = 741, z = 7}},
	[5] = {mapName = "Venore", redTemple = {x = 654, y = 847, z = 7}, blueTemple = {x = 753, y = 826, z = 7}},
	[6] = {mapName = "Unkown Island", redTemple = {x = 800, y = 558, z = 6}, blueTemple = {x = 793, y = 704, z = 7}},

Error:

When map change to EDRON, the player login in Thais :eek:

What i change for fix it?


EDIT:

FIXED :)
 
Last edited:
Map Change

PHP:
[1] = {mapName = "Edron", redTemple = {x = 478, y = 553, z = 6}, blueTemple = {x = 517, y = 603, z = 7}},
	[2] = {mapName = "Thais", redTemple = {x = 519, y = 184, z = 7}, blueTemple = {x = 552, y = 226, z = 7}},
	[3] = {mapName = "Carlin", redTemple = {x = 814, y = 204, z = 6}, blueTemple = {x = 787, y = 165, z = 7}},
	[4] = {mapName = "Fibula", redTemple = {x = 412, y = 805, z = 7}, blueTemple = {x = 343, y = 741, z = 7}},
	[5] = {mapName = "Venore", redTemple = {x = 654, y = 847, z = 7}, blueTemple = {x = 753, y = 826, z = 7}},
	[6] = {mapName = "Unkown Island", redTemple = {x = 800, y = 558, z = 6}, blueTemple = {x = 793, y = 704, z = 7}},

TeamLogin

PHP:
	[1] = {mapName = "Edron", redTemple = {x = 478, y = 553, z = 6}, blueTemple = {x = 517, y = 603, z = 7}},
	[2] = {mapName = "Thais", redTemple = {x = 519, y = 184, z = 7}, blueTemple = {x = 552, y = 226, z = 7}},
	[3] = {mapName = "Carlin", redTemple = {x = 814, y = 204, z = 6}, blueTemple = {x = 787, y = 165, z = 7}},
	[4] = {mapName = "Fibula", redTemple = {x = 412, y = 805, z = 7}, blueTemple = {x = 343, y = 741, z = 7}},
	[5] = {mapName = "Venore", redTemple = {x = 654, y = 847, z = 7}, blueTemple = {x = 753, y = 826, z = 7}},
	[6] = {mapName = "Unkown Island", redTemple = {x = 800, y = 558, z = 6}, blueTemple = {x = 793, y = 704, z = 7}},

Error:

When map change to EDRON, the player login in Thais :eek:

What i change for fix it?


EDIT:

FIXED :)

Yeh, change your teamLogin.lua maps to this;
Lua:
    [1] = {mapName = "Unkown Island", redTemple = {x = 800, y = 558, z = 6}, blueTemple = {x = 793, y = 704, z = 7}},  
   [2] = {mapName = "Edron", redTemple = {x = 478, y = 553, z = 6}, blueTemple = {x = 517, y = 603, z = 7}},
    [3] = {mapName = "Thais", redTemple = {x = 519, y = 184, z = 7}, blueTemple = {x = 552, y = 226, z = 7}},
    [4] = {mapName = "Carlin", redTemple = {x = 814, y = 204, z = 6}, blueTemple = {x = 787, y = 165, z = 7}},
    [5] = {mapName = "Fibula", redTemple = {x = 412, y = 805, z = 7}, blueTemple = {x = 343, y = 741, z = 7}},
    [6] = {mapName = "Venore", redTemple = {x = 654, y = 847, z = 7}, blueTemple = {x = 753, y = 826, z = 7}},
 
GOD is in team... Bug?

When have 3 players and one of they is GOD, now, i have 2 players in BLUE team or RED team.

Lfmao.
 
Anyone know how to use .... what are the commands
how do you pick a team
thanks
 
Hello, i have strange problem, when i try to log in, in tibia window im getting the "Connecting to the gameworld, please wait", but at the server console window there is
Code:
GOD has logged in
GOD has logged out
That happens on all characters, i can log in only when i turn off the teamlogin.lua script.
Can someone tell me why?
 
Back
Top