[JS] PlayerTeleport

xEnt

Retired Staff
Retired Staff
Sep 6, 2014
48
17
8
You will need to uncomment the part that stops JS plugins from loading then rebuild Pluton. this will be done automatically soon.

Usage:
/tpr <full or partial player name> - sends a teleport request to the target players location
/tpa - accepts the last person who requested a teleport to them.

JavaScript:
function On_Command(cmd){
    if(cmd.cmd == "tpr") {
        name = cmd.quotedArgs[0];
        if(name == null || name == "")
            return;
        for(i=0; i < Server.ActivePlayers.Count; i++) {
            target = Server.ActivePlayers[i];
            if(target.Name.indexOf(name) != -1) {
                target.Message(cmd.User.Name + " would like to Teleport to you. /tpa to Accept");
                cmd.User.Message("Teleport request sent to " + target.Name + "!");
                DataStore.Add("Pluton_TP", target.GameID, cmd.User);
                return;
            }
        }
        cmd.User.Message("Could not find user: " + name);

    } else if(cmd.cmd == "tpa") {
        player = DataStore.Get("Pluton_TP", cmd.User.GameID);
        if(player != null) {
            DataStore.Remove("Pluton_TP", cmd.User.GameID);
            player.Teleport(cmd.User.X, cmd.User.Y, cmd.User.Z);
            player.Message("You have been Teleported to " + cmd.User.Name + "!");
            cmd.User.Message(player.Name + " has been Teleported to you!");
        } else
            cmd.User.Message("Invalid Player - Requester may have disconnected!");
    }
}
 
Last edited by a moderator: