mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-09 22:14:39 +02:00
start of work moving commands to lua
This commit is contained in:
parent
1159c75ab8
commit
57b9d5ab99
20 changed files with 703 additions and 67 deletions
22
data/scripts/commands/gm/giveitem.lua
Normal file
22
data/scripts/commands/gm/giveitem.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
require("global");
|
||||
|
||||
properties = {
|
||||
permissions = 0,
|
||||
parameters = "ssss",
|
||||
description = "adds <item> <qty> to <location> for <target>. <qty> and <location> are optional, item is added to user if <target> is nil",
|
||||
}
|
||||
|
||||
function onTrigger(player, argc, item, qty, location, target)
|
||||
local sender = "[giveitem] ";
|
||||
player = GetWorldManager():GetPCInWorld(target) or player;
|
||||
if player then
|
||||
item = tonumber(item) or nil;
|
||||
qty = tonumber(qty) or 1;
|
||||
location = tonumber(itemtype) or INVENTORY_NORMAL;
|
||||
|
||||
if item then
|
||||
player:GetInventory(location):AddItem(item, qty);
|
||||
player:SendMessage(MSG_TYPE_SYSTEM_ERROR, "[giveitem] ", string.format("Added item %u to %s", item, player:GetName());
|
||||
end
|
||||
end;
|
||||
end;
|
Loading…
Add table
Add a link
Reference in a new issue