[Talkactions] Make item on position command!
Hello!
I made simple script to make item on a select title
Example:
I'm in pos 100,100,7
and i need to make Magic Plate Armor on position 164,247,8
I'm using
!makeitem "2472, 1, 164 247 8
-- !makeitem "ITEMID, COUNT OF ITEM, POS_X, POS_Y, POS_Z
script made by me.
make new file newitem.lua in data/talkactions/scripts folder and put into file this code:
talkactions.XML
edit talkactions.xml in data/talkactions folder and put under "<talkactions>"
Thanks you!
Your's,
ersiu!
Hello!
I made simple script to make item on a select title
Example:
I'm in pos 100,100,7
and i need to make Magic Plate Armor on position 164,247,8
I'm using
!makeitem "2472, 1, 164 247 8
-- !makeitem "ITEMID, COUNT OF ITEM, POS_X, POS_Y, POS_Z
script made by me.
make new file newitem.lua in data/talkactions/scripts folder and put into file this code:
Code:
-- Make Item on Pos Talkaction by ersiu!
-- !makeitem "itemid, count, posx posy posz
-- EXAMPLE:
-- !makeitem "2472, 1, 42 65 7
function onSay(cid, words, param)
local access = 3 -- access do uzywania komendy!
if(getPlayerAccess(cid) >= access)then
local item={}
local info = {'f1' = string.find(param, ','), 'itemid' = string.sub(param, 0, info.f1-1), 'countn' = string.sub(param, info.f1+1, string.len(param)), 'c1' = string.find(info.countn, ','), 'count' = string.sub(info.c1, 0, info.c1-1), 'topos' = string.sub(info.c1, info.c1+1, string.len(info.countn)), 'pos' = string.sub(info.topos, info.f1+1, string.len(info.topos)), 'f2' = string.find(info.pos, ' '), 'p1' = string.sub(info.pos, 0, info.f2-1), 'pos2' = string.sub(info.pos, info.f2+1, string.len(info.pos)), 'f2' = string.find(info.pos2, ' '), 'p2' = string.sub(info.pos2, 0, info.f2-1), 'p3' = string.sub(info.pos2, info.f3+1, string.len(info.pos2))}
item.itemid = info.itemid
item.count = info.count
item.x = info.p1
item.y = info.p2
item.z = info.p3
ground = getThingfromPos({x=item.x, y=item.y, z=item.z, stackpos=0})
if(ground.itemid ~= nil)then
if(item.itemid ~= nil and item.count ~= nil && item.x > 0 and item.y > 0 and item.z > 0)then
doCreateItem(item.itemid, item.count, {x=item.x, y=item.y, z=item.z})
else
doPlayerSendCancel(cid, 'Sorry cannot make a new item!')
else
doPlayerSendCancel(cid, 'Sorry, title don\'t found')
end
else
doPlayerSendCancel(cid, 'Sorry, you cannot execute this command.')
end
end
edit talkactions.xml in data/talkactions folder and put under "<talkactions>"
Code:
<talkaction words="!makeitem" script="newitem.lua" />
Your's,
ersiu!
Last edited: