Ir para conteúdo

Featured Replies

  • Respostas 20
  • Visualizações 3.7k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • mods - battle-mod.lua :   data/lib - battle-config.lua no arquivo battle-config.lua : FPS_PORTALPOS é a posição de onde vai criar o teleport ao dizer /fps open.   - Abraços!

Posted Images

Postado
  • Autor

Ei aqui eu não consegui adicionar o npc poderia ao inves de npc colocar para parecer um portal?

ta dando isso ai http://imgur.com/jq66n5B

 

mods - battle-mod.lua :

<?xml version="1.0" encoding="UTF-8"?>
<mod name="Battle Arena System" version="1.0" author="Ladyazaleia" contact="https://www.facebook.com/wustehs" enabled="yes">

<config name="battle-config"><![CDATA[
function msgForOthers(mensagem, classe)
if (not classe) then
    classe = MSG_WHITE
end
    
for _, pid in ipairs(getPlayersOnline()) do
if (getPlayerStorageValue(pid, 5602) == 1) then
    doPlayerSendChannelMessage(pid, "", mensagem, classe, FPS_CHANNEL)
end
end
return true
end

function doPlayerRemoveLethalConditions(cid) -- function by Rush Event.
local tmp = {1, 2, 4, 16, 32, 65, 128, 256, 512, 1024, 2048, 4096, 8192, 32768, 65536}
for i = 1, #tmp do

if (hasCondition(cid, tmp[i])) then
    doRemoveCondition(cid, tmp[i])
end
end
return true
end

function closeEvent(cid)
    doRemoveItem(6886, 1)
    doSendMagicEffect(FPS_PORTALPOS, CONST_ME_POFF)
    setGlobalStorageValue(5600, -1)
    setGlobalStorageValue(5601, -1)
        
for _, pid in ipairs(getPlayersOnline()) do
    doPlayerSendChannelMessage(pid, "", ""..FPS_EVENTNAME.." foi fechado.", MSG_WHITE, FPS_CHANNEL)

if (getPlayerStorageValue(pid, 5602) == 1) then
    doSendMagicEffect(getThingPos(pid), CONST_ME_POFF)
    doTeleportThing(pid, getTownTemplePosition(getPlayerTown(cid)))
    doSendMagicEffect(getThingPos(pid), CONST_ME_TELEPORT)
    doCreatureAddHealth(pid, getCreatureMaxHealth(pid), false)
    doCreatureAddMana(pid, getCreatureMaxMana(pid), false)
    setPlayerStorageValue(pid, 5601, 0)
    setPlayerStorageValue(pid, 5602, 0)
    setPlayerStorageValue(pid, 5603, 0)
    doPlayerSave(pid)
end
end
    setGlobalStorageValue(5602, -1)
return true
end

MSG_WHITE  = TALKTYPE_CHANNEL_MANAGEMENT or TALKTYPE_CHANNEL_W
MSG_RED    = TALKTYPE_GAMEMASTER_CHANNEL or TALKTYPE_CHANNEL_RN
MSG_ORANGE = TALKTYPE_CHANNEL_ORANGE or TALKTYPE_CHANNEL_O
]]></config>
    
<talkaction log="yes" words="/fps" event="script"><![CDATA[
domodlib('battle-config')
function onSay(cid, words, param, channel)

if (param == "") then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Error, comando inválido.")
end

if (getPlayerAccess(cid) >= 3) then
if (string.lower(param) == "open") then
if (getGlobalStorageValue(5600) ~= 1) then
    setGlobalStorageValue(5600, 1)
    setGlobalStorageValue(5602, 0)
    
local teleport = doCreateItem(1387, FPS_PORTALPOS)
    doItemSetAttribute(teleport, "uid", 6886)
    doSendMagicEffect(FPS_PORTALPOS, 10)
    doBroadcastMessage("O portal para o(a) "..FPS_EVENTNAME.." foi criado, com um limite de "..FPS_LIMITEPLAYERS.." jogadores.", 22)
return true
end
return true
end

if (string.lower(param) == "close") then
if (getGlobalStorageValue(5600) ~= -1 and getGlobalStorageValue(5601) ~= 1) then
    setGlobalStorageValue(5601, 1)
    setPlayerStorageValue(cid, 5605, 1)
    msgForOthers(""..FPS_FINISHTIME.." segundos restantes.")
    addEvent(setPlayerStorageValue, FPS_FINISHTIME * 1000, cid, 5605, -1)
    addEvent(closeEvent, FPS_FINISHTIME * 1000, cid)
return true
end
return true
end

local t = string.explode(param, ",")            
local pid = getPlayerByName(t[2])
if (string.lower(t[1]) == "ban") then
if (not t[2] or tonumber(t[2])) then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, digite o nome do jogador.")
return true
end
if (not isPlayer(pid)) then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, ""..t[2].." não existe ou encontra-se off-line.")
return true
end
if (getPlayerStorageValue(pid, 5604) ~= 1) then
if (getPlayerStorageValue(pid, 5602) == 1) then
    doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
    doSendMagicEffect(getThingPos(pid), CONST_ME_TELEPORT)
    setGlobalStorageValue(5602, getGlobalStorageValue(5602)-1)
end
    setPlayerStorageValue(pid, 5601, 0)
    setPlayerStorageValue(pid, 5602, 0)
    setPlayerStorageValue(pid, 5604, 1) -- blocked.
    msgForOthers(""..t[2].." foi bloqueado(a).")
local ba_banr = "Admininstrador"
if (FPS_REVEALEDAFTERBANPLAYER) then
    ba_banr = ""..getCreatureName(cid)..""
end
    doPlayerPopupFYI(pid, "AVISO :\n O "..ba_banr.." bloqueou você.\nvocê está temporariamente bloqueado(a) de participar.")
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você bloqueou "..t[2]..".")
else
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, ""..t[2].." já foi bloqueado(a).")
return true
end
return true
end

if (string.lower(t[1]) == "unban") then
if (not t[2] or tonumber(t[2])) then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, digite o nome do jogador.")
return true
end
if (not isPlayer(pid)) then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, ""..t[2].." não existe ou encontra-se off-line.")
return true
end
if (getPlayerStorageValue(pid, 5604) == 1) then
    setPlayerStorageValue(pid, 5604, 0) -- unblocked.
    msgForOthers(""..t[2].." foi desbloqueado(a).")
    doPlayerPopupFYI(pid, "AVISO :\nVocê foi desbloqueado(a).\nparticipe do "..FPS_EVENTNAME.." quando o mesmo estiver disponível.")
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você desbloqueou "..t[2]..".")
else
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, ""..t[2].." já foi desbloqueado(a).")
return true
end
return true
end
end
    local ba_players = "Indisponível"
if (getGlobalStorageValue(5602) ~= -1) then
ba_players = tostring(getGlobalStorageValue(5602))
end
    local limiteplayers = ""..ba_players.."/"..FPS_LIMITEPLAYERS..""
if (getGlobalStorageValue(5602) >= FPS_LIMITEPLAYERS) then
    limiteplayers = "FULL/"..FPS_LIMITEPLAYERS..""
end
if (string.lower(param) == "status") then
    local status = ""..FPS_EVENTNAME.." Status :\nOla "..getCreatureName(cid)..",\nveja algumas informações sobre o(a) "..FPS_EVENTNAME.."."
    doShowTextDialog(cid, 2395, ""..status.."\n\nPontos : ("..getPlayerStorageValue(cid, 5601)..")\nJogadores : ["..limiteplayers.."]")    
return true
end
return true
end
]]></talkaction>

<event type="preparedeath" name="FPSprepare" event="script"><![CDATA[
domodlib('battle-config')
function onPrepareDeath(cid, deathList)

local target = deathList[1]
if (getGlobalStorageValue(5600) == 1 and getPlayerStorageValue(cid, 5602) == 1) then
    
local i = 10
    doPlayerOpenChannel(cid, FPS_CHANNEL)
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid), MAGIC_EFFECT_UNKNOWN, COLOR_UNKNOWN, true)
    doCreatureAddMana(cid, getCreatureMaxMana(cid))
    doTeleportThing(cid, FPS_SPAWNPLAYER[math.random(1, #FPS_SPAWNPLAYER)])
    doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
    doPlayerRemoveLethalConditions(cid)
    
if (isMonster(target)) then
    addEvent(doPlayerSendChannelMessage, i, cid, "", ""..getCreatureName(target).." matou você.", MSG_RED, FPS_CHANNEL)
    setPlayerStorageValue(cid, 5602, 0)
    msgForOthers(""..getCreatureName(target).." matou "..getCreatureName(cid)..".")
    setPlayerStorageValue(cid, 5602, 1)
    setPlayerStorageValue(cid, 5601, 0)
return false
end
    
if (not isCreature(target)) then
    addEvent(doPlayerSendChannelMessage, i, cid, "", "Voce cometeu suicídio.", MSG_RED, FPS_CHANNEL)
    setPlayerStorageValue(cid, 5602, 0)
    msgForOthers(""..getCreatureName(cid).." cometeu suicídio.")
    setPlayerStorageValue(cid, 5602, 1)
    setPlayerStorageValue(cid, 5601, 0)
return false
end
    
    doPlayerOpenChannel(target, FPS_CHANNEL)
    setPlayerStorageValue(target, 5601, getPlayerStorageValue(target, 5601)+1)
    setPlayerStorageValue(cid, 5602, 0)
    setPlayerStorageValue(target, 5602, 0)
    msgForOthers(""..getCreatureName(target).." derrotou "..getCreatureName(cid)..".")
    setPlayerStorageValue(target, 5602, 1)
    setPlayerStorageValue(cid, 5602, 1)
    addEvent(doPlayerSendChannelMessage, i, cid, "", ""..getCreatureName(target).." derrotou você.", MSG_RED, FPS_CHANNEL)
    addEvent(doPlayerSendChannelMessage, i, target, "", "Você derrotou "..getCreatureName(cid)..".", MSG_ORANGE, FPS_CHANNEL)
        
    dofile("config.lua")
    local EXP = 0
if (FPS_ENABLEEXPERIENCE) then
    EXP = rateExperience * getPlayerLevel(cid)
    doPlayerAddExperience(target, EXP)
end
    doSendAnimatedText(getThingPos(target), tostring(EXP), gainExperienceColor)
    doPlayerSendTextMessage(target, MESSAGE_STATUS_DEFAULT, "Você ganhou "..EXP.." ponto(s) de experiência.")
    setPlayerStorageValue(cid, 5601, 0)
return false
end
return true
end
]]></event>

<event type="logout" name="FPSlogout" event="script"><![CDATA[
domodlib('battle-config')
function onLogout(cid)
if (getGlobalStorageValue(5601) == 1 and getPlayerStorageValue(cid, 5602) == 1 or getPlayerStorageValue(cid, 5605) == 1) then
    doPlayerSendCancel(cid, "Aguarde "..FPS_FINISHTIME.." segundo(s).")
return false
end
    
if(getPlayerStorageValue(cid, 5602) == 1) then
    setPlayerStorageValue(cid, 5601, 0)
    setPlayerStorageValue(cid, 5602, 0)
    doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
    doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
    doPlayerSendChannelMessage(cid, "", "Você saiu do jogo.", MSG_WHITE, FPS_CHANNEL)
    doPlayerRemoveLethalConditions(cid)
    doPlayerSave(cid)
        
if (getPlayerAccess(cid) < 3) then
    setGlobalStorageValue(5602, getGlobalStorageValue(5602)-1)
    msgForOthers(""..getCreatureName(cid).." saiu do jogo.")
end
return false
end
return true
end
]]></event>

<movevent type="StepIn" uniqueid="6886" event="script"><![CDATA[
domodlib('battle-config')
if (getGlobalStorageValue(5600) ~= 1) then
return true
end
if (getGlobalStorageValue(5601) == 1) then
    doPlayerSendCancel(cid, "O portal vai fechar em poucos segundo(s).")
    doTeleportThing(cid, fromPosition)
return true
end
if (getPlayerStorageValue(cid, 5604) == 1) then
    doPlayerSendCancel(cid, "Sinto muito, você está temporariamente bloqueado(a).")
    doTeleportThing(cid, fromPosition)
return true
end                
if (getGlobalStorageValue(5602) >= FPS_LIMITEPLAYERS and getPlayerAccess(cid) < 3) then
    doPlayerSendCancel(cid, "A arena está cheia.")
    doTeleportThing(cid, fromPosition)
return true
end
if (getPlayerStorageValue(cid, 5602) ~= 1) then
    addEvent(doPlayerSendChannelMessage, 10, cid,"", "Você participou do jogo.", MSG_WHITE, FPS_CHANNEL)
if (getPlayerAccess(cid) < 3) then
    setGlobalStorageValue(5602, getGlobalStorageValue(5602)+1)
    msgForOthers(""..getCreatureName(cid).." participou do jogo.")
end
    setPlayerStorageValue(cid, 5602, 1)
end
    doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
    doTeleportThing(cid, FPS_SPAWNPLAYER[math.random(1, #FPS_SPAWNPLAYER)])
    doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
    doPlayerOpenChannel(cid, FPS_CHANNEL)
]]></movevent>

<event type="combat" name="FPScombat" event="script"><![CDATA[
function onCombat(cid, target)

if(FPS_BLOCKIP) then
if (getPlayerIp(cid) == getPlayerIp(target)) then return false end
end
    
for _, pid in ipairs(getPlayersOnline()) do
if (getGlobalStorageValue(5600) == 1 and getGlobalStorageValue(5601) == 1 and getPlayerStorageValue(pid, 5602) == 1) then
return false
end
end
return true
end
]]></event>

<event type="attack" name="FPSattack" event="script"><![CDATA[
function onAttack(cid, target)
    
if(FPS_BLOCKIP) then
if (getPlayerIp(cid) == getPlayerIp(target)) then return false end
end
    
for _, pid in ipairs(getPlayersOnline()) do
if (getGlobalStorageValue(5600) == 1 and getGlobalStorageValue(5601) == 1 and getPlayerStorageValue(pid, 5602) == 1) then
return false
end
end
return true
end
]]></event>

<event type="login" name="FPSlogin" event="buffer"><![CDATA[
if (getPlayerStorageValue(cid, 5601) == -1) then
    setPlayerStorageValue(cid, 5601, 0)
end
    
    registerCreatureEvent(cid, "FPSprepare")
    registerCreatureEvent(cid, "FPSlogout")
    registerCreatureEvent(cid, "FPScombat")
    registerCreatureEvent(cid, "PFSattack")
    registerCreatureEvent(cid, "PFScast")
]]></event>

<globalevent name="FPS tips" interval="600000" event="script"><![CDATA[
domodlib('battle-config')
function onThink(interval)

local FPS_tips = {
    "Atualmente existem "..getGlobalStorageValue(5602).." player(s) lutando, não deixe de participar.",
    "Com o canal fechado, você não recebe informações dentro do jogo. deixe-o sempre aberto.",
    "Cuidado ao ofender um jogador, você corre o risco de ser bloqueado(a).",
    "Aperte 'CTRL + Q' caso você queira sair do jogo, você precisa está em protection zone.",
    "Chame seus amigos e venha jogar, porquê aqui a diversão nunca acaba.",
    "Dica : configure o comando '/fps status' como hotkey. Assim você poderá checar suas informações com facilidade."
    }
    
if (getGlobalStorageValue(5600) == 1) then
    msgForOthers(FPS_tips[math.random(1, #FPS_tips)])
end
return true
end
]]></globalevent>
</mod>

 

data/lib - battle-config.lua

--[[
   'Battle Arena' desenvolvido por Ladyazaleia.
    WhatsApp : (83) 9629-6394
    Facebook : https://www.facebook.com/wustehs
  ]]

FPS_EVENTNAME             = "Battle Arena" -- Nome do evento.
FPS_FINISHTIME             = 5              -- Dentro do evento, jogadores não poderão atacar uns aos outros enquanto esse tempo não esgotar após o comando /fps close ser executado.
FPS_LIMITEPLAYERS         = 26             -- Limite de jogadores.
FPS_SHOWGODNAMEAFTERBAN = false          -- true = Mostra o nome do GM na mensagem do banido; false = Mostra o nome 'Admininstrador'.
FPS_ENABLEEXPERIENCE     = true              -- true = Habilita a experiência; false = Desabilita.
FPS_BLOCKIP             = false          -- true = Jogadores que tentarem usar MC pra ganhar exp fácil, não conseguirão atacar seus próprios chars; false = permite isso.
FPS_CHANNEL             = 15              -- ID do Battle Arena Channel.


FPS_PORTALPOS = {x = 160, y = 382, z = 7}

FPS_SPAWNPLAYER = {
    {x = 261, y = 619, z = 7},
    {x = 275, y = 619, z = 7},
    {x = 261, y = 630, z = 7},
    {x = 275, y = 630, z = 7}
}

no arquivo battle-config.lua :

FPS_PORTALPOS é a posição de onde vai criar o teleport ao dizer /fps open.

 

- Abraços!

Editado por HallsSantos (veja o histórico de edições)

Postado

mods - battle-mod.lua :

<?xml version="1.0" encoding="UTF-8"?>
<mod name="Battle Arena System" version="1.0" author="Ladyazaleia" contact="https://www.facebook.com/wustehs" enabled="yes">

<config name="battle-config"><![CDATA[
function msgForOthers(mensagem, classe)
if (not classe) then
    classe = MSG_WHITE
end
    
for _, pid in ipairs(getPlayersOnline()) do
if (getPlayerStorageValue(pid, 5602) == 1) then
    doPlayerSendChannelMessage(pid, "", mensagem, classe, FPS_CHANNEL)
end
end
return true
end

function doPlayerRemoveLethalConditions(cid) -- function by Rush Event.
local tmp = {1, 2, 4, 16, 32, 65, 128, 256, 512, 1024, 2048, 4096, 8192, 32768, 65536}
for i = 1, #tmp do

if (hasCondition(cid, tmp[i])) then
    doRemoveCondition(cid, tmp[i])
end
end
return true
end

function closeEvent(cid)
    doRemoveItem(6886, 1)
    doSendMagicEffect(FPS_PORTALPOS, CONST_ME_POFF)
    setGlobalStorageValue(5600, -1)
    setGlobalStorageValue(5601, -1)
        
for _, pid in ipairs(getPlayersOnline()) do
    doPlayerSendChannelMessage(pid, "", ""..FPS_EVENTNAME.." foi fechado.", MSG_WHITE, FPS_CHANNEL)

if (getPlayerStorageValue(pid, 5602) == 1) then
    doSendMagicEffect(getThingPos(pid), CONST_ME_POFF)
    doTeleportThing(pid, getTownTemplePosition(getPlayerTown(cid)))
    doSendMagicEffect(getThingPos(pid), CONST_ME_TELEPORT)
    doCreatureAddHealth(pid, getCreatureMaxHealth(pid), false)
    doCreatureAddMana(pid, getCreatureMaxMana(pid), false)
    setPlayerStorageValue(pid, 5601, 0)
    setPlayerStorageValue(pid, 5602, 0)
    setPlayerStorageValue(pid, 5603, 0)
    doPlayerSave(pid)
end
end
    setGlobalStorageValue(5602, -1)
return true
end

MSG_WHITE  = TALKTYPE_CHANNEL_MANAGEMENT or TALKTYPE_CHANNEL_W
MSG_RED    = TALKTYPE_GAMEMASTER_CHANNEL or TALKTYPE_CHANNEL_RN
MSG_ORANGE = TALKTYPE_CHANNEL_ORANGE or TALKTYPE_CHANNEL_O
]]></config>
    
<talkaction log="yes" words="/fps" event="script"><![CDATA[
domodlib('battle-config')
function onSay(cid, words, param, channel)

if (param == "") then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Error, comando inválido.")
end

if (getPlayerAccess(cid) >= 3) then
if (string.lower(param) == "open") then
if (getGlobalStorageValue(5600) ~= 1) then
    setGlobalStorageValue(5600, 1)
    setGlobalStorageValue(5602, 0)
    
local teleport = doCreateItem(1387, FPS_PORTALPOS)
    doItemSetAttribute(teleport, "uid", 6886)
    doSendMagicEffect(FPS_PORTALPOS, 10)
    doBroadcastMessage("O portal para o(a) "..FPS_EVENTNAME.." foi criado, com um limite de "..FPS_LIMITEPLAYERS.." jogadores.", 22)
return true
end
return true
end

if (string.lower(param) == "close") then
if (getGlobalStorageValue(5600) ~= -1 and getGlobalStorageValue(5601) ~= 1) then
    setGlobalStorageValue(5601, 1)
    setPlayerStorageValue(cid, 5605, 1)
    msgForOthers(""..FPS_FINISHTIME.." segundos restantes.")
    addEvent(setPlayerStorageValue, FPS_FINISHTIME * 1000, cid, 5605, -1)
    addEvent(closeEvent, FPS_FINISHTIME * 1000, cid)
return true
end
return true
end

local t = string.explode(param, ",")            
local pid = getPlayerByName(t[2])
if (string.lower(t[1]) == "ban") then
if (not t[2] or tonumber(t[2])) then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, digite o nome do jogador.")
return true
end
if (not isPlayer(pid)) then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, ""..t[2].." não existe ou encontra-se off-line.")
return true
end
if (getPlayerStorageValue(pid, 5604) ~= 1) then
if (getPlayerStorageValue(pid, 5602) == 1) then
    doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
    doSendMagicEffect(getThingPos(pid), CONST_ME_TELEPORT)
    setGlobalStorageValue(5602, getGlobalStorageValue(5602)-1)
end
    setPlayerStorageValue(pid, 5601, 0)
    setPlayerStorageValue(pid, 5602, 0)
    setPlayerStorageValue(pid, 5604, 1) -- blocked.
    msgForOthers(""..t[2].." foi bloqueado(a).")
local ba_banr = "Admininstrador"
if (FPS_REVEALEDAFTERBANPLAYER) then
    ba_banr = ""..getCreatureName(cid)..""
end
    doPlayerPopupFYI(pid, "AVISO :\n O "..ba_banr.." bloqueou você.\nvocê está temporariamente bloqueado(a) de participar.")
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você bloqueou "..t[2]..".")
else
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, ""..t[2].." já foi bloqueado(a).")
return true
end
return true
end

if (string.lower(t[1]) == "unban") then
if (not t[2] or tonumber(t[2])) then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, digite o nome do jogador.")
return true
end
if (not isPlayer(pid)) then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, ""..t[2].." não existe ou encontra-se off-line.")
return true
end
if (getPlayerStorageValue(pid, 5604) == 1) then
    setPlayerStorageValue(pid, 5604, 0) -- unblocked.
    msgForOthers(""..t[2].." foi desbloqueado(a).")
    doPlayerPopupFYI(pid, "AVISO :\nVocê foi desbloqueado(a).\nparticipe do "..FPS_EVENTNAME.." quando o mesmo estiver disponível.")
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você desbloqueou "..t[2]..".")
else
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, ""..t[2].." já foi desbloqueado(a).")
return true
end
return true
end
end
    local ba_players = "Indisponível"
if (getGlobalStorageValue(5602) ~= -1) then
ba_players = tostring(getGlobalStorageValue(5602))
end
    local limiteplayers = ""..ba_players.."/"..FPS_LIMITEPLAYERS..""
if (getGlobalStorageValue(5602) >= FPS_LIMITEPLAYERS) then
    limiteplayers = "FULL/"..FPS_LIMITEPLAYERS..""
end
if (string.lower(param) == "status") then
    local status = ""..FPS_EVENTNAME.." Status :\nOla "..getCreatureName(cid)..",\nveja algumas informações sobre o(a) "..FPS_EVENTNAME.."."
    doShowTextDialog(cid, 2395, ""..status.."\n\nPontos : ("..getPlayerStorageValue(cid, 5601)..")\nJogadores : ["..limiteplayers.."]")    
return true
end
return true
end
]]></talkaction>

<event type="preparedeath" name="FPSprepare" event="script"><![CDATA[
domodlib('battle-config')
function onPrepareDeath(cid, deathList)

local target = deathList[1]
if (getGlobalStorageValue(5600) == 1 and getPlayerStorageValue(cid, 5602) == 1) then
    
local i = 10
    doPlayerOpenChannel(cid, FPS_CHANNEL)
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid), MAGIC_EFFECT_UNKNOWN, COLOR_UNKNOWN, true)
    doCreatureAddMana(cid, getCreatureMaxMana(cid))
    doTeleportThing(cid, FPS_SPAWNPLAYER[math.random(1, #FPS_SPAWNPLAYER)])
    doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
    doPlayerRemoveLethalConditions(cid)
    
if (isMonster(target)) then
    addEvent(doPlayerSendChannelMessage, i, cid, "", ""..getCreatureName(target).." matou você.", MSG_RED, FPS_CHANNEL)
    setPlayerStorageValue(cid, 5602, 0)
    msgForOthers(""..getCreatureName(target).." matou "..getCreatureName(cid)..".")
    setPlayerStorageValue(cid, 5602, 1)
    setPlayerStorageValue(cid, 5601, 0)
return false
end
    
if (not isCreature(target)) then
    addEvent(doPlayerSendChannelMessage, i, cid, "", "Voce cometeu suicídio.", MSG_RED, FPS_CHANNEL)
    setPlayerStorageValue(cid, 5602, 0)
    msgForOthers(""..getCreatureName(cid).." cometeu suicídio.")
    setPlayerStorageValue(cid, 5602, 1)
    setPlayerStorageValue(cid, 5601, 0)
return false
end
    
    doPlayerOpenChannel(target, FPS_CHANNEL)
    setPlayerStorageValue(target, 5601, getPlayerStorageValue(target, 5601)+1)
    setPlayerStorageValue(cid, 5602, 0)
    setPlayerStorageValue(target, 5602, 0)
    msgForOthers(""..getCreatureName(target).." derrotou "..getCreatureName(cid)..".")
    setPlayerStorageValue(target, 5602, 1)
    setPlayerStorageValue(cid, 5602, 1)
    addEvent(doPlayerSendChannelMessage, i, cid, "", ""..getCreatureName(target).." derrotou você.", MSG_RED, FPS_CHANNEL)
    addEvent(doPlayerSendChannelMessage, i, target, "", "Você derrotou "..getCreatureName(cid)..".", MSG_ORANGE, FPS_CHANNEL)
        
    dofile("config.lua")
    local EXP = 0
if (FPS_ENABLEEXPERIENCE) then
    EXP = rateExperience * getPlayerLevel(cid)
    doPlayerAddExperience(target, EXP)
end
    doSendAnimatedText(getThingPos(target), tostring(EXP), gainExperienceColor)
    doPlayerSendTextMessage(target, MESSAGE_STATUS_DEFAULT, "Você ganhou "..EXP.." ponto(s) de experiência.")
    setPlayerStorageValue(cid, 5601, 0)
return false
end
return true
end
]]></event>

<event type="logout" name="FPSlogout" event="script"><![CDATA[
domodlib('battle-config')
function onLogout(cid)
if (getGlobalStorageValue(5601) == 1 and getPlayerStorageValue(cid, 5602) == 1 or getPlayerStorageValue(cid, 5605) == 1) then
    doPlayerSendCancel(cid, "Aguarde "..FPS_FINISHTIME.." segundo(s).")
return false
end
    
if(getPlayerStorageValue(cid, 5602) == 1) then
    setPlayerStorageValue(cid, 5601, 0)
    setPlayerStorageValue(cid, 5602, 0)
    doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
    doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
    doPlayerSendChannelMessage(cid, "", "Você saiu do jogo.", MSG_WHITE, FPS_CHANNEL)
    doPlayerRemoveLethalConditions(cid)
    doPlayerSave(cid)
        
if (getPlayerAccess(cid) < 3) then
    setGlobalStorageValue(5602, getGlobalStorageValue(5602)-1)
    msgForOthers(""..getCreatureName(cid).." saiu do jogo.")
end
return false
end
return true
end
]]></event>

<movevent type="StepIn" uniqueid="6886" event="script"><![CDATA[
domodlib('battle-config')
if (getGlobalStorageValue(5600) ~= 1) then
return true
end
if (getGlobalStorageValue(5601) == 1) then
    doPlayerSendCancel(cid, "O portal vai fechar em poucos segundo(s).")
    doTeleportThing(cid, fromPosition)
return true
end
if (getPlayerStorageValue(cid, 5604) == 1) then
    doPlayerSendCancel(cid, "Sinto muito, você está temporariamente bloqueado(a).")
    doTeleportThing(cid, fromPosition)
return true
end                
if (getGlobalStorageValue(5602) >= FPS_LIMITEPLAYERS and getPlayerAccess(cid) < 3) then
    doPlayerSendCancel(cid, "A arena está cheia.")
    doTeleportThing(cid, fromPosition)
return true
end
if (getPlayerStorageValue(cid, 5602) ~= 1) then
    addEvent(doPlayerSendChannelMessage, 10, cid,"", "Você participou do jogo.", MSG_WHITE, FPS_CHANNEL)
if (getPlayerAccess(cid) < 3) then
    setGlobalStorageValue(5602, getGlobalStorageValue(5602)+1)
    msgForOthers(""..getCreatureName(cid).." participou do jogo.")
end
    setPlayerStorageValue(cid, 5602, 1)
end
    doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
    doTeleportThing(cid, FPS_SPAWNPLAYER[math.random(1, #FPS_SPAWNPLAYER)])
    doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
    doPlayerOpenChannel(cid, FPS_CHANNEL)
]]></movevent>

<event type="combat" name="FPScombat" event="script"><![CDATA[
function onCombat(cid, target)

if(FPS_BLOCKIP) then
if (getPlayerIp(cid) == getPlayerIp(target)) then return false end
end
    
for _, pid in ipairs(getPlayersOnline()) do
if (getGlobalStorageValue(5600) == 1 and getGlobalStorageValue(5601) == 1 and getPlayerStorageValue(pid, 5602) == 1) then
return false
end
end
return true
end
]]></event>

<event type="attack" name="FPSattack" event="script"><![CDATA[
function onAttack(cid, target)
    
if(FPS_BLOCKIP) then
if (getPlayerIp(cid) == getPlayerIp(target)) then return false end
end
    
for _, pid in ipairs(getPlayersOnline()) do
if (getGlobalStorageValue(5600) == 1 and getGlobalStorageValue(5601) == 1 and getPlayerStorageValue(pid, 5602) == 1) then
return false
end
end
return true
end
]]></event>

<event type="login" name="FPSlogin" event="buffer"><![CDATA[
if (getPlayerStorageValue(cid, 5601) == -1) then
    setPlayerStorageValue(cid, 5601, 0)
end
    
    registerCreatureEvent(cid, "FPSprepare")
    registerCreatureEvent(cid, "FPSlogout")
    registerCreatureEvent(cid, "FPScombat")
    registerCreatureEvent(cid, "PFSattack")
    registerCreatureEvent(cid, "PFScast")
]]></event>

<globalevent name="FPS tips" interval="600000" event="script"><![CDATA[
domodlib('battle-config')
function onThink(interval)

local FPS_tips = {
    "Atualmente existem "..getGlobalStorageValue(5602).." player(s) lutando, não deixe de participar.",
    "Com o canal fechado, você não recebe informações dentro do jogo. deixe-o sempre aberto.",
    "Cuidado ao ofender um jogador, você corre o risco de ser bloqueado(a).",
    "Aperte 'CTRL + Q' caso você queira sair do jogo, você precisa está em protection zone.",
    "Chame seus amigos e venha jogar, porquê aqui a diversão nunca acaba.",
    "Dica : configure o comando '/fps status' como hotkey. Assim você poderá checar suas informações com facilidade."
    }
    
if (getGlobalStorageValue(5600) == 1) then
    msgForOthers(FPS_tips[math.random(1, #FPS_tips)])
end
return true
end
]]></globalevent>
</mod>

 

data/lib - battle-config.lua

--[[
   'Battle Arena' desenvolvido por Ladyazaleia.
    WhatsApp : (83) 9629-6394
    Facebook : https://www.facebook.com/wustehs
  ]]

FPS_EVENTNAME             = "Battle Arena" -- Nome do evento.
FPS_FINISHTIME             = 5              -- Dentro do evento, jogadores não poderão atacar uns aos outros enquanto esse tempo não esgotar após o comando /fps close ser executado.
FPS_LIMITEPLAYERS         = 26             -- Limite de jogadores.
FPS_SHOWGODNAMEAFTERBAN = false          -- true = Mostra o nome do GM na mensagem do banido; false = Mostra o nome 'Admininstrador'.
FPS_ENABLEEXPERIENCE     = true              -- true = Habilita a experiência; false = Desabilita.
FPS_BLOCKIP             = false          -- true = Jogadores que tentarem usar MC pra ganhar exp fácil, não conseguirão atacar seus próprios chars; false = permite isso.
FPS_CHANNEL             = 15              -- ID do Battle Arena Channel.


FPS_PORTALPOS = {x = 160, y = 382, z = 7}

FPS_SPAWNPLAYER = {
    {x = 261, y = 619, z = 7},
    {x = 275, y = 619, z = 7},
    {x = 261, y = 630, z = 7},
    {x = 275, y = 630, z = 7}
}

no arquivo battle-config.lua :

FPS_PORTALPOS é a posição de onde vai criar o teleport ao dizer /fps open.

 

- Abraços!

Obrigado cara, pegou direitinho só que tem uma outra coisa agora que ocorreu, o Player não morre chega a 0 e não morre e pode andar com vida zero por ai segue as imagens ai !

http://imgur.com/8ka6kvO,Aapad9l,8FkknwD

 

[16/03/2015 18:53:54] [Error - CreatureScript Interface] 
[16/03/2015 18:53:54] buffer:onPrepareDeath
[16/03/2015 18:53:54] Description: 
[16/03/2015 18:53:54] [string "loadBuffer"]:8: attempt to call global 'doPlayerOpenChannel' (a nil value)
[16/03/2015 18:53:54] stack traceback:
[16/03/2015 18:53:54] [string "loadBuffer"]:8: in function <[string "loadBuffer"]:2>
Postado
  • Autor

Creio que seja porque os distros antigos que já encontramos compilados, não possuem a função "doPlayerOpenChannel".

É uma função que abre x canal, então eu programei para quando o player morrer, abrir o canal.

Pra resolver, você teria que compilar suas sources, ou usar algum distro que tenha a função.

Postado

Então tipo tenho que ter um ot mais novo?

desculpe, é que não entendo muito disso :/

Creio que seja porque os distros antigos que já encontramos compilados, não possuem a função "doPlayerOpenChannel".

É uma função que abre x canal, então eu programei para quando o player morrer, abrir o canal.

Pra resolver, você teria que compilar suas sources, ou usar algum distro que tenha a função.

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo