[Script] SCRIPT ZUMBI MUEMU New - Source Mu - Mu Server Files
 

Noticias:

SMF - Just Installed!

Menú principal

[Script] SCRIPT ZUMBI MUEMU New

Publicado por Dakosmu, Nov 16, 2025, 06:16 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Dakosmu

🧟 Guía de Instalación: Script Zombi MUEMU 🧟

Este evento transforma el PvP en una emocionante partida de supervivencia donde los infectados deben propagar el virus y los jugadores deben sobrevivir. Sigue los pasos cuidadosamente para implementarlo en tu servidor.

---

Paso 1: Creación del Archivo de Script

  • Crea un nuevo archivo de texto en la carpeta de scripts de tu servidor (generalmente 'Data/Scripts' o similar).
  • Nómbralo, por ejemplo, ScriptZumbi.lua.
  • Pega el siguiente código Lua dentro de ese archivo:

-----------------------------------------------------
------------------[ ZOOMBIE EVENT ]------------------
-----------------------------------------------------

zoombieUsers = {}
zoombieTime = 0
zoombieGates = {{109,243},{232,124},{4,84}}

function ZoombieAddUser(aIndex)
if zoombieUsers[aIndex] ~= nil then
NoticeSend(aIndex, 1, "Voce ja esta registrado no evento!")
return 0
end
NoticeSend(aIndex, 1, "Voce foi adicionado ao evento!")
MoveUserEx(aIndex, 1, 108, 241);

zoombieUsers[aIndex] = {isZombie=0, move=0, effect=10}

return 1
end

function ZoombieRemoveUser(aIndex)
if zoombieUsers[aIndex] ~= nil then
zoombieUsers[aIndex] = nil
EffectDel(aIndex, 1)
EffectDel(aIndex, 8)
EffectDel(aIndex, 143)
EffectDel(aIndex, 144)
SkinChangeSend(aIndex,nil)
NoticeSend(aIndex, 1, "Voce saiu do evento!")
end
end

function distance ( x1, y1, x2, y2 )
local dx = x1 - x2
local dy = y1 - y2
return math.sqrt ( dx * dx + dy * dy )
end


function ZoombieOnTimerThread()
--local rem = {}

local totalZombies = 0;
local totalPlayers = 0;

if zoombieTime > 60*15 then
zoombieTime = 0
end

for k,v in pairs(zoombieUsers) do

local typ = GetObjectType(k)
local con = GetObjectConnected(k)

if(typ == OBJECT_USER and con == OBJECT_CONNECTED) then

local map = GetObjectMap(k)
local mapX = GetObjectMapX(k)
local mapY = GetObjectMapY(k)

if v.move > 0 and map == 0 then

MoveUserEx(k, 1, v.x, v.y);
zoombieUsers[k].move = 0;

elseif map ~= 1 then

ZoombieRemoveUser(k)
--table.insert(rem, k);
else
for kk,vv in pairs(zoombieGates) do

if distance(vv[1],vv[2],mapX,mapY) < 2 then
ZoombieInfect(k)
NoticeSend(k, 1, "Voce foi infectado por se aproximar dos portoes")
end
end
end

if zoombieUsers[k].isZombie == 1 then
totalZombies = totalZombies+1
else
totalPlayers = totalPlayers+1
end


else

ZoombieRemoveUser(k)

end

end


if totalZombies == 0 and totalPlayers == 0 then
zoombieTime = zoombieTime+1;
return 0
end


if zoombieTime <= 5*60 then

if zoombieTime % 30 == 0 then
local t = 5*60-zoombieTime
NoticeSendToAll(0, 'Ataque Zoombie ira comecar em '..t..' seg')
end
if zoombieTime % 30 == 5 then
NoticeSendToAll(0, 'Utilize /zoombie para participar')
end

else

if (totalPlayers == 1 and totalZombies == 0) then

ZoombieCancel()

else


if totalZombies < 1 or zoombieTime == 5*60 or zoombieTime == 6*60 or zoombieTime == 7*60 then
if totalZombies < 3 and totalPlayers > 1 then
ZoombieInfectRandom();
totalZombies = totalZombies+1
totalPlayers = totalPlayers-1
end
end



if totalZombies < 1 and totalPlayers > 1 then
ZoombieInfectRandom();
end

if zoombieTime % 30 == 0 then
NoticeSendToAll(0, 'Restam '..totalPlayers..' players a serem infectados!')
end
if zoombieTime % 30 == 15 then
NoticeSendToAll(0, 'Ha '..totalZombies..' zumbis pelo mapa!')
end

if totalPlayers <= 1 or zoombieTime == 15*60 then
ZoombieFinish()
end
end

end


--for k,v in pairs(rem) do
--    ZoombieRemoveUser(v)
--end

zoombieTime = zoombieTime+1;

end

function ZoombieInfectRandom()

local total = 0
local totalR = 0

for k,v in pairs(zoombieUsers) do

if v.isZombie == 0 then
total = total+1
totalR = totalR + GetObjectReset(k)
end

end

if total < 1 then
return 0
end

local mid = math.floor(totalR/total)

local p = {}

for k,v in pairs(zoombieUsers) do

if v.isZombie == 0 then
if GetObjectReset(k) >= mid then
table.insert(p, k)
end
end

end

ZoombieInfect(p[ math.random( #p ) ])
NoticeSendToAll("O virus foi liberado!")

end

function ZoombieFinish()

local total = 0
local id

for k,v in pairs(zoombieUsers) do

if v.isZombie == 0 then
total = total+1
id = k
end

end

local bonus = math.ceil(500/total)

NoticeSendToAll("Evento finalizado!");
if total == 1 then
local name = GetObjectName(id)
NoticeSendToAll("Apenas "..name.." conseguiu sobreviver!")
elseif total > 1 then
NoticeSendToAll(total.." players conseguiram sobreviver!")
end

for k,v in pairs(zoombieUsers) do
if v.isZombie == 0 then
CashShopAddPoint(k, 0, bonus, 0)
NoticeSend(k, 1, "Voce recebeu "..bonus.." mPoints!")
end
ZoombieRemoveUser(k)
end

end

function ZoombieCancel()

for k,v in pairs(zoombieUsers) do
NoticeSend(k, 1, "Evento Cancelado")
ZoombieRemoveUser(k)
end

end

function ZoombieOnUserDie(aIndex,bIndex)

if zoombieUsers[aIndex] ~= nil then

zoombieUsers[aIndex].move = 1

if(zoombieUsers[aIndex].isZombie) then
local coord = zoombieGates[ math.random( #zoombieGates ) ]
zoombieUsers[aIndex].x = coord[1]
zoombieUsers[aIndex].y = coord[2]
else
zoombieUsers[aIndex].x = GetObjectMapX(aIndex)
zoombieUsers[aIndex].y = GetObjectMapY(aIndex)
end
end


if zoombieUsers[aIndex] ~= nil and zoombieUsers[bIndex] ~= nil then

if zoombieUsers[aIndex].isZombie == 0 and zoombieUsers[bIndex].isZombie == 1 then

ZoombieInfect(bIndex)
CashShopAddPoint(bIndex, 0, 50, 0)
NoticeSend(bIndex, 1, "Voce recebeu 50 mPoints!")

end

end

end

function ZoombieOnCharacterClose(aIndex)
ZoombieRemoveUser(aIndex)
end

function ZoombieInfect(aIndex)

if zoombieUsers[aIndex] ~= nil and zoombieUsers[aIndex].isZombie == 0 then
zoombieUsers[aIndex].isZombie = 1
zoombieUsers[aIndex].effect = 0
SkinChangeSend(aIndex,45)
end

end

function ZoombieEffects(aIndex)

if zoombieUsers[aIndex] ~= nil then

zoombieUsers[aIndex].effect = zoombieUsers[aIndex].effect-1

if zoombieUsers[aIndex].effect <= 0 then
if zoombieUsers[aIndex].isZombie == 1 then
EffectAdd(aIndex,0,1,15,10000,0,0,0)
EffectAdd(aIndex,0,8,15,1000,0,0,0)
EffectAdd(aIndex,0,143,15,10000,0,0,0)

elseif zoombieTime > 60*5 then

EffectAdd(aIndex,0,144,15,0,0,0,0)

end

zoombieUsers[aIndex].effect = 15;
end

end

end


---

Paso 2: Edición de ScriptMain.lua

  • Abre el archivo ScriptMain.lua de tu servidor.
  • Busca la sección de "requiere" al principio del archivo y agrega la línea para cargar el nuevo script:

require("ScriptZumbi")

  • Busca la función OnTimerThread() y añade dentro la llamada al evento:

ZoombieOnTimerThread()

  • Busca la función OnCommandManager(aIndex,code,arg) y añade el código para procesar el comando del evento (ajústalo según la estructura de tu función):

elseif code == 105 or code == 106 then
ZoombieAddUser(aIndex)
return 1

  • Busca la función OnCharacterClose(aIndex) y añade la limpieza del usuario al desconectarse:

ZoombieOnCharacterClose(aIndex)

  • Busca la función OnUserDie(aIndex,bIndex) y añade el código para manejar las muertes dentro del evento:

ZoombieOnUserDie(aIndex,bIndex)

---

Paso 3: Configuración de Comandos

  • Abre el archivo de configuración de comandos de tu servidor (generalmente Commands.txt o similar).
  • Asegúrate de que los códigos 105 y 106 estén asociados al comando de participación. Esto es lo que se envía al servidor cuando el usuario escribe el comando. El nombre del comando puede ser el mismo:

105 /zumbi
106 /zoombie

---

Paso 4: ¡Reinicia tu Servidor! 🚀

  • Una vez realizados todos los pasos anteriores, reinicia tu servidor para que los cambios en los archivos .lua y la configuración de comandos surtan efecto.
  • Los jugadores podrán participar en el evento usando el comando /zumbi (o /zoombie).



Espero que esta guía te sea muy útil. ¿Te gustaría que te ayude a formatear alguna otra publicación o información para tu foro SMF?
Bon Dia

🡱 🡳
Real Time Web Analytics