1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 05:57:45 +00:00
sapphire/scripts/native/debugcommands/Replay.cpp

29 lines
No EOL
809 B
C++

#include <ScriptObject.h>
#include <Session.h>
class Replay : public DebugCommandScript
{
public:
Replay() : DebugCommandScript( "replay", "Replays a saved capture", 1 )
{ }
virtual void run( Entity::Player& player, const std::string& data, const std::string& subCommand, const std::string& params )
{
if( subCommand == "start" )
{
auto pSession = m_objects->m_zone->getSession( player.getId() );
if( pSession )
pSession->startReplay( params );
}
else if( subCommand == "stop" )
{
auto pSession = m_objects->m_zone->getSession( player.getId() );
if( pSession )
pSession->stopReplay();
}
else
{
player.sendUrgent( subCommand + " is not a valid replay command." );
}
}
};