123456789101112131415161718192021222324252627 |
- #include "server/commands/DefaultCommands.h"
- #include "common/network/Packets.h"
- #include "server/Game.h"
- #include "server/GameServer.h"
- #include "server/commands/Commands.h"
- static void commandStop(const Commands::Arguments&) {
- Game::stop();
- }
- static void commandSay(const Commands::Arguments& args) {
- StringBuffer<256> s;
- for(int i = 1; i < args.getLength(); i++) {
- s.append(args[i]);
- s.append(' ');
- }
- OutPacket out = OutPacket::reliable(260);
- out.writeU16(Packets::S_CHAT);
- out.writeString(s);
- GameServer::sendToAll(out);
- puts(s);
- }
- void DefaultCommands::init() {
- Commands::add("stop", commandStop);
- Commands::add("say", commandSay);
- }
|