Elwyn
Well-Known Member
- Joined
- Aug 24, 2014
- Messages
- 212
- Reaction score
- 76
Use it just like /r, put the item in the tile you're facing and say /aid number
Create a file named set_actionid.lua on talkactions/scripts and put the following code:
On talkactions.xml put:
Create a file named set_actionid.lua on talkactions/scripts and put the following code:
Code:
function onSay(cid, words, param)
local player = Player(cid)
if not player then
return false
end
if not player:getGroup():getAccess() then
return true
end
if not tonumber(param) then
player:sendCancelMessage("Need a number param.")
return false
end
local position = player:getPosition()
position:getNextPosition(player:getDirection())
local tile = Tile(position)
if not tile then
player:sendCancelMessage("Object not found.")
return false
end
local thing = tile:getTopVisibleThing(player)
if not thing then
player:sendCancelMessage("Thing not found.")
return false
end
if thing:isCreature() then
player:sendCancelMessage("You can't give an action id to a creature.")
elseif thing:isItem() then
local actionid = tonumber(param)
if actionid <= 0 then
thing:removeAttribute(ITEM_ATTRIBUTE_ACTIONID)
else
thing:setActionId(actionid)
end
end
position:sendMagicEffect(CONST_ME_MAGIC_RED)
return false
end
On talkactions.xml put:
Code:
<talkaction words="/aid" separator=" " script="set_actionid.lua" />