Nossa muito bom,concerteza adicionarei em meu servidor isso!
Parabéns,reputado.
info
Grupo: Marquês
Registrado: 29/10/11
Posts: 1.2k
Reputação: +134
Gênero: Masculino

Nossa muito bom,concerteza adicionarei em meu servidor isso!
Parabéns,reputado.
Testei aqui, funcionou perfeitamente!
Achei bem criativo, valeu por compartilhar =) Reputado![]()
Obs: Caso for atualizar, fazer algum update no sistema, "no meu ponto de vista", ficaria melhor apenas os participantes do evento verem quem desativa ou ativa o gerador!
info
Grupo: Campones
Registrado: 30/04/13
Posts: 74
Reputação: +3
Gênero: Masculino
Char no Tibia: Riverwood

Aqui da o seguinte erro na distro:
[20/05/2013 12:23:19] > Loading Defend The Generator.xml...[Error - ScriptingManager::loadFromXml] Cannot load mod mods/Defend The Generator.xml
[20/05/2013 12:23:19] Line: 23, Info: Input is not proper UTF-8, indicate encoding !
[20/05/2013 12:23:19] Bytes: 0xE1 0x72 0x65 0x61
[20/05/2013 12:23:19] failed!
O que pode ser?
Olá gostaria de ver um error no meu server o time VERMELHO esta se atacando essa função não ta funcionando para eles pros AZUL funciona
if isInvader(cid) and isInvader(target) or isDefender(cid) and isDefender(target) then
doPlayerSendCancel(cid, "You may not attack your team mates.") return false
end
alguem poderia me ajudar?? obrigado desde já
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

if isPlayer(cid) and isPlayer(target) then
if isDefender(cid) and isDefender(target) or isInvader(cid) and isInvader(target) then
doPlayerSendCancel(cid, "You may not attack your team mates.") return false
end
end
if isPlayer(cid) and isPlayer(target) then
if isDefender(cid) and isDefender(target) then
doPlayerSendCancel(cid, "You may not attack your team mates.") return false
elseif isInvader(cid) and isInvader(target) then
doPlayerSendCancel(cid, "You may not attack your team mates.") return false
end
end
tennta trocaif isPlayer(cid) and isPlayer(target) then if isDefender(cid) and isDefender(target) or isInvader(cid) and isInvader(target) then doPlayerSendCancel(cid, "You may not attack your team mates.") return false end endporif isPlayer(cid) and isPlayer(target) then if isDefender(cid) and isDefender(target) then doPlayerSendCancel(cid, "You may not attack your team mates.") return false elseif isInvader(cid) and isInvader(target) then doPlayerSendCancel(cid, "You may not attack your team mates.") return false end end
Não funciono vei
que coisa não sei o que que tem só o time INVADER pode c atacar entre CI e o time defender não se ataca aff que bosta queria que ficava time x time.
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

tenta
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Defend The Generator" version="1.0" author="LuckOake" contact="none" enabled="yes">
-----------------------------------------------------------------------
<config name="generator"><![CDATA[
teams = {
["Defenders"] = {
pos = {x = 314, y = 127, z = 7},
storage = 43110,
},
["Invaders"] = {
pos = {x = 317, y = 127, z = 7},
storage = 43111,
}
}
defpos,defstor = teams["Defenders"].pos,teams["Defenders"].storage
invpos,invstor = teams["Invaders"].pos,teams["Invaders"].storage
stor = 43112
tstor = 43113
sstor = 43114
gstor = 43115
area1 = {x = 311, y = 126, z = 7} -- Ponta de cima na esquerda da área
area2 = {x = 320, y = 131, z = 7} -- Ponta de baixo na direita da área
tp_pos = {x = 316, y = 132, z = 7, stackpos = 1} -- Posição do teleport (Não altere o stackpos)
sparkpos = {x = 316, y = 127, z = 7} -- Posição dos sparks do Gerador
maxplayers = 20 -- Máximo de players (De preferência, coloque um número par)
gtime = 10 -- Quantos segundos o gerador deverá ficar desligado para que os Invaders vençam
wall = { -- Positions das paredes de bloqueio (Não altere o stackpos)
[1] = {x = 316, y = 126, z = 7, stackpos = 1},
[2] = {x = 316, y = 127, z = 7, stackpos = 1},
}
wallid = 1111 -- Id das walls
prizes = {
[1] = {id = 2149, count = 13},
[2] = {id = 2149, count = 12},
[3] = {id = 2149, count = 11}
}
prand = math.random(1, #prizes)
function isMale(cid)
return getPlayerSex(cid) == 1 and true or false
end
function isFemale(cid)
return getPlayerSex(cid) == 0 and true or false
end
function getNumberType(n)
return n % 2 == 0 and "par" or "impar"
end
function selectPlayerTeam(cid)
if getNumberType(getGlobalStorageValue(stor)) == "par" then
doTeleportThing(cid, defpos)
setPlayerStorageValue(cid, tstor, 1)
registerCreatureEvent(cid, "GeneratorCast")
setGlobalStorageValue(defstor, getGlobalStorageValue(defstor)+1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You must DEFEND the Generator. Kill the invaders!")
if isMale(cid) then
doSetCreatureOutfit(cid, {lookType = math.random(128,134), lookHead = 88, lookBody = 88, lookLegs = 88, lookFeet = 88}, -1)
elseif isFemale(cid) then
doSetCreatureOutfit(cid, {lookType = math.random(136,142), lookHead = 88, lookBody = 88, lookLegs = 88, lookFeet = 88}, -1)
end
elseif getNumberType(getGlobalStorageValue(stor)) == "impar" then
doTeleportThing(cid, invpos)
setPlayerStorageValue(cid, tstor, 2)
setGlobalStorageValue(invstor, getGlobalStorageValue(invstor)+1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You must DISABLE the Generator. Crush the defenders!")
if isMale(cid) then
doSetCreatureOutfit(cid, {lookType = math.random(128,134), lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94}, -1)
elseif isFemale(cid) then
doSetCreatureOutfit(cid, {lookType = math.random(136,142), lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94}, -1)
end
end
setGlobalStorageValue(stor, getGlobalStorageValue(stor)+1)
registerCreatureEvent(cid, "GeneratorLogout")
registerCreatureEvent(cid, "GeneratorDeath")
end
function removeWalls()
for _, walls in ipairs(wall) do
doRemoveItem(getThingFromPos(walls).uid, 1)
end
end
function createWalls()
for _, walls in ipairs(wall) do
doCreateItem(wallid, 1, walls)
end
end
function isGeneratorActived()
return getGlobalStorageValue(gstor) == 1 and true or false
end
function generateSparks()
if isGeneratorActived() then
doSendMagicEffect(sparkpos, 11)
addEvent(generateSparks, 1000)
end
end
function startEvent()
setGlobalStorageValue(gstor, 1)
generateSparks()
doRemoveItem(getThingFromPos(tp_pos).uid, 1)
doSendMagicEffect(tp_pos, 2)
broadcastMessage("Defend The Generator Event started.")
removeWalls()
end
function resetEvent()
for _, pid in ipairs(getPlayersOnline()) do
if isDefender(pid) or isInvader(pid) then
setPlayerStorageValue(pid, tstor, -1)
doRemoveCondition(pid, CONDITION_OUTFIT)
doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
addEvent(doRemoveCreature, 3000, pid)
end
end
setGlobalStorageValue(stor, -1)
setGlobalStorageValue(sstor, -1)
setGlobalStorageValue(defstor, -1)
setGlobalStorageValue(invstor, -1)
setGlobalStorageValue(gstor, -1)
createWalls()
end
function destroyGenerator()
if getGlobalStorageValue(stor) == -1 then return true end
for _, tid in ipairs(getPlayersOnline()) do
if isInvader(tid) then
if not doPlayerAddItem(tid, prizes[prand].id, prizes[prand].count) then
local parcel = doCreateItemEx(ITEM_PARCEL)
doAddContainerItem(parcel, prizes[prand].id, prizes[prand].count)
doPlayerSendMailByName(getCreatureName(tid), parcel, getPlayerTown(tid))
doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough cap. Your prize was sent to the depot.")
end
doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_BLUE, "You win "..prizes[prand].count.."x "..getItemNameById(prizes[prand].id)..".")
end
end
broadcastMessage("The generator is destroyed! The Invaders Team won!")
resetEvent()
end
function isDefender(cid)
return getPlayerStorageValue(cid, tstor) == 1 and true or false
end
function isInvader(cid)
return getPlayerStorageValue(cid, tstor) == 2 and true or false
end
function openTeleport()
local tp = 1387
local tele = doCreateItem(tp, 1, tp_pos)
setGlobalStorageValue(defstor, 0)
setGlobalStorageValue(invstor, 0)
doItemSetAttribute(tele, "aid", 23590)
doSendMagicEffect(tp_pos, 10)
setGlobalStorageValue(stor, 0)
broadcastMessage("Defend The Generator Event is now open!")
end
]]></config>
------------------------------------------------------------------------------------
<talkaction words="/generator" access="5" event="buffer"><![CDATA[
domodlib('generator')
if not param then
doPlayerSendCancel(cid, 'Incorrect params. Choose if the event will "open", "force" or "reset".') return true
elseif param == "open" then
if getGlobalStorageValue(stor) ~= -1 or getGlobalStorageValue(stor) > 0 then
doPlayerSendCancel(cid, "You can't start the event now.") return true
end
openTeleport()
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've opened the Defend The Generator event.") return true
elseif param == "force" then
if getGlobalStorageValue(stor) == -1 or getGlobalStorageValue(sstor) >= 1 then
doPlayerSendCancel(cid, "You can't force the event now.") return true
end
setGlobalStorageValue(sstor, 1)
startEvent()
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've closed the Defend The Generator event.") return true
elseif param == "reset" then
if getGlobalStorageValue(stor) == -1 or getGlobalStorageValue(sstor) == -1 then
doPlayerSendCancel(cid, "You can't end the event now.") return true
end
resetEvent()
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've reseted the Defend The Generator event.") return true
end
return true
]]></talkaction>
------------------------------------------------------------------------------------
<action actionid="25177" event="script"><![CDATA[
domodlib('generator')
if isDefender(cid) and isGeneratorActived() then
doPlayerSendCancel(cid, "You cannot deactivate the generator. You are defending it!") return true
elseif isInvader(cid) and isGeneratorActived() then
setGlobalStorageValue(gstor, -1)
broadcastMessage(""..getCreatureName(cid).." [INVADER] turned OFF the generator! Defenders Team now have "..gtime.." seconds to turn on it again or they will lose!")
y = addEvent(destroyGenerator, gtime*1000)
elseif isDefender(cid) and not isGeneratorActived() then
setGlobalStorageValue(gstor, 1)
generateSparks()
broadcastMessage(""..getCreatureName(cid).." [DEFENDER] turned ON the generator!")
stopEvent(y)
elseif isInvader(cid) and not isGeneratorActived() then
doPlayerSendCancel(cid, "The generator is already off!") return true
end
doSendAnimatedText(getThingPos(item.uid), getGlobalStorageValue(gstor) == -1 and "Off!" or "On!", math.random(1, 255))
return true
]]></action>
------------------------------------------------------------------------------------
<movevent type="StepIn" actionid="23590" event="script"><![CDATA[
domodlib('generator')
function onStepIn(cid, position, fromPosition)
if getGlobalStorageValue(stor) == (maxplayers-1) then
setGlobalStorageValue(sstor, 1)
startEvent()
else
broadcastMessage(""..getCreatureName(cid).." entered in the Defend The Generator Event. There is "..(maxplayers-(getGlobalStorageValue(stor)+1)).." slots remaining.")
end
selectPlayerTeam(cid)
return true
end
]]></movevent>
------------------------------------------------------------------------------------
<event type="logout" name="GeneratorLogout" event="script"><![CDATA[
domodlib('generator')
function onLogout(cid)
if getPlayerStorageValue(cid, tstor) >= 1 then
doPlayerSendCancel(cid, "You can't logout when you are in this event!") return false
end
return true
end
]]></event>
------------------------------------------------------------------------------------
<event type="preparedeath" name="GeneratorDeath" event="script"><![CDATA[
domodlib('generator')
function onPrepareDeath(cid)
if isInvader(cid) and getGlobalStorageValue(invstor) > 1 then
setGlobalStorageValue(invstor, getGlobalStorageValue(invstor)-1)
broadcastMessage(""..getCreatureName(cid).." [INVADER] died. "..getGlobalStorageValue(defstor).." Defenders and "..getGlobalStorageValue(invstor).." Invaders left.")
elseif isInvader(cid) and getGlobalStorageValue(invstor) == 1 then
for _, wid in ipairs(getPlayersOnline()) do
if isDefender(wid) then
if not doPlayerAddItem(wid, prizes[prand].id, prizes[prand].count) then
local parcel = doCreateItemEx(ITEM_PARCEL)
doAddContainerItem(parcel, prizes[prand].id, prizes[prand].count)
doPlayerSendMailByName(getCreatureName(wid), parcel, getPlayerTown(wid))
doPlayerSendTextMessage(wid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough cap. Your prize was sent to the depot.")
end
doPlayerSendTextMessage(wid, MESSAGE_STATUS_CONSOLE_BLUE, "You win "..prizes[prand].count.."x "..getItemNameById(prizes[prand].id)..".")
end
end
broadcastMessage("All the Invaders are dead. Defenders won the Defend The Generator Event!")
resetEvent()
elseif isDefender(cid) then
setGlobalStorageValue(defstor, getGlobalStorageValue(defstor)-1)
broadcastMessage(""..getCreatureName(cid).." [DEFENDER] died. "..getGlobalStorageValue(defstor).." Defenders and "..getGlobalStorageValue(invstor).." Invaders left.")
end
setPlayerStorageValue(cid, tstor, -1)
doCreatureSetDropLoot(cid, false)
doPlayerSetLossSkill(cid, 0)
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)
return true
end
]]></event>
<event type="login" name="GeneratorLogin" event="script"><![CDATA[
domodlib('generator')
function onLogin(cid)
registerCreatureEvent(cid, "GeneratorCast")
return true
end
]]></event>
<event type="combat" name="GeneratorCast" event="script"><![CDATA[
domodlib('generator')
function onCombat(cid, target)
if isPlayer(cid) and isPlayer(target) then
if isDefender(cid) and isDefender(target) or isInvader(cid) and isInvader(target) then
doPlayerSendCancel(cid, "You may not attack your team mates.") return false
end
end
return true
end
]]></event>
</mod>
Editado Setembro 18 por Vodkart
tenta
<?xml version="1.0" encoding="UTF-8"?> <mod name="Defend The Generator" version="1.0" author="LuckOake" contact="none" enabled="yes"> ----------------------------------------------------------------------- <config name="generator"><![CDATA[ teams = { ["Defenders"] = { pos = {x = 314, y = 127, z = 7}, storage = 43110, }, ["Invaders"] = { pos = {x = 317, y = 127, z = 7}, storage = 43111, } } defpos,defstor = teams["Defenders"].pos,teams["Defenders"].storage invpos,invstor = teams["Invaders"].pos,teams["Invaders"].storage stor = 43112 tstor = 43113 sstor = 43114 gstor = 43115 area1 = {x = 311, y = 126, z = 7} -- Ponta de cima na esquerda da área area2 = {x = 320, y = 131, z = 7} -- Ponta de baixo na direita da área tp_pos = {x = 316, y = 132, z = 7, stackpos = 1} -- Posição do teleport (Não altere o stackpos) sparkpos = {x = 316, y = 127, z = 7} -- Posição dos sparks do Gerador maxplayers = 20 -- Máximo de players (De preferência, coloque um número par) gtime = 10 -- Quantos segundos o gerador deverá ficar desligado para que os Invaders vençam wall = { -- Positions das paredes de bloqueio (Não altere o stackpos) [1] = {x = 316, y = 126, z = 7, stackpos = 1}, [2] = {x = 316, y = 127, z = 7, stackpos = 1}, } wallid = 1111 -- Id das walls prizes = { [1] = {id = 2149, count = 13}, [2] = {id = 2149, count = 12}, [3] = {id = 2149, count = 11} } prand = math.random(1, #prizes) function isMale(cid) return getPlayerSex(cid) == 1 and true or false end function isFemale(cid) return getPlayerSex(cid) == 0 and true or false end function getNumberType(n) return n % 2 == 0 and "par" or "impar" end function selectPlayerTeam(cid) if getNumberType(getGlobalStorageValue(stor)) == "par" then doTeleportThing(cid, defpos) setPlayerStorageValue(cid, tstor, 1) registerCreatureEvent(cid, "GeneratorCast") setGlobalStorageValue(defstor, getGlobalStorageValue(defstor)+1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You must DEFEND the Generator. Kill the invaders!") if isMale(cid) then doSetCreatureOutfit(cid, {lookType = math.random(128,134), lookHead = 88, lookBody = 88, lookLegs = 88, lookFeet = 88}, -1) elseif isFemale(cid) then doSetCreatureOutfit(cid, {lookType = math.random(136,142), lookHead = 88, lookBody = 88, lookLegs = 88, lookFeet = 88}, -1) end elseif getNumberType(getGlobalStorageValue(stor)) == "impar" then doTeleportThing(cid, invpos) setPlayerStorageValue(cid, tstor, 2) setGlobalStorageValue(invstor, getGlobalStorageValue(invstor)+1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You must DISABLE the Generator. Crush the defenders!") if isMale(cid) then doSetCreatureOutfit(cid, {lookType = math.random(128,134), lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94}, -1) elseif isFemale(cid) then doSetCreatureOutfit(cid, {lookType = math.random(136,142), lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94}, -1) end end setGlobalStorageValue(stor, getGlobalStorageValue(stor)+1) registerCreatureEvent(cid, "GeneratorLogout") registerCreatureEvent(cid, "GeneratorDeath") end function removeWalls() for _, walls in ipairs(wall) do doRemoveItem(getThingFromPos(walls).uid, 1) end end function createWalls() for _, walls in ipairs(wall) do doCreateItem(wallid, 1, walls) end end function isGeneratorActived() return getGlobalStorageValue(gstor) == 1 and true or false end function generateSparks() if isGeneratorActived() then doSendMagicEffect(sparkpos, 11) addEvent(generateSparks, 1000) end end function startEvent() setGlobalStorageValue(gstor, 1) generateSparks() doRemoveItem(getThingFromPos(tp_pos).uid, 1) doSendMagicEffect(tp_pos, 2) broadcastMessage("Defend The Generator Event started.") removeWalls() end function resetEvent() for _, pid in ipairs(getPlayersOnline()) do if isDefender(pid) or isInvader(pid) then setPlayerStorageValue(pid, tstor, -1) doRemoveCondition(pid, CONDITION_OUTFIT) doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid))) addEvent(doRemoveCreature, 3000, pid) end end setGlobalStorageValue(stor, -1) setGlobalStorageValue(sstor, -1) setGlobalStorageValue(defstor, -1) setGlobalStorageValue(invstor, -1) setGlobalStorageValue(gstor, -1) createWalls() end function destroyGenerator() if getGlobalStorageValue(stor) == -1 then return true end for _, tid in ipairs(getPlayersOnline()) do if isInvader(tid) then if not doPlayerAddItem(tid, prizes[prand].id, prizes[prand].count) then local parcel = doCreateItemEx(ITEM_PARCEL) doAddContainerItem(parcel, prizes[prand].id, prizes[prand].count) doPlayerSendMailByName(getCreatureName(tid), parcel, getPlayerTown(tid)) doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough cap. Your prize was sent to the depot.") end doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_BLUE, "You win "..prizes[prand].count.."x "..getItemNameById(prizes[prand].id)..".") end end broadcastMessage("The generator is destroyed! The Invaders Team won!") resetEvent() end function isDefender(cid) return getPlayerStorageValue(cid, tstor) == 1 and true or false end function isInvader(cid) return getPlayerStorageValue(cid, tstor) == 2 and true or false end function openTeleport() local tp = 1387 local tele = doCreateItem(tp, 1, tp_pos) setGlobalStorageValue(defstor, 0) setGlobalStorageValue(invstor, 0) doItemSetAttribute(tele, "aid", 23590) doSendMagicEffect(tp_pos, 10) setGlobalStorageValue(stor, 0) broadcastMessage("Defend The Generator Event is now open!") end ]]></config> ------------------------------------------------------------------------------------ <talkaction words="/generator" access="5" event="buffer"><![CDATA[ domodlib('generator') if not param then doPlayerSendCancel(cid, 'Incorrect params. Choose if the event will "open", "force" or "reset".') return true elseif param == "open" then if getGlobalStorageValue(stor) ~= -1 or getGlobalStorageValue(stor) > 0 then doPlayerSendCancel(cid, "You can't start the event now.") return true end openTeleport() doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've opened the Defend The Generator event.") return true elseif param == "force" then if getGlobalStorageValue(stor) == -1 or getGlobalStorageValue(sstor) >= 1 then doPlayerSendCancel(cid, "You can't force the event now.") return true end setGlobalStorageValue(sstor, 1) startEvent() doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've closed the Defend The Generator event.") return true elseif param == "reset" then if getGlobalStorageValue(stor) == -1 or getGlobalStorageValue(sstor) == -1 then doPlayerSendCancel(cid, "You can't end the event now.") return true end resetEvent() doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've reseted the Defend The Generator event.") return true end return true ]]></talkaction> ------------------------------------------------------------------------------------ <action actionid="25177" event="script"><![CDATA[ domodlib('generator') if isDefender(cid) and isGeneratorActived() then doPlayerSendCancel(cid, "You cannot deactivate the generator. You are defending it!") return true elseif isInvader(cid) and isGeneratorActived() then setGlobalStorageValue(gstor, -1) broadcastMessage(""..getCreatureName(cid).." [INVADER] turned OFF the generator! Defenders Team now have "..gtime.." seconds to turn on it again or they will lose!") y = addEvent(destroyGenerator, gtime*1000) elseif isDefender(cid) and not isGeneratorActived() then setGlobalStorageValue(gstor, 1) generateSparks() broadcastMessage(""..getCreatureName(cid).." [DEFENDER] turned ON the generator!") stopEvent(y) elseif isInvader(cid) and not isGeneratorActived() then doPlayerSendCancel(cid, "The generator is already off!") return true end doSendAnimatedText(getThingPos(item.uid), getGlobalStorageValue(gstor) == -1 and "Off!" or "On!", math.random(1, 255)) return true ]]></action> ------------------------------------------------------------------------------------ <movevent type="StepIn" actionid="23590" event="script"><![CDATA[ domodlib('generator') function onStepIn(cid, position, fromPosition) if getGlobalStorageValue(stor) == (maxplayers-1) then setGlobalStorageValue(sstor, 1) startEvent() else broadcastMessage(""..getCreatureName(cid).." entered in the Defend The Generator Event. There is "..(maxplayers-(getGlobalStorageValue(stor)+1)).." slots remaining.") end selectPlayerTeam(cid) return true end ]]></movevent> ------------------------------------------------------------------------------------ <event type="logout" name="GeneratorLogout" event="script"><![CDATA[ domodlib('generator') function onLogout(cid) if getPlayerStorageValue(cid, tstor) >= 1 then doPlayerSendCancel(cid, "You can't logout when you are in this event!") return false end return true end ]]></event> ------------------------------------------------------------------------------------ <event type="preparedeath" name="GeneratorDeath" event="script"><![CDATA[ domodlib('generator') function onPrepareDeath(cid) if isInvader(cid) and getGlobalStorageValue(invstor) > 1 then setGlobalStorageValue(invstor, getGlobalStorageValue(invstor)-1) broadcastMessage(""..getCreatureName(cid).." [INVADER] died. "..getGlobalStorageValue(defstor).." Defenders and "..getGlobalStorageValue(invstor).." Invaders left.") elseif isInvader(cid) and getGlobalStorageValue(invstor) == 1 then for _, wid in ipairs(getPlayersOnline()) do if isDefender(wid) then if not doPlayerAddItem(wid, prizes[prand].id, prizes[prand].count) then local parcel = doCreateItemEx(ITEM_PARCEL) doAddContainerItem(parcel, prizes[prand].id, prizes[prand].count) doPlayerSendMailByName(getCreatureName(wid), parcel, getPlayerTown(wid)) doPlayerSendTextMessage(wid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough cap. Your prize was sent to the depot.") end doPlayerSendTextMessage(wid, MESSAGE_STATUS_CONSOLE_BLUE, "You win "..prizes[prand].count.."x "..getItemNameById(prizes[prand].id)..".") end end broadcastMessage("All the Invaders are dead. Defenders won the Defend The Generator Event!") resetEvent() elseif isDefender(cid) then setGlobalStorageValue(defstor, getGlobalStorageValue(defstor)-1) broadcastMessage(""..getCreatureName(cid).." [DEFENDER] died. "..getGlobalStorageValue(defstor).." Defenders and "..getGlobalStorageValue(invstor).." Invaders left.") end setPlayerStorageValue(cid, tstor, -1) doCreatureSetDropLoot(cid, false) doPlayerSetLossSkill(cid, 0) doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0) return true end ]]></event> <event type="login" name="GeneratorLogin" event="script"><![CDATA[ domodlib('generator') function onLogin(cid) registerCreatureEvent(cid, "GeneratorCast") return true end ]]></event> <event type="combat" name="GeneratorCast" event="script"><![CDATA[ domodlib('generator') function onCombat(cid, target) if isPlayer(cid) and isPlayer(target) then if isDefender(cid) and isDefender(target) or isInvader(cid) and isInvader(target) then doPlayerSendCancel(cid, "You may not attack your team mates.") return false end end return true end ]]></event> </mod>
POOO VEI VLW AE AGORA FUNCIONO ASUDHSAUDH O QUE VC FEZ?? ;D VLW MSM ![]()
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

é porque tinha que registra o evento no player ![]()
info
Grupo: Visconde
Registrado: 15/02/11
Posts: 259
Reputação: +25
Char no Tibia: Aias Laf Du

guaixara vc coloca o script na pasta MODS de seu ot fica fora da pasta data onde liga o ot
Seria possivel fazaer um mod parecido com esse mas para uma batalha PVP?
evento eh iniciado
dois portais sao criados
portal um para Time A portal dois para o Time B
membros do mesmo time nao podem se atacar
quando todos de um time sao mortos o time vivo vence.
o premio pode ser editado, pode ser itens, exp, ou premium.
ninguem pode dar logout durante o evento.
numero de players pode ser configurado.
se possivel tambem uma alavanca de cada lado, quem matar todos ou puxar a alavanca vence,
aparecer em broadcast quem morre, e quem entrou no portal.
Editado Outubro 15 por CoyoteStark
Manoo pls me ajuda como abre esse event esses comandos não funcionam /generator open ; nem um deles.
eu tenho que colocar eles no talkactions n ????????
Mano quando falo o comadno para abri oq acontece aparece um teleport ?
info
Grupo: Campones
Registrado: 30/04/13
Posts: 74
Reputação: +3
Gênero: Masculino
Char no Tibia: Riverwood

Manoo pls me ajuda como abre esse event esses comandos não funcionam /generator open ; nem um deles.
eu tenho que colocar eles no talkactions n ????????
Mano quando falo o comadno para abri oq acontece aparece um teleport ?
Ele é MOD, não precisa colocar nada na pasta talkactions.
Desculpa estar reabrindo.
Instalei o sistema mas fiquei com duvidas.
em tp_pos = {x = 32232, y = 31095, z = 7, stackpos = 1} -- Posição do teleport (Não altere o stackpos)
eu coloco as coordenadas de onde eu quero abrir o portal?
coloquei as coordenadas de ond eu queria que o portal abrice, funcionou.
team blue team red.
mas na hora de dar o comando "/generator force" os players não vão para as coordenadas que eu estipulei para eles nascerem. eles ficam estaticos perto do TP.
quando fechei o evento por causa deste problema (/generator reset), um dos players foi atacado e seu level e skill foram resetados.
alguém poderia me ajudar?
obrigado
info
Grupo: Marquês
Registrado: 22/07/12
Posts: 1.1k
Reputação: +400
Gênero: Masculino
Char no Tibia: Luck Oake
Olá galeres. Depois de um tempim sem postar sistemas eu trouxe um hoje pra vocês. Nada muito avançado, é até um sistema simples.
O que é: É um sistema que há dois times. Os Invaders e os Defenders. Os Invaders tem o objetivo de invadir a base dos Defenders e desativar um gerador para vencer, e os Defenders tem o objetivo de proteger o gerador e matar os Invaders. Para vencer, os Invaders devem manter o gerador desativado por 10 segundos.
Script:
http://pastebin.com/6NeH8uDF
Instalando:
Configure o script aqui:
teams = { ["Defenders"] = { pos = {x = 314, y = 127, z = 7}, storage = 43110, }, ["Invaders"] = { pos = {x = 317, y = 127, z = 7}, storage = 43111, } } area1 = {x = 311, y = 126, z = 7} -- Ponta de cima na esquerda da área area2 = {x = 320, y = 131, z = 7} -- Ponta de baixo na direita da área tp_pos = {x = 316, y = 132, z = 7, stackpos = 1} -- Posição do teleport (Não altere o stackpos) sparkpos = {x = 316, y = 127, z = 7} -- Posição dos sparks do Gerador maxplayers = 2 -- Máximo de players (De preferência, coloque um número par) gtime = 10 -- Quantos segundos o gerador deverá ficar desligado para que os Invaders vençam wall = { -- Positions das paredes de bloqueio (Não altere o stackpos) [1] = {x = 316, y = 126, z = 7, stackpos = 1}, [2] = {x = 316, y = 127, z = 7, stackpos = 1}, } wallid = 1111 -- Id das walls prizes = { [1] = {id = 2149, count = 13}, [2] = {id = 2149, count = 12}, [3] = {id = 2149, count = 11} }Siga a imagem de exemplo:
OBS: Essa imagem é apenas um exemplo! Edite a área da maneira que quiser, apenas seguindo os passos abaixo.
Em
area1 = {x = 311, y = 126, z = 7} -- Ponta de cima na esquerda da área area2 = {x = 320, y = 131, z = 7} -- Ponta de baixo na direita da áreaColoque, respectivamente, as coordenadas dos pontos vermelho e amarelo.
Em
wall = { -- Positions das paredes de bloqueio (Não altere o stackpos) [1] = {x = 316, y = 126, z = 7, stackpos = 1}, [2] = {x = 316, y = 127, z = 7, stackpos = 1}, }Coloque as posições das paredes de bloqueio, no caso da imagem, a position das grades.
Em
sparkpos = {x = 316, y = 127, z = 7} -- Posição dos sparks do GeradorVocê coloca onde aparecerá o efeito da energia do gerador para mostrar que ele está ligado. (Ponto verde)
Em
teams = { ["Defenders"] = { pos = {x = 314, y = 127, z = 7}, storage = 43110, }, ["Invaders"] = { pos = {x = 317, y = 127, z = 7}, storage = 43111, } }No lugar das pos, você coloca as coodenadas de onde cada time irá spawnar. No caso da imagem, os pisos pretos. OBS: O time Defenders deve ficar no lado onde há o gerador.
Importante: Na alavanca você coloca o action id 25177.
Para controlar o evento, use os seguintes comandos:
Créditos:
Obrigado, até.
Editado Dezembro 16 por LuckOake