OTcreator
Active Member
- Joined
- Feb 14, 2022
- Messages
- 425
- Solutions
- 1
- Reaction score
- 44
Hi,
I am trying to make an NPC that converts mission points into premium points, with 5 mission points being 1 premium point.
I tried to do it this way:
I have an error in the console related to just sending information to the database....
I am trying to make an NPC that converts mission points into premium points, with 5 mission points being 1 premium point.
I tried to do it this way:
Lua:
local player = Player(cid)
local tstorage = 8005
local task = player:getStorageValue(tstorage)
local exchange = (task / 5)
local function doPlayerAddPremiumPoints(cid, count)
db.query('UPDATE accounts SET premium_points = premium_points+'.. count ..' WHERE id = ' .. getAccountNumberByPlayerName(getCreatureName(cid)))
end
if task >= 5 then
-- how do it when player have 103 points (= 20 premium points and 3 stay on storage?)
player:setStorageValue(tstorage, (task - (exchange * 5)))
doPlayerAddPremiumPoints(cid, exchange)
I have an error in the console related to just sending information to the database....