diff options
author | Philipp Sehmisch <mana@crushnet.org> | 2010-12-17 20:47:11 +0100 |
---|---|---|
committer | Philipp Sehmisch <mana@crushnet.org> | 2010-12-17 20:47:11 +0100 |
commit | 3f559162b2e3cb0b434095d0bac297f67ff53d86 (patch) | |
tree | dfa61e2907ca26b37992604adc00abfb22d60083 /src/game-server/commandhandler.cpp | |
parent | 7e6e1012ebbf96f8e0ca149304ef970b4a55e2dd (diff) | |
download | manaserv-3f559162b2e3cb0b434095d0bac297f67ff53d86.tar.gz manaserv-3f559162b2e3cb0b434095d0bac297f67ff53d86.tar.bz2 manaserv-3f559162b2e3cb0b434095d0bac297f67ff53d86.tar.xz manaserv-3f559162b2e3cb0b434095d0bac297f67ff53d86.zip |
Implemented @die chat command
The @die chat command kills the evoking character by setting its hit
points to 0. The example permissions.xml assigns it to the "tester"
rights group and not "players" because server admins who are not aware
of this command might run into trouble when they assume that players
don't have a method to teleport to their spawn point voluntarily.
Resolves: mantis ticket #192
Reviewed-by: Jaxad0127
Diffstat (limited to 'src/game-server/commandhandler.cpp')
-rw-r--r-- | src/game-server/commandhandler.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/game-server/commandhandler.cpp b/src/game-server/commandhandler.cpp index 5bd6a04f..1daa6acc 100644 --- a/src/game-server/commandhandler.cpp +++ b/src/game-server/commandhandler.cpp @@ -67,6 +67,7 @@ static void handleTakePermission(Character*, std::string&); static void handleAnnounce(Character*, std::string&); static void handleHistory(Character*, std::string&); static void handleMute(Character*, std::string&); +static void handleDie(Character*, std::string&); static CmdRef const cmdRef[] = { @@ -110,6 +111,8 @@ static CmdRef const cmdRef[] = "Shows the last transactions", &handleHistory}, {"mute","<character> <length in seconds>", "Prevents the character from talking for the specified number of seconds. Use 0 seconds to unmute.", &handleMute}, + {"die", "", + "Kills you.", &handleDie}, {NULL, NULL, NULL, NULL} }; @@ -1033,9 +1036,9 @@ static void handleHistory(Character *player, std::string &args) // TODO: Get args number of transactions and show them to the player } - static void handleMute(Character *player, std::string &args) -{ Character *other; +{ + Character *other; int length; // Get arguments. @@ -1086,6 +1089,12 @@ static void handleMute(Character *player, std::string &args) GameState::sayTo(player, NULL, userMsg.str()); } +static void handleDie(Character *player, std::string &args) +{ + player->setAttribute(ATTR_HP, 0); + GameState::sayTo(player, NULL, "You've killed yourself."); +} + void CommandHandler::handleCommand(Character *player, const std::string &command) { |