Skip to content

Commit

Permalink
Added code
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Apr 18, 2020
1 parent 47ce13d commit c760533
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Commands/Player/Give.gml
Original file line number Diff line number Diff line change
@@ -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)));

8 changes: 8 additions & 0 deletions src/Main.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#define Main

// Global
globalMessages()

// Player
GiveItemCommand()

8 changes: 8 additions & 0 deletions src/Util/Util.gml
Original file line number Diff line number Diff line change
@@ -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;

6 changes: 6 additions & 0 deletions src/fmConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "Cheater",
"author": "76561198068082688",
"targetAPIVersion": "1.0.0",
"dependencies": []
}

0 comments on commit c760533

Please sign in to comment.