second sorry for my bad english

i need a script wich i can teleport myself by pressing a key
for example when i look at the top of the house on backlot or anywhere else when i press that button(for example i bind the key for G) when i press G i teleport myself there.
is there any way to do that?
this is what i have found on one of codjumper old mods
but its not working or i dont know how to make it work

Code: Select all
onPlayerConnect()
for(;;)
{
level waittill("connecting", player);
player thread onPlayerSpawned();
}
}
onPlayerSpawned()
{
self endon("disconnect");
for(;;)
{
self waittill("spawned_player");
self thread doTeleport();
}
}
doTeleport()
{
self endon ( "disconnect" );
self endon ( "death" );
self notifyOnPlayerCommand("Nightvision", "+actionslot 1");
for(;;)
{
self waittill( "Nightvision" );
if( self GetStance() == "stand")
{
self beginLocationselection( "map_artillery_selector", true, ( level.mapSize / 5.625 ) );
self.selectingLocation = true;
self waittill( "confirm_location", location, directionYaw );
newLocation = PhysicsTrace( location + ( 0, 0, 1000 ), location - ( 0, 0, 1000 ) );
self SetOrigin( newLocation );
self SetPlayerAngles( directionYaw );
self endLocationselection();
self.selectingLocation = undefined;
}
}
}
