xabbo-scripts/Scripts/MoveUserTo.csx
Administrator 7a548130a3 Move all scripts into Scripts/ subfolder
Keeps the repo root clean - only README.md visible on landing page.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 09:49:37 +01:00

39 lines
1.2 KiB
C#

int? selectedUserId = null;
bool waitingForTileClick = false;
OnIntercept(Out["GetSelectedBadges"], e => {
int userId = e.Packet.ReadInt();
selectedUserId = userId;
waitingForTileClick = true;
var user = Users.FirstOrDefault(u => u.Id == userId);
if (user != null) {
Log($"Selected user ID: {userId}, Index: {user.Index}");
}
e.Block();
});
OnIntercept(Out["Move"], e => {
if (waitingForTileClick && selectedUserId.HasValue) {
int x = e.Packet.ReadInt();
int y = e.Packet.ReadInt();
var user = Users.FirstOrDefault(u => u.Id == selectedUserId);
if (user != null) {
int userIndex = user.Index;
Log($"Teleporting user Index: {userIndex} to position: {x}, {y}");
Send(Out["WiredSetObjectVariableValue"], 1, userIndex, "-270", userIndex);
Delay(250);
Send(Out["WiredSetObjectVariableValue"], 1, userIndex, "-230", x);
Delay(250);
Send(Out["WiredSetObjectVariableValue"], 1, userIndex, "-231", y);
}
selectedUserId = null;
waitingForTileClick = false;
e.Block();
}
});
Log("User teleport script started.");
Wait();