scarface77
New Member
- Joined
- Dec 12, 2008
- Messages
- 53
- Reaction score
- 1
hello I got VIP coins script (when you use it gives you 1 point to SQL database and the item dissapear) and it works good, but I want to make it able to use only if you have 10+ vip coins and it takes 10 vip voins and adds 10 points to SQL.
the script
the script
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid >= 1 then
local query = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
local points = query:getDataInt("premium_points")
db.executeQuery("UPDATE `accounts` SET `premium_points`= "..(points + 1).." WHERE `id`= " .. getPlayerAccountId(cid) .. "; ")
doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have added 1 points to site shop.")
end
doRemoveItem(cid, item.uid, 1)
return true
end