Hello everyone!
We present to you a fully working, simple, and easy-to-understand teleportation menu for players.
đź”§ Features:
After leaving the garage, type the command !teleport to open the teleportation window.
In the window, you'll see a list of available locations to choose from.
When a player clicks on a location name:
They will be instantly teleported to that location.
The teleport menu will automatically close.
Created by: Bass_Driver
We present to you a fully working, simple, and easy-to-understand teleportation menu for players.
đź”§ Features:
After leaving the garage, type the command !teleport to open the teleportation window.
In the window, you'll see a list of available locations to choose from.
When a player clicks on a location name:
They will be instantly teleported to that location.
The teleport menu will automatically close.
Created by: Bass_Driver
CatchEvent OnLapperStart()
GlobalVar $SpawnLocation;
# X , Y , Z, Flag(do not change), Heading of vehicle
$SpawnLocation[1] = "286.25,-984.5,11.89,128,55";
$SpawnLocation[2] = "126.56,-1087.62,14.62,128,-101";
$SpawnLocation[3] = "283.81,-988.25,11.92,128,55";
$SpawnLocation[4] = "190.56,-80.74,7.64,128,20";
$SpawnLocation[5] = "-284.5,-295.81,21.77,128,-101";
EndCatchEvent
CatchEvent OnMSO( $userName, $text ) # Player event
$idxOfFirtsSpace = indexOf( $text, " ");
IF( $idxOfFirtsSpace == -1 ) THEN
$command = $text;
$argv = "";
ELSE
$command = subStr( $text,0,$idxOfFirtsSpace );
$argv = trim( subStr( $text,$idxOfFirtsSpace ) );
ENDIF
SWITCH( $command )
CASE "!teleport":
OpenTeleportWindow($userName);
BREAK;
ENDSWITCH
EndCatchEvent
Sub OpenTeleportWindow($userName)
#Background
OpenPrivButton("Teleportwindow_bgd",70,65,60,32,5,-1,32, "");
#Buttons of locations.
OpenPrivButton("Teleportwindow_Loc_1",71,66,58,6,5,-1,16, "^0Location 1",TeleportPlayer);
OpenPrivButton("Teleportwindow_Loc_2",71,72,58,6,5,-1,16, "^0Location 2",TeleportPlayer);
OpenPrivButton("Teleportwindow_Loc_3",71,78,58,6,5,-1,16, "^0Location 3",TeleportPlayer);
OpenPrivButton("Teleportwindow_Loc_4",71,84,58,6,5,-1,16, "^0Location 4",TeleportPlayer);
OpenPrivButton("Teleportwindow_Loc_5",71,90,58,6,5,-1,16, "^0Location 5",TeleportPlayer);
EndSub
Sub TeleportPlayer($keyflags,$id)
$userName = Getcurrentplayervar("UserName");
#trim the first 19 characters of the buttonID ("Teleportwindow_Loc_")
$SelectedLocation = trim( subStr( $id,19 ));
$SplittedValues = SplitToArray($SpawnLocation[ToNum($SelectedLocation)],",");
#Give values of the array a readable name.
$X = $SplittedValues[0];
$Y = $SplittedValues[1];
$Z = $SplittedValues[2];
$Flag = $SplittedValues[3];
$Heading = $SplittedValues[4];
#JRR Spawn request.
joinrequest(ToNum($X),ToNum($Y),ToNum($Z),ToNum($Flag),ToNum($Heading),GetPlayerVar($userName,"UCID"),GetPlayerVar($userName,"PLID"),4); #Spawn Player to the selected location with vehiclereset
# Close window after teleport
closePrivButton("Teleportwindow_bgd&Teleportwindow_Loc_1&Teleportwindow_Loc_2&Teleportwindow_Loc_3&Teleportwindow_Loc_4&Teleportwindow_Loc_5");
EndSub