data/actions/actions.xml, add:
data/actions/scripts, create donpoints.lua and put this code into it:
Now, create a lever with the id 10029 and put actionid 51515.
I know you can make the code much better. I'm not so good with lua so I dunno how to do it.
Created this because bybbzan requested it here: http://otland.net/f132/change-donate-items-into-points-187791/
Rep++? eace:
XML:
<action actionid="51515" event="script" value="donpoints.lua"/>
data/actions/scripts, create donpoints.lua and put this code into it:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition) -- Eazy M
local donation_ids = {2352, 8904, 2456} --donation ids
local position = getThingfromPos({x=1066, y=1111, z=7, stackpos=1}) -- position to put the items on
function changeIntoPoints()
if (isInArray(donation_ids, position.itemid)) then
if doRemoveItem(position.uid,1) then
local points = 5 -- how much points to receive
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. points .. " WHERE `id` = " .. getPlayerAccountId(cid))
doPlayerSendCancel(cid, "You received " .. points .. " point(s).")
else
doPlayerSendCancel(cid, "Could not remove the item.")
end
else
doPlayerSendCancel(cid, "Donation item not found.")
end
end
if item.itemid == 10029 then
changeIntoPoints()
doTransformItem(item.uid, item.itemid + 1)
end
if item.itemid == 10030 then
changeIntoPoints()
doTransformItem(item.uid, item.itemid - 1)
end
return true
end
Now, create a lever with the id 10029 and put actionid 51515.
I know you can make the code much better. I'm not so good with lua so I dunno how to do it.
Created this because bybbzan requested it here: http://otland.net/f132/change-donate-items-into-points-187791/
Rep++? eace: