Glitches, Cheats, Reviews, Discussions for the Latest and Hottest Video Games

Welcome to our forums Guest. We hope you have a nice stay Smile || New Better AllRoundTech.com

    [Release] Portal Gun

    Share
    avatar
    iPROFamily
    Administrator
     Administrator

    Posts : 309
    Points : 21267
    Reputation : 53
    Join date : 2011-03-22
    Location : iPROFamily World

    [Release] Portal Gun

    Post by iPROFamily on Thu May 19, 2011 5:14 pm

    Features

    • Creates two portals (red and green).
    • Portals are two way teleporters.
    Patch
    [You must be registered and logged in to see this link.] is a clean patch containing only this portal gun mod. (Code for the mod is below the video)

    Controls

    • Aim down the weapon sight to create a red portal at the position your aiming at.
    • Fire the gun to create a green portal at the position your aiming at.
    Video:

    Code:
    #include maps\mp\_utility;
    #include maps\mp\gametypes\_hud_util;
    #include common_scripts\utility;

    init()
    {
            level thread onPlayerConnect();
    }

    onPlayerConnect()
    {
            for(;;)
            {
                    level waittill( "connected", player );

                    player thread onPlayerSpawned();
            }
    }

    onPlayerSpawned()
    {
            self endon( "disconnect" );

            for(;;)
            {
                    self waittill( "spawned_player" );
                    self.TeleportCooling = 0;
                    self thread GivePortalGun();
            }
    }

    GivePortalGun()
    {
            self endon("disconnect");
            self endon("death");

            self giveWeapon("spas12_fmj_grip_mp", 7, false );
            self thread DestroyPortalsOnDeath();
            self thread MonitorTeleportCooling();

            for(;;)
            {
                    if (self AttackButtonPressed() && self getCurrentWeapon() == "spas12_fmj_grip_mp")
                    {
                            self notify("Portal1Death");
                            if (isDefined(self.Portal1))
                                    self.Portal1 Delete();

                            self thread CreatePortal1();
                            wait .5;
                    }
                    if (self AdsButtonPressed() && self getCurrentWeapon() == "spas12_fmj_grip_mp")
                    {
                            self notify("Portal2Death");
                            if (isDefined(self.Portal2))
                                    self.Portal2 Delete();

                            self thread CreatePortal2();
                            wait .5;
                    }
                    wait .05;
            }
    }

    CreatePortal1()
    {
            self endon("disconnect");
            self endon("death");
            self endon("Portal1Death");

            self.Portal1 = SpawnFx( level.spawnGlow["friendly"], GetCursorPos() );
            TriggerFx( self.Portal1 );

            for(;;)
            {
                    foreach(player in level.players)
                    {
                            if(Distance(self.Portal1.origin,player.origin) < 50 && player.TeleportCooling == 0)
                            {
                                    player SetOrigin(self.Portal2.origin);
                                    player.TeleportCooling = 20;
                                    wait .5;
                            }
                    }
                    wait .05;
            }
    }

    CreatePortal2()
    {
            self endon("disconnect");
            self endon("death");
            self endon("Portal2Death");

            self.Portal2 = SpawnFx( level.spawnGlow["enemy"], GetCursorPos() );
            TriggerFx( self.Portal2 );

            for(;;)
            {
                    foreach(player in level.players)
                    {
                            if(Distance(self.Portal2.origin,player.origin) < 50 && player.TeleportCooling == 0)
                            {
                                    player SetOrigin(self.Portal1.origin);
                                    player.TeleportCooling = 20;
                                    wait .5;
                            }
                    }
                    wait .05;
            }
    }

    MonitorTeleportCooling()
    {
            self endon("disconnect");
            self endon("death");
           
            for(;;)
            {
                    foreach(player in level.players)
                    {
                            if (player.TeleportCooling > 0)
                                    player.TeleportCooling--;
                    }
                    wait .1;
            }
    }

    DestroyPortalsOnDeath()
    {
            self endon("disconnect");
            self waittill("death");
            self notify("Portal1Death");
            self notify("Portal2Death");
            self.Portal1 Delete();
            self.Portal2 Delete();
    }


    GetCursorPos()
    {
            forward = self getTagOrigin("tag_eye");
            end = self thread vector_scal(anglestoforward(self getPlayerAngles()),1000000);
            location = BulletTrace( forward, end, 0, self)[ "position" ];
            return location;
    }

    vector_scal(vec, scale)
    {
            vec = (vec[0] * scale, vec[1] * scale, vec[2] * scale);
            return vec;
    }

    Credit:
    [You must be registered and logged in to see this link.] At [You must be registered and logged in to see this link.]

      Current date/time is Mon Dec 18, 2017 5:39 am