i know im late af but i thought why not someone out there probably need this xD
First of all you need to create the first positions you would call it the first gate
Green = map name
Red = position
and yeah that only 2 examples you have to do it with every map.
Code:
TeleportPositions()
{
switch( level.CurMap )
{
case "mp_afghan":
level.teleports["mp_afghan"] = [];
level.teleports["mp_afghan"][0] = (3968, 1214, 197);
break;
case "mp_derail":
level.teleports["mp_derail"] = [];
level.teleports["mp_derail"][0] = (-1371, 2197, 227);
level.teleports["mp_derail"][1] = (1129, 57, 223);
break;
}
}
second step is to create the outcome locations
this is the same code but instead of level.teleports it is level.locations
Code:
TeleportLocation()
{
switch( level.CurMap )
{
case "mp_afghan":
level.locations["mp_afghan"] = [];
level.locations["mp_afghan"][0] = (3867, 1408, 347);
break;
case "mp_derail":
level.locations["mp_derail"] = [];
level.locations["mp_derail"][0] = (-1347, 2157, 507);
level.locations["mp_derail"][1] = (1247, 89, 529);
break;
}
}
next step the main code
Code:
doTeleport()
{
level endon( "disconnect" );
while( isDefined( level.teleports[level.CurMap] ) )
{
wait 0.01;
foreach( player in level.players )
{
for( bCount = 0; bCount < level.teleports[level.CurMap].size; bCount++ )
{
self.pers["Position"] = level.locations[level.CurMap][bCount];
if( !isDefined( level.teleports[level.CurMap][bCount] ) )
continue;
if( isDefined( level.teleports[level.CurMap]["radius"][bCount] ) )
{
player.bRadius = level.teleports[level.CurMap]["radius"][bCount];
}
else
{
level.teleports[level.CurMap]["radius"][bCount] = 80;
player.bRadius = level.teleports[level.CurMap]["radius"][bCount];
}
if( distance( player.origin, level.teleports[level.CurMap][bCount] ) <= player.bRadius && player.origin[2] - level.teleports[level.CurMap][bCount][2] <= 25 )
{
self setOrigin( self.pers["Position"] );
}
}
}
}
}
just copy and paste this one and after that the only thing left is to thread everything on onPlayerConnect
Code:
level.CurMap = getDvar( "mapname") ;
self thread TeleportPositions();
self thread TeleportLocation();
self thread doTeleport();