The online racing simulator
Spawn point selection Just a Drive similar system
Hello everyone

My team and I have now finished the infrastructure of the system that allows you to choose a spawn place, just like when you exit Pit on Lapper version 7.0.7.0 on Just a Drive server And there is no similar System in my country Smile (Version 6R, 7D in the future) The system is working now but As in the picture, it seems like JOIN REQUEST must be at the bottom because even if the two swap places, it doesn't teleport to the place I want. Is this a self problem or can it be optimized?


Thanks to everyone who has helped so far


In addition, I would like to invite experts in this field to my 7d server for testing. In my country, we are 2-3 people who develop almost comprehensive lapper
Attached images
Ekran görüntüsü 2023-08-06 234901.png
uWuu Perfect 👍 Turkey Lapper Man Deeveloploplop yess yyes yes prsskibi developloplop
Quote from Androphp :uWuu Perfect 👍 Turkey Lapper Man Deeveloploplop yess yyes yes prsskibi developloplop

Maybe after you Big grin
ahh , i don't know . im noob
I prevent the player from leaving the pit and I open a button on his screen, but I cannot remove him from the pit when I click on the button
help pls
Hello. So, does anyone already have code prepared for a teleportation function?
I've searched the entire internet and it seems like there's nothing publicly available. The only thing I found was something made by Bass_Driver – a teleport, but I think it's more for admins to move players around. That's not exactly what I'm looking for. The most similar system is on the "Just a Ride" server.

Is this system so complicated that no one has made it for public use?
I'm looking for something where, for example, at any time you can type !teleport, and a window opens allowing you to choose where on the map you want to be teleported.
** Best answer **
Hello

I've made an examplecode to this kind of system.
If you know the X and Y coordinates of the location, then you could edit the x and Y coords below.

This code doesnt have a close button.

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
$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
EndSub

Thank you very, very, very much Smile 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 Big grin 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 Big grin we just need to read your posts Big grin

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

Thank you for the very kind words.

Nice to see a another LFSLapper user on the forum. Big grin

I'm happy that the "example script" was usefull and thank you for update. Maybe you update it even more and create an topic on the finished scripts forum.

FGED GREDG RDFGDR GSFDG