Local item = 2444 -- Change this number to whatever the id of the item u want to remove.
local points = 100 -- Change this to how many points you want to add.
local effect = 56 -- change that to the effect you want to have given after using.
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerItemCount(cid,item) < 1 then
return doPlayerSendCancel(cid,"You dont have a "..getItemNameById(item)..".")
end
if (getPlayerItemCount(cid,item) == 1) then
if (getPlayerSlotItem(cid, itemslot).itemid == item) then
return doSendMagicEffect(getThingPos(cid),2) and doCreatureSay(cid,"You are wearing that item ",TALKTYPE_MONSTER)
end
return doPlayerRemoveItem(cid, item, getPlayerItemCount(cid,item)) and doSendMagicEffect(getThingPos(cid),40) and doPlayerAddMoney(cid,cost) and doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"Yo u have sold a "..getItemNameById(item).." for "..cost.." gold coins")
end
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. points .. " WHERE `name` = '" .. getAccountByName(getCreatureName(itemEx.uid)) .. "' LIMIT 1;")
doCreatureSay(cid, "You have received " .. points .. " premium points!", TALKTYPE_ORANGE_1, false, nil, toPosition)
doSendMagicEffect(toPosition, effect)
return true
end