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

Mock vip system (VIP by account)

Mock

Mock the bear (MTB)
Joined
Jul 29, 2008
Messages
619
Reaction score
106
Location
Brazil
Athos:
bearpaw.png

Distro: TFS 0.3.1++++
Version
: 1.0.0



By years i saw MANY vip systems, all systems has one fail, dont work better EVER have an erro on something, and some good vip systems of today its only for one player dont affect all account, Yes have another vip systems w ith account but here its mine (this its not the first and it's not the last its junts only an new one.). This is only an LIB not a sctipt like talk. So lets install it. Go to data/lib on your server, create vip sys.lua, go to data.lua and add it: dofile(getDataDir() .. "lib/vip sys.lua")
Now in vip sys.lua add it:
Lua:
vip = {
   name = "Vip system";
   author = "Mock";
   version = "1.0.0.0";
   query="ALTER TABLE `accounts` ADD `vip_time` INT( 15 ) NOT NULL"
}
function vip.setTable()
   db.executeQuery(vip.query)
end
function vip.getVip(cid)
         assert(tonumber(cid),'Parameter must be a number') 
         if isPlayer(cid) == FALSE then error('Player don\'t find') end; 
         ae =  db.getResult("SELECT `vip_time` FROM `accounts` WHERE `name` = "..getPlayerAccount(cid)..";")
         if ae:getID() == -1 then
            return 0
         end
         return ae:getDataInt("vip_time") or 0
end

function vip.getVipByAcc(acc)
         assert(acc,'Account is nil')
         local a = db.getResult("SELECT `vip_time` FROM `accounts` WHERE `name` = "..acc..";")
         if a:getID() ~= -1 then
             return a:getDataInt("vip_time") or 0
         else
             error('Account don\'t find.')
         end
end

function vip.setVip(cid,time)
         dofile("config.lua")
         assert(tonumber(cid),'Parameter must be a number')
         assert(tonumber(time),'Parameter must be a number')
         if isPlayer(cid) == FALSE then error('Player don\'t find') end; 
         db.executeQuery("UPDATE `"..sqlDatabase.."`.`accounts` SET `vip_time` = '"..(os.time()+time).."' WHERE `accounts`.`name` =".. getPlayerAccount(cid).." LIMIT 1 ;")
end

function vip.getVipByAccount(acc)
         assert(acc,'Account is nil')
         return db.getResult("SELECT `vip_time` FROM `accounts` WHERE `name` = "..acc..";"):getDataInt("vip_time") or 0
end                                      

function vip.hasVip(cid)
         assert(tonumber(cid),'Parameter must be a number')
         if isPlayer(cid) == FALSE then error('Player don\'t find') end;
         local t = vip.getVip(cid) or 0
         if os.time(day) < t then
            return TRUE
         else
            return FALSE
         end
end

function vip.accountHasVip(acc)
         assert(acc,'Account is nil')
         if os.time() < vip.getVipByAccount(acc) then
            return TRUE
         else
            return FALSE
         end
end
function vip.getDays(days)
   return (3600 * 24 * days)
end
function vip.addVipByAccount(acc,time)
   assert(acc,'Account is nil')
   assert(tonumber(time),'Parameter must be a number')
   local a = vip.getVipByAcc(acc)
   a = os.difftime(a,os.time())
   if a < 0 then a = 0 end;
   a = a+time
   return vip.setVipByAccount(acc,a)
end
function vip.setVipByAccount(acc,time)
         dofile("config.lua")
         assert(acc,'Account is nil')
         assert(tonumber(time),'Parameter must be a number')
         db.executeQuery("UPDATE `"..sqlDatabase.."`.`accounts` SET `vip_time` = '"..(os.time()+time).."' WHERE `accounts`.`name` ="..acc.." LIMIT 1 ;")
         return TRUE
end
function vip.returnVipString(cid)
   assert(tonumber(cid),'Parameter must be a number')
   if isPlayer(cid) == TRUE then
      return os.date("%d %B %Y %X ", vip.getVip(cid))
   end
end
Now...
You need execute function vip.setTable() ONLY ONE TIME, or enter on your DB and execute this query: ALTER TABLE `accounts` ADD `vip_time` INT( 15 ) NOT NULL
Now you server has an great vip system, and you need only do scripts.

If you find some error please post here.
Sorry for the bad english ^^
Example:
Lua:
function onSay(cid, words, param)
         if param == "" then
            return  doPlayerPopupFYI(cid,"Are you confused?\n Lear the commands!\n---------------\nADD vip:\n/vip add days player\n/vip add 30 mock\n---------------\nDel vip:\n/vip del player\n/vip del mock\n---------------\ncheck vip:\n/vip see player\n/vip see mock\n---------------\n")
         end
         if param:lower():find('add') == 1 and 3 then
            local ret = string.explode(param,' ',3)
            if #ret < 3 or tonumber(ret[2]) == nil or getPlayerByName(ret[3]) == false then
               return doPlayerSendTextMessage(cid,25,"Add vip:\n/vip add days player\n/vip add 30 mock\n")
            end
            vip.addVipByAccount( getPlayerAccount(getPlayerByName(ret[3])) ,vip.getDays(ret[2]))
            doPlayerSendTextMessage(cid,25,"Has benn added "..tonumber(ret[2]).." days to "..ret[3]..".")
            doPlayerSendTextMessage(getPlayerByName(ret[3]),25,"You recivied "..tonumber(ret[2]).." vip days!")
         elseif param:lower():find('del') == 1 and 3 then
            local ret = string.explode(param,' ',2)
            if #ret < 2 or getPlayerByName(ret[2]) == false then
               return doPlayerSendTextMessage(cid,25,"Del vip:\n/vip del player\n/vip del mock\n")
            end
            vip.setVipByAccount(getPlayerAccount(getPlayerByName(ret[2])),-os.time())
            doPlayerSendTextMessage(cid,25,ret[2].."'s vip has been deleted.")                                                                                                                                               
         elseif param:lower():find('see') == 1 and 3 then
            local ret = string.explode(param,' ',2)
            if #ret < 2 or getPlayerByName(ret[2]) == false then
               return doPlayerSendTextMessage(cid,25,"check vip:\n/vip see player\n/vip see mock\n")
            end
            local ret_ = vip.getVip(getPlayerByName(ret[2]))
            if ret_ == 0 then
              return doPlayerSendTextMessage(cid, 25,ret[2].." Dont have any vip")
            else
              return doPlayerSendTextMessage(cid, 25, "Vip from "..ret[2].." end in "..os.date("%d %B %Y %X ",ret_))
            end
         end
         return TRUE
end
 
Last edited:
gossh again xd
i already have a vip system coded by me but thanks anyways ;D with your codes i learn :D
 
Good job, best ive seen so far. I'll post some example scripts if anyone wants.
 
Lua:
function onSay(cid,...)
 doPlayerSendTextMessage(cid,25,"Your vip ends in "..vip.returnVipString(cid)..".")
return TRUE
end
^^ here is
or:
Lua:
function onSay(cid,words,param)
local a = assert(string.explode(assert(param,'Write something.')," ",2).'Use like this !vip 10 player name')
local days = assert(tonumber(a[1]),'Error, use like this !vip player name')
local player = getPlayerByName(a[2])
vip.setVip(a[2],vip.getDays(days))
return TRUE
end
 
one example simple:

was fuction make this code?
Code:
vip.getVip(cid)
and this?
Code:
vip.getVipByAcc(acc)

thanks.
 
Lua:
function onSay(cid,...)
print(vip.getVip(cid))
end
and
Lua:
function onSay(cid,...)
print(vip.getVip(getPlayerAccount(cid)))
end
 
Better!!!!! ahuhauuhauhahuahuahuhuauhahuauhahuauhuhauha
you make my long day :D
Mock is tha best with this xd
 
@JDB
better? i dont think :p
@all
All bugs where fixed!!!
 
I have a question.
How to use it in script like vipdoor (if you have vip days you can enter, if not then you can't enter), because i don't know how to use "vip.getVip" in vipdoor script :S
 
@ScorpiOOn93
take an normal door and in lne getPlayerLevel(cid) >= item.actionid change to
vip.hasVip(cid) == TRUE
 
Mock, im a bit newbie, can u make for me, a Action Script :X ???
I want this with a item :(

THANKSSSSSSSSSSS :D

i think u do it em 30 seconds :S
 
Help!!

I need help, i use the mock system, and i need a script for use a item and introduce days of vip.. But dont have nothing for this script....
Can someone pass a script, conpatible mock system, where the player use item and get vip time days.
 
i have this problem

[22/03/2011 21:18:04] [GOD] Loorwi has logged in.
[22/03/2011 21:18:04] Error during getDataInt(vip_time).
[22/03/2011 21:18:04] Error during getDataInt(vip_time).
[22/03/2011 21:18:04] Error during getDataInt(vip_time).

[22/03/2011 21:02:01] Nacho has logged in.
[22/03/2011 21:02:01] OTSYS_SQLITE3_PREPARE(): SQLITE ERROR: no such column: nachito (SELECT "vip_time" FROM "accounts" WHERE "name" = nachito;)
[22/03/2011 21:02:01] OTSYS_SQLITE3_PREPARE(): SQLITE ERROR: no such column: nachito (SELECT "vip_time" FROM "accounts" WHERE "name" = nachito;)
[22/03/2011 21:02:01] OTSYS_SQLITE3_PREPARE(): SQLITE ERROR: no such column: nachito (SELECT "vip_time" FROM "accounts" WHERE "name" = nachito;)
 
Back
Top