• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

Custom Teleport Command

Darthye

Enthusiast
Sup EmuDevs, just finished an easy script after 15 minutes of work and wanted to release it here.
Basically, this script will allow you to use the command .customteleport to teleport in-game yourself to the coords defined in the script.

Code:
/*
Made by: Darthye
Script complete: 100%
Command: .customteleport
*/

#include "ScriptPCH.h"
#include "Chat.h"
#include "BattlegroundMgr.h"
#include "Player.h"
	    
class custom_teleport_command : public CommandScript
{
public:
    custom_teleport_command() : CommandScript("custom_teleport_command") { }
     
        ChatCommand* GetCommands() const
    {
        static ChatCommand IngameCommandTable[] =
        {
        { "customteleport",           SEC_PLAYER,         true,  &HandleTeleportCommand,                "", NULL },
        { NULL,             0,                  false, NULL,                              "", NULL }
        };
        return IngameCommandTable;
    }
     
        static bool HandleTeleportCommand(ChatHandler * handler, const char * args)
    {
	    Player * player = handler->GetSession()->GetPlayer();
	    if (player->IsInCombat())
        {
            handler->PSendSysMessage("Cant do this in combat.");
            return true;
        }
		
	    if (player->GetMap()->IsBattlegroundOrArena())
        {
            handler->PSendSysMessage("Cant do this in BG/Arena.");
            return true;
        }
		
	    if (player->IsInFlight())
        {
            handler->PSendSysMessage("Cant do this in flight.");
            return true;
        }
		
	    if (player->HasStealthAura() || player->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH) || player->isDead())
        {
            handler->PSendSysMessage("Cant do this at the moment.");
            return true;
        }		
		
	    player->TeleportTo(0, -10438.8f, -1932.75f, 104.617f, 4.77402f); // MapID, CoordX, CoordY, CoordZ, Orientation
            return true;
    }
};
     
void AddSC_custom_teleport_command()
{
    new custom_teleport_command();
}

Hope you enjoy it!
 
Last edited:

Neth

BETA Tester
missing important checks like if player is alive, in combat etc ( people will abuse it )
 

Darthye

Enthusiast
Sorry for "bumping" again, but:

-Added arena check
-Added Stealth check (rogues)
-Fixed error that made in the case of the checks return the message + an incorrect syntax message.

Definetely finished 100%

Thanks for reading!
 
Top