Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with teleport code
#1
I am using this snippet of code for adding teleport to a mod:

Code:
doTeleport()
{
    self endon ( "disconnect" );
    self endon ( "death" );
    self notifyOnPlayerCommand("dpad_up", "+actionslot 1");

    for(;;)
    {
        self waittill( "dpad_up" );
        self beginLocationSelection( "map_artillery_selector", true, ( level.mapSize / 5.625 ) );
        self.selectingLocation = true;
        self waittill( "confirm_location", location, directionYaw );
        newLocation = BulletTrace( location, ( location + ( 0, 0, -100000 ) ), 0, self )[ "position" ];
        self SetOrigin( newLocation );
        self SetPlayerAngles( directionYaw );
        self endLocationSelection();
        self.selectingLocation = undefined;
    }
}

The problem is the destination height often teleports the player below the map. I tried changing the z coordinate to a higher number but this results in teleporting inside structures or players falling to their death.

Is their a way to get the players current z index and then just add 100? Or or their some better way to tackle this?
Reply

#2
Code:
doTeleport()
{
    self endon ( "disconnect" );
    self endon ( "death" );
    self notifyOnPlayerCommand("dpad_up", "+actionslot 1");

    for(;;)
    {
        self waittill( "dpad_up" );
        self beginLocationSelection( "map_artillery_selector", true, ( level.mapSize / 5.625 ) );
        self.selectingLocation = true;
        self waittill( "confirm_location", location, directionYaw );
        newLocation = BulletTrace( location, ( location + ( 0, 0, 0 ) ), 0, self )[ "position" ];
        self SetOrigin( newLocation );
        self SetPlayerAngles( directionYaw );
        self endLocationSelection();
        self.selectingLocation = undefined;
    }
}

I think this should work.
Reply

#3
Thanks, Big Grin

I'll give it a try and let you know.
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Make area detect. flag Teleport lewisbibo 4 4,952 10-12-2013, 18:10
Last Post: EnVi Sweden Rocks
  Help Code color crosshairs koren30 3 3,996 10-02-2013, 19:26
Last Post: koren30
  Help need help?how to make plugins code hXnarutoXone 12 8,512 09-01-2013, 18:30
Last Post: Bandarigoda123
  Help Need Help with C# code tubwux 2 3,302 08-27-2013, 18:18
Last Post: tubwux
  [Request] Compile this code please dozsa0 4 4,120 08-10-2013, 21:02
Last Post: Nukem
  Compile this code please First_Semyon 12 9,618 08-08-2013, 14:53
Last Post: Bandarigoda123
  Compile please this code First_Semyon 8 5,601 07-28-2013, 01:52
Last Post: First_Semyon
  Code of vector Bloodfocus 1 2,394 06-23-2013, 11:54
Last Post: Yamato
  problem with gsc code CheGuevara 5 5,582 04-20-2013, 15:06
Last Post: Nekochan
Tongue [Request] read if you have a cs:go code:) rawr-saours 5 4,035 04-05-2013, 18:15
Last Post: SuperNovaAO

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.