• 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!

Solved VIP problems

HappyFeet

New Member
Joined
Nov 8, 2012
Messages
244
Reaction score
3
Location
Netherlands
can someone help me to make this to tfs 1.0?
Code:
function getPlayerVipDays(cid)
local Info = db.storeQuery("SELECT `vipdays` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
if Info:getID() ~= LUA_ERROR then
local days= Info:getDataInt("vipdays")
Info:free()
return days
end
return LUA_ERROR
end

function doAddVipDays(cid, days)
db.query("UPDATE `accounts` SET `vipdays` = `vipdays` + " .. days .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end

function doRemoveVipDays(cid, days)
db.query("UPDATE `accounts` SET `vipdays` = `vipdays` - " .. days .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end

I have add it to global.lua (tfs 1.0 functions) tried alot but no result:(
it keep saying error line xxx -> local Info = db.storeQuery("SELECT `vipdays` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
after I fixed that it wil give another error for the next line ->if Info:getID() ~= LUA_ERROR then
 
Code:
function getPlayerVipDays(cid)
  local rId = db.storeQuery('SELECT `vipdays` FROM `accounts` WHERE `id` = ' .. getPlayerAccountId(cid) .. ' LIMIT 1;')
  if rId then
    local days = result.getDataInt(rId, 'vipdays')
    result.free(rId)
    return days
  end
  return LUA_ERROR
end
 
Back
Top