• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ NPC exchange storage points to premium points.

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:
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....
 
Back
Top