forked from cuberite/Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathitem.lua
More file actions
33 lines (28 loc) · 749 Bytes
/
item.lua
File metadata and controls
33 lines (28 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function HandleItemCommand( Split, Player )
if ((#Split ~= 2) and (#Split ~=3) and (#Split ~=4) and (#Split ~=5)) then
SendMessage( Player, "Usage: /i <item>[:meta] [amount] [custom name] [lore]" )
SendMessage( Player, "The newline character for lore is \"`\"")
return true
end
local itemSplit = StringSplit(Split[2], ":")
local newSplit = {}
newSplit[1] = "/give"
newSplit[2] = Player:GetName()
newSplit[3] = itemSplit[1]
if Split[3] ~= nil then
newSplit[4] = Split[3]
else
newSplit[4] = 1
end
if itemSplit[2] ~= nil then
newSplit[5] = itemSplit[2]
end
if Split[4] ~= nil then
newSplit[6] = Split[4]
end
if Split[5] ~= nil then
newSplit[7] = Split[5]
end
HandleGiveCommand( newSplit, Player )
return true
end