From 8a3610d9ac8349877b7a023a417288c2daee14ba Mon Sep 17 00:00:00 2001 From: piernov Date: Sun, 24 Apr 2016 22:05:25 +0200 Subject: Add sendError() PHP error message helper --- inc/messages.inc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 inc/messages.inc diff --git a/inc/messages.inc b/inc/messages.inc new file mode 100644 index 0000000..f1ca8b3 --- /dev/null +++ b/inc/messages.inc @@ -0,0 +1,15 @@ + "You have already built a shop.", + "gold_insufficient" => "You don't have enough gold.", + "shop_missing_item" => "This item does not exist.", +); + +function sendError($msg) { + global $messages; + $text = $messages[$msg]; + echo json_encode(array("error" => $text)); +} + +?> -- cgit v1.2.3-70-g09d2