local config = {
team1Name = "Red team",
team2Name = "Blue team",
team1 = 1000, -- Storage
team2 = 1001, -- Storage
team1Temple = {x = 123, y = 123, z = 7},
team2Temple = {x = 123, y = 123, z = 7},
}
function onLogin(cid)
if getGlobalStorageValue(config.team1) > getGlobalStorageValue(config.team2) then
doTeleportThing(cid, config.team2Temple)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have been sent to play for the " .. config.team2Name .. "!")
setGlobalStorageValue(config.team2, getGlobalStorageValue(config.team2)+1)
else
doTeleportThing(cid, config.team1Temple)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have been sent to play for the " .. config.team1Name .. "!")
setGlobalStorageValue(config.team1, getGlobalStorageValue(config.team1)+1)
end
return true
end
[1] = {mapName = "Thais", redTemple = {x = 32369, y = 32241, z = 7}, blueTemple = {x = 32335, y = 32199, z = 7}},
[2] = {mapName = "Carlin", redTemple = {x = 32360, y = 31782, z = 7}, blueTemple = {x = 32387, y = 31821, z = 6}},
[3] = {mapName = "Venore", redTemple = {x = 32451, y = 32464, z = 7}, blueTemple = {x = 32449, y = 32410, z = 6}},
team1Temple = {x = 123, y = 123, z = 7}, {x = 123, y = 123, z = 7}, {x = 123, y = 123, z = 7},
team2Temple = {x = 123, y = 123, z = 7}, {x = 123, y = 123, z = 7}, {x = 123, y = 123, z = 7},
local config = {
team1Name = "Red team",
team2Name = "Blue team",
team1 = 1000, -- Storage
team2 = 1001, -- Storage
}
local towns = {
[1] = {mapName = "Thais", redTemple = {x = 32369, y = 32241, z = 7}, blueTemple = {x = 32335, y = 32199, z = 7}},
[2] = {mapName = "Carlin", redTemple = {x = 32360, y = 31782, z = 7}, blueTemple = {x = 32387, y = 31821, z = 6}},
[3] = {mapName = "Venore", redTemple = {x = 32451, y = 32464, z = 7}, blueTemple = {x = 32449, y = 32410, z = 6}},
}
function onLogin(cid)
local current = towns[getStorage(townid)] -- this should be the storage which store the curren map id
if getGlobalStorageValue(config.team1) > getGlobalStorageValue(config.team2) then
doTeleportThing(cid, current.redTemple)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have been sent to play for the " .. config.team2Name .. "!")
setGlobalStorageValue(config.team2, getGlobalStorageValue(config.team2)+1)
else
doTeleportThing(cid, current.blueTemple)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have been sent to play for the " .. config.team1Name .. "!")
setGlobalStorageValue(config.team1, getGlobalStorageValue(config.team1)+1)
end
return true
end
ye, i suppose when u change map you give a globalstorage the id of the map so it wouldb elike that
LUA:local config = { team1Name = "Red team", team2Name = "Blue team", team1 = 1000, -- Storage team2 = 1001, -- Storage } local towns = { [1] = {mapName = "Thais", redTemple = {x = 32369, y = 32241, z = 7}, blueTemple = {x = 32335, y = 32199, z = 7}}, [2] = {mapName = "Carlin", redTemple = {x = 32360, y = 31782, z = 7}, blueTemple = {x = 32387, y = 31821, z = 6}}, [3] = {mapName = "Venore", redTemple = {x = 32451, y = 32464, z = 7}, blueTemple = {x = 32449, y = 32410, z = 6}}, } function onLogin(cid) local current = towns[getStorage(townid)] -- this should be the storage which store the curren map id if getGlobalStorageValue(config.team1) > getGlobalStorageValue(config.team2) then doTeleportThing(cid, current.redTemple) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have been sent to play for the " .. config.team2Name .. "!") setGlobalStorageValue(config.team2, getGlobalStorageValue(config.team2)+1) else doTeleportThing(cid, current.blueTemple) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have been sent to play for the " .. config.team1Name .. "!") setGlobalStorageValue(config.team1, getGlobalStorageValue(config.team1)+1) end return true end
local config = {
team1Name = "Blue Bangbabies",
team2Name = "Red Rageboys",
team1 = 1002, -- Storage
team2 = 1003, -- Storage
}
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 towns = {
[1] = {mapName = "Thais", redTemple = {x = 32369, y = 32241, z = 7}, blueTemple = {x = 32335, y = 32199, z = 7}},
[2] = {mapName = "Carlin", redTemple = {x = 32360, y = 31782, z = 7}, blueTemple = {x = 32387, y = 31821, z = 6}},
[3] = {mapName = "Venore", redTemple = {x = 32451, y = 32464, z = 7}, blueTemple = {x = 32449, y = 32410, z = 6}},
}
function onLogin(cid)
local current = towns[getGlobalStorageValue(100)]
setPlayerStorageValue(cid, 1002, 0)
setPlayerStorageValue(cid, 1003, 0)
if getGlobalStorageValue(1000) > getGlobalStorageValue(1001) then
setPlayerStorageValue(cid, 1003, 1)
doAddCondition(cid, conditionBlue)
doTeleportThing(cid, current.blueTemple)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
setGlobalStorageValue(1001, getGlobalStorageValue(1001)+1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have been sent to play for the " .. config.team1Name .. "!")
else
setPlayerStorageValue(cid, 1002, 1)
doAddCondition(cid, conditionRed)
doTeleportThing(cid, current.redTemple)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
setGlobalStorageValue(1000, getGlobalStorageValue(1000)+1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have been sent to play for the " .. config.team2Name .. "!")
end
return true
end
You need to make a script on startUp that sets the globalstorage 100 to 1 and 1000, 1001 to 0.
Also a globalevent that will change the globalstorage 100 to +1 every X minute and also teleporthing all players to the next town. Got no time to help you right now, going to school.
function onThink(interval, lastExecution, thinkInterval)
local maps = {
[1] = {mapName = "Thais", redTemple = {x = 32369, y = 32241, z = 7}, blueTemple = {x = 32335, y = 32199, z = 7}},
[2] = {mapName = "Carlin", redTemple = {x = 32360, y = 31782, z = 7}, blueTemple = {x = 32387, y = 31821, z = 6}},
[3] = {mapName = "Venore", redTemple = {x = 32451, y = 32464, z = 7}, blueTemple = {x = 32449, y = 32410, z = 6}},
}
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
I can give u an advanced one pm me.
As i said in script the town id should be the variable that store the current town id and the id should also be in relevant with the arrangement of the
town array keys so the values would be right:
map changed , town id storage variable holder should be changed to the new town id and that id will be the representer to the array key where the
values would be extracted from it.
function onCombat(cid, target)
if isPlayer(attacker) and isPlayer(target) then
if getPlayerStorageValue(attacker, 1003) == 1 and getPlayerStorageValue(target, 1003) == 1 then
return doPlayerSendCancel(cid, "You may not attack your teammates.") and false
elseif getPlayerStorageValue(attacker, 1002) == 1 and getPlayerStorageValue(target, 1002) == 1 then
return doPlayerSendCancel(cid, "You may not attack your teammates.") and false
end
end
return true
end