mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-09 05:54:50 +02:00
more work on commands
- moved script object to wrapper class to catch and log exceptions - added loggers for basepacket/subpacket (todo: colour and use them in NLog.config) - finished up most commands (todo: !property and !property2) - todo: create and use mysql wrapper class to log exceptions
This commit is contained in:
parent
57b9d5ab99
commit
1ad2b5d7d0
35 changed files with 780 additions and 958 deletions
37
data/scripts/commands/gm/delkeyitem.lua
Normal file
37
data/scripts/commands/gm/delkeyitem.lua
Normal file
|
@ -0,0 +1,37 @@
|
|||
require("global");
|
||||
|
||||
properties = {
|
||||
permissions = 0,
|
||||
parameters = "ssss",
|
||||
description = "removes <keyitem> <qty> from <target>, keyitem is removed from user if <target> is nil",
|
||||
}
|
||||
|
||||
function onTrigger(player, argc, keyitem, qty, name, lastName)
|
||||
local sender = "[delkeyitem] ";
|
||||
|
||||
if name then
|
||||
if lastName then
|
||||
player = GetWorldManager():GetPCInWorld(name.." "..lastName) or nil;
|
||||
else
|
||||
player = GetWorldManager():GetPCInWorld(name) or nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
if player then
|
||||
keyitem = tonumber(keyitem) or nil;
|
||||
qty = 1;
|
||||
location = INVENTORY_KEYITEMS;
|
||||
|
||||
local removed = player:GetInventory(location):removeItem(item, qty);
|
||||
local messageID = MESSAGE_TYPE_SYSTEM_ERROR;
|
||||
local message = "unable to remove keyitem";
|
||||
|
||||
if keyitem and removed then
|
||||
message = string.format("removed keyitem %u from %s", keyitem, player:GetName());
|
||||
end
|
||||
player:SendMessage(messageID, sender, message);
|
||||
print(message);
|
||||
else
|
||||
print(sender.."unable to remove keyitem, ensure player name is valid.");
|
||||
end;
|
||||
end;
|
Loading…
Add table
Add a link
Reference in a new issue