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.
Hope you enjoy it!
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: