Built-in commands
#3
Code:
bool cServer::Command( cClientHandle & a_Client, const char* a_Cmd )
{
    cPluginManager* PM = cRoot::Get()->GetPluginManager();
    if( PM->CallHook( cPluginManager::E_PLUGIN_CHAT, 2, a_Cmd, a_Client.GetPlayer() ) )
        return true;

    std::string Command( a_Cmd );
    if( Command.length() <= 0 ) return false;
    if( Command[0] != '/' ) return false;

    std::vector< std::string > split = StringSplit( Command, " " );
    if( split.size() == 0 )
        return false;

    if( split[0].compare("/coords") == 0 )
    {
        char c_Str[128];
        sprintf_s( c_Str, 128, "[X:%0.2f] [Y:%0.2f] [Z:%0.2f]", a_Client.GetPlayer()->GetPosX(), a_Client.GetPlayer()->GetPosY(), a_Client.GetPlayer()->GetPosZ() );
        a_Client.Send( cPacket_Chat( cChatColor::Green + c_Str ) );
        return true;
    }
    return false;
}

This isn't lua by any means. Taken from cServer.cpp
Reply
Thanks given by:


Messages In This Thread
Built-in commands - by cedeel - 12-29-2011, 11:33 AM
RE: Built-in commands - by Kwen - 12-29-2011, 12:08 PM
RE: Built-in commands - by cedeel - 12-29-2011, 12:14 PM
RE: Built-in commands - by Lapayo - 12-29-2011, 01:20 PM
RE: Built-in commands - by FakeTruth - 12-29-2011, 08:24 PM



Users browsing this thread: 1 Guest(s)