Thank you very, very, very much

Without your presence on this forum over the years, I probably wouldn’t have continued developing the server.. You’ve helped so many people with so many things (seeing your activity searching for info), created so much that it’s hard for me to imagine how much time and effort you’ve given so that others could use it for free... Really, thank you so much for your time, energy, and patience.. Half of the forum members should thank your parents for raising such a person

These days, there aren’t many decent people like you. With people like you on this forum, and all the knowledge you’ve built over many years, we definitely don’t need to be a programmer to create a server

we just need to read your posts
I udate your code that the window closes automatically when selecting any of the locations — maybe someone will find it useful someday.
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