Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/game.cc23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/game/game.cc b/src/game/game.cc
index ea72ce0..79c9040 100644
--- a/src/game/game.cc
+++ b/src/game/game.cc
@@ -99,16 +99,31 @@ void func_buy(core::Player *player, std::string const &args)
core::server()->broadcast("^B" + player->name() + " ^Bpurchased " + aux::article(shipmodel->name()));
player->player_dirty = true;
} else {
- core::server()->send(player, "Usage: buy <" + helpstr + "^N>");
+ core::server()->send(player, "Usage: buy [" + helpstr + "^N]");
}
}
/// a player sends standard hails
void func_hail(core::Player *player, std::string const &args)
{
- core::server()->send(player, "You broadcast a standard standard hail.");
- core::server()->broadcast("^B" + player->name() + " ^Bbroadcasts a standard hail!", player);
- core::server()->broadcast_sound("com/hail");
+ std::string target;
+ std::istringstream is(args);
+ if (!(is >> target)) {
+ core::server()->send(player, "Usage: hail [player]");
+ return;
+ }
+
+ core::Player *targetplayer = core::server()->find_player(target);
+ if (!targetplayer) {
+ core::server()->send(player, "Player " + target + "^N not found.");
+ return;
+ }
+
+ core::server()->send(player, "^BYou hail " + targetplayer->name() + "^B.");
+ core::server()->send_sound(player, "com/hail");
+
+ core::server()->send(targetplayer, "^B" + player->name() + "^B hails you!");
+ core::server()->send_sound(targetplayer, "com/hail");
}
/*----- Game ------------------------------------------------------ */