From c76053344ea22a030e88ecd50e899c5fafe7840c Mon Sep 17 00:00:00 2001 From: Alejandro Akbal <37181533+VoidlessSeven7@users.noreply.github.com> Date: Sat, 18 Apr 2020 20:34:25 +0200 Subject: [PATCH] Added code --- src/Commands/Player/Give.gml | 20 ++++++++++++++++++++ src/Main.gml | 8 ++++++++ src/Util/Util.gml | 8 ++++++++ src/fmConfig.json | 6 ++++++ 4 files changed, 42 insertions(+) create mode 100644 src/Commands/Player/Give.gml create mode 100644 src/Main.gml create mode 100644 src/Util/Util.gml create mode 100644 src/fmConfig.json diff --git a/src/Commands/Player/Give.gml b/src/Commands/Player/Give.gml new file mode 100644 index 0000000..d9ac101 --- /dev/null +++ b/src/Commands/Player/Give.gml @@ -0,0 +1,20 @@ +#define GiveItemCommand + CommandCreate("giveItem", 0, ScriptWrap(GiveItem), "item_ID", "quantity"); + +#define GiveItem(_args) +/// @desc Gives said item to the player + + if (!InGame()) return Trace(global.notInGameMessage) + + var _item, _quantity; + + // Assign values + _item = real(_args[0]); + _quantity = real(_args[1]); + + // Give Item + GainItem(_item, _quantity); + + // Message + Trace("Received " + string(_quantity) + " " + string(ItemGet(_item, ItemData.Name))); + \ No newline at end of file diff --git a/src/Main.gml b/src/Main.gml new file mode 100644 index 0000000..5e465b7 --- /dev/null +++ b/src/Main.gml @@ -0,0 +1,8 @@ +#define Main + +// Global +globalMessages() + +// Player +GiveItemCommand() + diff --git a/src/Util/Util.gml b/src/Util/Util.gml new file mode 100644 index 0000000..0e4ea44 --- /dev/null +++ b/src/Util/Util.gml @@ -0,0 +1,8 @@ +#define globalMessages + global.notInGameMessage = "You can only use this command when in-game!"; + global.invalidArgCountMessage = "Invalid number of arguments!"; + global.invalidArg = "Invalid argument!"; + +#define InGame + return room != rmMainMenu; + \ No newline at end of file diff --git a/src/fmConfig.json b/src/fmConfig.json new file mode 100644 index 0000000..0e72029 --- /dev/null +++ b/src/fmConfig.json @@ -0,0 +1,6 @@ +{ + "name": "Cheater", + "author": "76561198068082688", + "targetAPIVersion": "1.0.0", + "dependencies": [] +} \ No newline at end of file