Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as SQL by Murder ( 6 years ago )
//Este script solo debe cargarse (dofile) en el OnScriptLoad, si lo agrega en la funcion Reload los objectos creados se multiplicaran.

_Murder <- {

/*
A continuacion se puede ver la configuracion del evento.

Status es el estado del evento, hay 3 estados: closed, open y started.

El evento tiene 2 mapas: Laberinto y Mansion Vercetty.
SpawnPoints[0] y EventDoor[0] = Mapa #1 -  laberinto.
SpawnPoints[1] y EventDoor[1] = Mapa #2 -  Mansion Vercetty.

*/
    Game =
    {
        Status = "closed",
        World = 2021,
        Map = 0, //Default = 0 (Maze). Este se modifica al crearse el evento.
        KillerAmount = 1, //Default = 1 (1 Asesino). Este se modifica al crearse el evento.
        Weapon = 11, //Default = 11 (Motosierra). Este se modifica al crearse el evento.
        Time = {
            Timer = null, // Timer
            Seconds = null //Amount (Seconds)
        },
        Players = [],
        Killers = []
    },
    Maps =
    {
        Names = ["Maze", "Mansion Vercetty"],
        SpawnPoints = [Vector(-1782.52, -494.406, 50.5685), Vector(-378.502, -590.229, 25.5263)],
        Doors = [CreateObject( 1717, 2021, Vector(-1771.1, -493.713, 50.9624), 255 ), CreateObject( 2563, 2021, Vector(-378.555, -583.315, 25.7197), 255 ) ],
        Objects = [ [], [ ::CreateObject( 1392, 2021, Vector(-384.752, -614.298, 10.8113), 255 ).RotateToEuler(Vector(-3.14159, -3.14159, 1.5708), 0), ::CreateObject( 2563, 2021, Vector(-378.544, -554.049, 20.0721), 255 ), ::CreateObject(1392, 2021,Vector(-384.752, -614.298, 10.8113), 255).RotateToEuler(Vector(-3.14159, -3.14159, 1.5708), 0), ::CreateObject(1393, 2021,Vector(-375.091, -614.307, 11.279), 255).RotateToEuler(Vector(1.50987e-07, 1.50987e-07, 1.56995), 0), ::CreateObject(1393, 2021,Vector(-340.116, -572.544, 36.4743), 255).RotateToEuler(Vector(0, 0, 0), 0) ] ]
    }




    function Create( admin, time, weapon, killers, map ) //killers amount (random killer)
    {
        this["Game"]["Status"] = "open";
        this["Game"]["Map"] = map.tointeger();
        this["Game"]["Weapon"] = weapon.tointeger();
        this["Game"]["KillerAmount"] = killers.tointeger();
        this["Game"]["Time"]["Seconds"] = ( time.tointeger() * 60);

        this.Message("O evento Murder foi criado por " + admin.Name + ". Numero de assassinos: " + killers + " - Arma: " + GetWeaponName(weapon) + " - Map: " + this["Maps"]["Names"][map.tointeger()] , "The murder event has been created by " + admin.Name + ". Number of killers: " + killers + " - Weapon: " + GetWeaponName(weapon) + " - Map: " + this["Maps"]["Names"][map.tointeger()] , "El evento Murder ha sido creado por " + admin.Name + ". Cantidad de asesinos: " + killers + " - Arma: " + GetWeaponName(weapon) + " - Mapa: " + this["Maps"]["Names"][map.tointeger()]);
        this.Message("Para entrar no evento aperte F.", "Press F to join in event.", "Para entrar al evento press F.")
        _Timer.Create( this, _Murder.Start, 30000, 1);
    }

    function Start()
    {
        local players = this["Game"]["Players"];
        if ( players.len() > this["Game"]["KillerAmount"] )
        {
            this["Game"]["Status"] = "started";
            local door = this["Maps"]["Doors"][ this.Game.Map ];
            door.MoveTo( Vector(door.Pos.x, door.Pos.y, ( door.Pos.z - 8 )), 1000);

            //ACA SE CONVIERTE EN ASESINO :V
            for(local i=0; i < this["Game"]["KillerAmount"]; i++)
            {
                local random = random( 0, players.len() ),
                player = this.Game.Players[random];
                player.Team = 19;

                this["Game"]["Killers"].push(player);
                this["Game"]["Players"].remove(random);


                ::Anuncio("Voce e o assasino!", "You are the killer!", "Vos sos el asesino!", player, 0);
            }


            this.Message("Evento iniciado! Em 20 segundos o assassino pegará a arma" , "Evento iniciado! En 20 segundos el asesino obtendra las armas", "Evento iniciado! En 20 segundos el asesino obtendra las armas");

            _Timer.Create(this, function()
            {
                foreach(player in this["Game"]["Killers"])
                {
                    if ( player )
                    {
                        //player.Skin = 214;
                        player.SetWeapon(this["Game"]["Weapon"], 999999);
                    }
                }

            }, 20000, 1);

            this["Game"]["Time"]["Timer"] = _Timer.Create(this, function()
            {
                local seconds = this["Game"]["Time"]["Seconds"];
                this["Game"]["Time"]["Seconds"]--;

                local minutos = seconds / 60, sec = seconds - (minutos * 60);
                ::AnnounceAll("~y~"+minutos+":"+format("%.2d", sec), 1);

                if (seconds < 1)
                {
                    _Timer.Destroy(this["Game"]["Time"]["Timer"]);
                    this.End();
                }

            }, 1000, 0);

        }
        else
        {
            this.Message("Evento cancelado por falta de jogadores.", "Event canceled due to lack of players.", "Evento cancelado por falta de jugadores.");

            foreach(player in players)
            {
                if ( player )
                {
                    //player.Select();
     ::onPlayerSpawn(player);
                }
            }

            foreach(player in this["Game"]["Killers"])
            {
                if ( player )
                {
                    //player.Select();
     ::onPlayerSpawn(player);
                }
            }
            this.ResetGame();
        }

    }

    function End()
    {
            local door = this["Maps"]["Doors"][ this.Game.Map ];
            door.MoveTo( Vector(door.Pos.x, door.Pos.y, ( door.Pos.z + 8 )), 1000);

        local killers = this["Game"]["Killers"].len();
        local players = this["Game"]["Players"].len();
        local premio = random(10000, 30000);
        if ( players > 0 )
        {
            this.Message("O tempo acabou e os sobreviventes ganharam $"+ premio, "Time is up and the survivors have won $"+ premio, "El tiempo ha terminado y los sobrevivientes han ganado $"+ premio);
            if ( this["Game"]["Time"]["Timer"] ) _Timer.Destroy(this["Game"]["Time"]["Timer"]);

            foreach(player in this["Game"]["Players"])
            {
                if ( player )
                {
                    //player.Select();
                    ::onPlayerSpawn(player);
					::IncCash(player, premio);
                    ::status[player.ID].Event++;
                }
            }

            foreach(player in this["Game"]["Killers"])
            {
                if ( player )
                {
                    //player.Select();
					::onPlayerSpawn(player);
                }
            }
            this.ResetGame();
        }
        else if ( killers < 1)
        {
            this.Message("Nao ha assassinos no evento, portanto, os sobreviventes ganharam $"+ premio, "There are no killers in the event, therefore the survivors have won $"+ premio, "No hay asesinos en el evento, por lo tanto los sobrevivientes han ganado $"+ premio);
            if ( this["Game"]["Time"]["Timer"] ) _Timer.Destroy(this["Game"]["Time"]["Timer"]);

            foreach(player in this["Game"]["Players"])
            {
                if ( player )
                {
                    //player.Select();
					::onPlayerSpawn(player);
                    ::IncCash(player, premio);
                    ::status[player.ID].Event++;
                }
            }

            foreach(player in this["Game"]["Killers"])
            {
                if ( player )
                {
                    //player.Select();
					::onPlayerSpawn(player);
                }
            }
            this.ResetGame();
        }
        else
        {
            this.Message("Nao ha sobreviventes no evento, portanto, os assassinos ganharam $"+ premio, "There are no survivors in the event, therefore the killers have won $"+ premio, "No hay sobrevivientes en el evento, por lo tanto los asesinos han ganado $"+ premio);
            if ( this["Game"]["Time"]["Timer"] ) _Timer.Destroy(this["Game"]["Time"]["Timer"]);

            foreach(player in this["Game"]["Players"])
            {
                if ( player )
                {
                    //player.Select();
					::onPlayerSpawn(player);

                }
            }

            foreach(player in this["Game"]["Killers"])
            {
                if ( player )
                {
                    //player.Select();
					::onPlayerSpawn(player);
                    ::IncCash(player, premio);
                    ::status[player.ID].Event++;
                }
            }
            this.ResetGame();
        }
    }


    function Cancel(admin)
    {
        if ( this["Game"]["Time"]["Timer"] ) _Timer.Destroy(this["Game"]["Time"]["Timer"]);

            foreach(player in this["Game"]["Players"])
            {
                if ( player )
                {
                    //player.::Select();
					::onPlayerSpawn(player);
                }
            }

            foreach(player in this["Game"]["Killers"])
            {
                if ( player )
                {
                    //player.Select();
					::onPlayerSpawn(player);
                }
            }
            this.Message("O admin "+ admin.Name + " cancelou o evento.", "The admin "+ admin.Name + " canceled the event.", "El admin "+ admin.Name + " cancelo el evento." );
            this.ResetGame();
    }

    function Join(player)
    {
        local map = this["Game"]["Map"];
        this["Game"]["Players"].push(player);
        player.World = this["Game"]["World"];
        player.Pos = this["Maps"]["SpawnPoints"][map];
        player.Disarm();
        player.Skin = 0;
        player.Team = 1;
        player.Health = 100;
        player.Armor = 0;
        this.Message("O jogador "+ player.Name + " entrou no evento.", "The player "+ player.Name + " has joined the event.", "El jugador "+ player.Name + " entro en el evento." );
    }

    function RemovePlayer(player, reason)
    {
        player.Disarm();


        foreach(index, plr  in this["Game"]["Players"])
        {
            if ( player.ID == plr.ID)
            {
                this["Game"]["Players"].remove(index);
            }
        }

        foreach( index, plr in this["Game"]["Killers"] )
        {
            if ( plr )
            {
                if ( plr.ID == player.ID)
                {
                    this["Game"]["Killers"].remove(index);
                }
            }

        }
        this.Message(player + " foi desclassificado do evento. Motivo: "+reason, player + " was disqualified from the event. Reason: "+reason, player + " fue descalificado del evento. Motivo: "+reason)

        if ( this["Game"]["Killers"].len() < 1 ) this.End();
        else if (this["Game"]["Players"].len() < 1 ) this.End();

    }


//=========================================================
//                    Otras funciones jsjsjs
//=========================================================

    function Message(pt, en, es)
    {
        local prefix =  "[#541414][[#FF3333]Murder Event[#541414]] [#F5956C]%s"; //Server Message Prefix
        local irc_prefix =  "5[4Murder Event5]6 %s"; //IRC Message Prefix
        ::_MSG(  format(prefix, pt), format(prefix, en), format(prefix, es)  );
        ::EchoMessage(format(irc_prefix, pt));
    }

    function ResetGame()
    {
        this.Game =
        {
            Status = "closed",
            World = 2021,
            Map = 0, //Default = 0 (Maze). Este se modifica al crearse el evento.
            KillerAmount = 1, //Default = 1 (1 Asesino). Este se modifica al crearse el evento.
            Weapon = 11, //Default = 11 (Motosierra). Este se modifica al crearse el evento.
            Time = {
                Timer = null, // Timer
                Seconds = null //Amount (Seconds)
            },
            Players = [],
            Killers = []
        }
    }

    function PlayerInEvent(player)
    {
        foreach(plr in this["Game"]["Players"])
        {
            if ( player.ID == plr.ID)
            {
                return true;
            }
        }

        foreach(plr in this["Game"]["Killers"])
        {
            if ( player.ID == plr.ID)
            {
                return true;
            }
        }

    }

}

 

Revise this Paste

Your Name: Code Language: