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

Ultra Vip System [for real!]

wizzar

New Member
Joined
Aug 21, 2009
Messages
90
Reaction score
0
Hi, I'm here to present you my Vip System, finished seconds ago.
I spent days looking for a Vip System good enough to provide me what I wanted, I decided to edit+make my own, for real, Complet system.
Well, the modifications are HUGE, I spent a lot of time, so be patient.

Features:
-Silver/Gold VIP system, in wich the possibilities are endless and provides versatility for players, since there's premmium account, silver vip and gold vip, what also help the server owner to sell and make some money, once that there are options.
-Silver/Gold VIP different experience rates [release]

-Buyable via web site, just like premmy account:
webvipinterface.png


with trans history too:
transg.png


goldvipadded.png

Gold VIP

silveradded.png

Silver VIP

-VIP per ACCOUNT

-Silver/Gold VIP door:
vipdoor.png



Player's Command

/vip -To check either Silver or Gold VIP days.
slashvip.png


GM's Commands

/addsilvervip name,days -> Add Silver VIP days.
/addgoldvip name,days -> Add Gold VIP days.


Extra

alreadygold.png

-Once you became Gold VIP, you can't buy Silver VIP.

alreadysilver.png

-Once you have became Silver VIP, you can't buy Gold VIP

nor can add vip days using game master:
slashaddvip.png


Let's do it!
Step A: ...data/lib/050-function.lua
Code:
 function getSilverVipTime(accountName)
  local result = db.getResult("SELECT `silverviptime` FROM `accounts` WHERE `name` = '" .. accountName .. "' LIMIT 1;")
   if(result:getID() ~= -1) then
     if(result:getDataInt("silverviptime") > os.time())then
      return result:getDataInt("silverviptime")-os.time()
     else
      return 0
     end
   else
    return FALSE
   end
   result:free()
 end
 
 function isSilverVip(accountName)
  if(getSilverVipTime(accountName) > 0 or getBooleanFromString(getConfigInfo('freeSilverVip')))then
   return TRUE
  else
   return FALSE
  end
 end
 
 function doAddSilverVipTime(accountName, silverVipTime)
  local result = db.getResult("SELECT `silverviptime` FROM `accounts` WHERE `name` = '" .. accountName .. "' LIMIT 1;")
   if(result:getID() ~= -1) then
    if(result:getDataInt("silverviptime") > os.time())then
     timeToAdd = result:getDataInt("silverviptime")+silverVipTime
    else
     timeToAdd = os.time()+silverVipTime
    end
    db.executeQuery("UPDATE `accounts` SET `silverviptime` = " .. timeToAdd .. " WHERE `name`='" .. accountName .. "' LIMIT 1;")
    result:free()
   return TRUE
   end
 end  

 function getGoldVipTime(accountName)
  local result = db.getResult("SELECT `goldviptime` FROM `accounts` WHERE `name` = '" .. accountName .. "' LIMIT 1;")
   if(result:getID() ~= -1) then
     if(result:getDataInt("goldviptime") > os.time())then
      return result:getDataInt("goldviptime")-os.time()
     else
      return 0
     end
   else
    return FALSE
   end
   result:free()
 end
 
 function isGoldVip(accountName)
  if(getGoldVipTime(accountName) > 0 or getBooleanFromString(getConfigInfo('freeGoldVip')))then
   return TRUE
  else
   return FALSE
  end
 end
 
 function doAddGoldVipTime(accountName, goldVipTime)
  local result = db.getResult("SELECT `goldviptime` FROM `accounts` WHERE `name` = '" .. accountName .. "' LIMIT 1;")
   if(result:getID() ~= -1) then
    if(result:getDataInt("goldvip") > os.time())then
     timeToAdd = result:getDataInt("goldviptime")+goldVipTime
    else
     timeToAdd = os.time()+goldVipTime
    end
    db.executeQuery("UPDATE `accounts` SET `goldviptime` = " .. timeToAdd .. " WHERE `name`='" .. accountName .. "' LIMIT 1;")
    result:free()
   return TRUE
   end
 end
NOTE: you need LIST and STRING functions, so only if you DO NOT HAVE IT INSTALLED ALREADY, add
Code:
function timeString(timeDiff)
    local dateFormat = {
        {"day", timeDiff / 60 / 60 / 24},
        {"hour", timeDiff / 60 / 60 % 24},
        {"minute", timeDiff / 60 % 60},
        {"second", timeDiff % 60}
    }

    local out = {}
    for k, t in ipairs(dateFormat) do
        local v = math.floor(t[2])
        if(v > 0) then
            table.insert(out, (k < #dateFormat and (#out > 0 and ', ' or '') or ' and ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or ''))
        end
    end
    
    return table.concat(out)
end

function list (keys, values)
    local list = {}
    for i=1, #values do
        if keys[i] then
            list[keys[i]] = values[i]
        else
            list[i] = values[i]
        end
    end
    return list
end
to 050-function.lua

Step A.b: open your OTs config.lua and add this:
Code:
	freeSilverVip = "false" //Free Silver Vip false/true
	freeGoldVip = "false" //Free Gold Vip false/true

Step B: ...data/creaturescripts/creaturescripts.xml
Code:
<event type="login" name="VipRate" event="script" value="vip.lua"/>

Step B.a: ...data/creaturescripts/scripts/VIP.LUA
Code:
function onLogin(cid)

accountName = getPlayerAccount(cid)
svip = isSilverVip(accountName)
gvip = isGoldVip(accountName)

if (svip == TRUE) then
                doPlayerSetRate(cid, SKILL__LEVEL, 1.5)

elseif(gvip == TRUE) then
		doPlayerSetRate(cid, SKILL__LEVEL, 2.5)
end
return TRUE
end
return TRUE

Step C: ...data/talkactions/talkactions.xml
Code:
<talkaction log="yes" words="/addsilvervip" access="5" event="script" value="silvervip.lua"/>
<talkaction log="yes" words="/addgoldvip" access="5" event="script" value="goldvip.lua"/>
<talkaction log="yes" words="/vip" access="0" event="script" value="vip.lua"/>

Step C.a: ...data/talkactions/scripts/VIP.LUA
Code:
  function onSay(cid, words, param)


    accountName = getPlayerAccount(cid)
    time1 = getSilverVipTime(accountName)
    time2 = getGoldVipTime(accountName)
    if(words == "/vip")then
            if(time1 > 0)then
                doPlayerSendTextMessage(cid, 19, "Sua conta tem "..timeString(time1).." de Silver VIP.")
	      else
		  doPlayerSendTextMessage(cid, 19, "Voce nao tem dias de Silver VIP.")
		end
             if(time2 > 0)then
                doPlayerSendTextMessage(cid, 19, "Sua conta tem "..timeString(time2).." de Gold VIP.")
             else
		 doPlayerSendTextMessage(cid, 19, "Voce nao tem dias de Gold VIP.")
              end
             else
                doPlayerSendTextMessage(cid, 19, "Sua conta tem Vip Gr\átis.")
             end

return true
end

Step C.b: ...data/talkactions/scripts/SILVERVIP.LUA
Code:
function onSay(cid, words, param)

       if(words == "/addsilvervip")then
        if(param ~= "")then
        local params = list({"name", "days"}, string.explode(param, ',', 2))
        local player = getPlayerByName(params["name"])
 
            if(isPlayer(player) == TRUE)then
            if(isNumber(params["days"]))then
            local days = (params["days"]*3600*24)
            if(isGoldVip(getPlayerAccount(player)))then
	    time1 = getGoldVipTime(getPlayerAccount(player))
            doPlayerSendTextMessage(cid, 19, "Esta conta j\á possui "..timeString(time1).." de Gold VIP, n\ão sendo assim poss\ível adicionar dias de Silver Vip.")
         else
            doAddSilverVipTime(getPlayerAccount(player), days)
	 end
         else
            doPlayerSendCancel(cid, "Quantidade de dias deve ser n\úmerica.")
         end
         else
            doPlayerSendCancel(cid, "O Player n\ão est\á online.")
            end
         else
            doPlayerSendCancel(cid, "Comando requer par\âmetros (nome,dias).")
         end
 
    end
    return TRUE
end

Step C.c: ...data/talkactions/scripts/GOLDVIP.LUA
Code:
function onSay(cid, words, param)

       if(words == "/addgoldvip")then
        if(param ~= "")then
        local params = list({"name", "days"}, string.explode(param, ',', 2))
        local player = getPlayerByName(params["name"])
 
            if(isPlayer(player) == TRUE)then
            if(isNumber(params["days"]))then
            local days = (params["days"]*3600*24)
            if(isSilverVip(getPlayerAccount(player)))then
	    time1 = getSilverVipTime(getPlayerAccount(player))
            doPlayerSendTextMessage(cid, 19, "Esta conta j\á possui "..timeString(time1).." de Silver VIP, n\ão sendo assim poss\ível adicionar dias de Gold Vip.")
         else
            doAddGoldVipTime(getPlayerAccount(player), days)
	 end
         else
            doPlayerSendCancel(cid, "Quantidade de dias deve ser n\úmerica.")
         end
         else
            doPlayerSendCancel(cid, "O Player n\ão est\á online.")
            end
         else
            doPlayerSendCancel(cid, "Comando requer par\âmetros (nome,dias).")
         end
 
    end
    return TRUE
end

Silver/Gold VIP door

Step A: ...data/actions/actions.xml
Code:
        <!-- VIP -->
        <action actionid="9001" script="silvervipdoor.lua"/>
	<action actionid="9002" script="goldvipdoor.lua"/>

Step A: ...data/actions/scripts/SILVERVIPDOOR.LUA

Silver VIP door:
Code:
  function onUse(cid, item, fromPosition, itemEx, toPosition)



accountName = getPlayerAccount(cid)
        if(isSilverVip(accountName) or isGoldVip(accountName))then

if getCreaturePosition(cid).y < toPosition.y then
doTeleportThing(cid, {x=toPosition.x,y=toPosition.y+1,z=toPosition.z}, TRUE)
else
doTeleportThing(cid, {x=toPosition.x,y=toPosition.y-1,z=toPosition.z}, TRUE)
end

if(isSilverVip(accountName))then
doCreatureSay(cid, "Welcome Silver VIP Player!", TALKTYPE_ORANGE_1)
doSendMagicEffect(getCreaturePosition(cid), 10)
 
         else
            doCreatureSay(cid, "Welcome Gold VIP Player!", TALKTYPE_ORANGE_1)
            doSendMagicEffect(getCreaturePosition(cid), 10)
          end

         else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, but only VIP Players can pass here. Buy VIP on the WEB.")
          end

return TRUE
end

Step A: ...data/actions/scripts/GOLDVIPDOOR.LUA

Gold VIP door:
Code:
  function onUse(cid, item, fromPosition, itemEx, toPosition)



accountName = getPlayerAccount(cid)
        if(isGoldVip(accountName))then
            time = getGoldVipTime(accountName)
            if(time > 0) == TRUE then

if getCreaturePosition(cid).y < toPosition.y then
doTeleportThing(cid, {x=toPosition.x,y=toPosition.y+1,z=toPosition.z}, TRUE)
else
doTeleportThing(cid, {x=toPosition.x,y=toPosition.y-1,z=toPosition.z}, TRUE)
end
doCreatureSay(cid, "Welcome Gold VIP Player!", TALKTYPE_ORANGE_1)
doSendMagicEffect(getCreaturePosition(cid), 10)
end
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, but only VIP Players can pass here. Buy VIP on the WEB.")

end
return TRUE
end

A GOLD VIP PLAYER IS ALLOWED TO PASS THROUGH SILVER VIP DOOR!
A GOLD VIP PLAYER IS ALLOWED TO PASS THROUGH SILVER VIP DOOR!

Since the website part is too enormous, I'm attaching the files here.
Download:
via Attachment: View attachment htdocs.rar
via 2shared: 2shared - download htdocs.rar
via 4shared: 4shared.com - online file sharing and storage - download htdocs.rar


SQL part

Add to you OTs database:
Code:
CREATE TABLE IF NOT EXISTS `z_shop_history_silvervip` (
  `id` int(11) NOT NULL auto_increment,
  `to_name` varchar(255) NOT NULL default '0',
  `to_account` int(11) NOT NULL default '0',
  `from_nick` varchar(255) NOT NULL,
  `from_account` int(11) NOT NULL default '0',
  `price` int(11) NOT NULL default '0',
  `sVIP_days` int(11) NOT NULL default '0',
  `trans_state` varchar(255) NOT NULL,
  `trans_start` int(11) NOT NULL default '0',
  `trans_real` int(11) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=45 ;

CREATE TABLE IF NOT EXISTS `z_shop_history_goldvip` (
  `id` int(11) NOT NULL auto_increment,
  `to_name` varchar(255) NOT NULL default '0',
  `to_account` int(11) NOT NULL default '0',
  `from_nick` varchar(255) NOT NULL,
  `from_account` int(11) NOT NULL default '0',
  `price` int(11) NOT NULL default '0',
  `gVIP_days` int(11) NOT NULL default '0',
  `trans_state` varchar(255) NOT NULL,
  `trans_start` int(11) NOT NULL default '0',
  `trans_real` int(11) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

ALTER TABLE `accounts` ADD `silverviptime` BIGINT( 20 ) NOT NULL ;  
ALTER TABLE `accounts` ADD `goldviptime` BIGINT( 20 ) NOT NULL ;

That should be it, please, report bugs, it worked fine here:peace: but maybe I forgot to post something here :confused:

Oncoming Update:
-Upgrade vip from silver to gold.
-Silver/Gold tiles.
-PM any ideas.

Known Bugs:
-On website, Gold VIP Points cost is shown = Silver VIP Points cost.
Fixing:
1.open htdocs/shopsystem.php;
2.go to the end of the line number 274 (ctrl+g);
3.search for "por '.$sVIP['points'].' points"
4.replace it for "por '.$gVIP['points'].' points"

Regards

Note: edited from Azi's VIP System (http://otland.net/f163/best-vip-system-functions-vip-account-30286/)
door edited from Shawak's [Release] VIP System (http://otland.net/f81/release-vip-system-44986/)
thx to 'em
 
Last edited:
I should or I must?
I downloaded tons of scripts in polish here x.x

~Anyways, I will put up a translation below images, as subtitle.
 
Lua:
function getSilverVipTime(accountName)
    local result = db.getResult("SELECT `silverviptime` FROM `accounts` WHERE `name` = '" .. accountName .. "' LIMIT 1;")
    if(result:getID() ~= -1) then
        if(result:getDataInt("silverviptime") > os.time())then
            return result:getDataInt("silverviptime")-os.time()
        else
            return 0
        end
    else
        return FALSE
    end
    result:free()
end


--

function getGoldVipTime(accountName)
    local result = db.getResult("SELECT `goldviptime` FROM `accounts` WHERE `name` = '" .. accountName .. "' LIMIT 1;")
    if(result:getID() ~= -1) then
        if(result:getDataInt("goldviptime") > os.time())then
            return result:getDataInt("goldviptime")-os.time()
        else
            return 0
        end
    else
        return FALSE
    end
    result:free()
end

=

Lua:
function getVipTime(accountName, viptype)
    local ret, result = nil, db.getResult("SELECT " .. viptype .. " FROM `accounts` WHERE `name` = '" .. accountName .. "' LIMIT 1;")
    if (result:getID() ~= -1) then
        if (result:getDataInt(viptype) > os.time()) then
            ret = result:getDataInt(viptype) - os.time()
        end
    end
    result:free()
    return ret
end

Lua:
getVipTime(accountName, 'silverviptime')
getVipTime(accountName, 'goldviptime')

Lua:
function doAddSilverVipTime(accountName, silverVipTime)
    local result = db.getResult("SELECT `silverviptime` FROM `accounts` WHERE `name` = '" .. accountName .. "' LIMIT 1;")
    if(result:getID() ~= -1) then
        if(result:getDataInt("silverviptime") > os.time())then
            timeToAdd = result:getDataInt("silverviptime")+silverVipTime
        else
            timeToAdd = os.time()+silverVipTime
        end
        db.executeQuery("UPDATE `accounts` SET `silverviptime` = " .. timeToAdd .. " WHERE `name`='" .. accountName .. "' LIMIT 1;")
        result:free()
        return TRUE
    end
end  


--

function doAddGoldVipTime(accountName, goldVipTime)
    local result = db.getResult("SELECT `goldviptime` FROM `accounts` WHERE `name` = '" .. accountName .. "' LIMIT 1;")
    if(result:getID() ~= -1) then
        if(result:getDataInt("goldvip") > os.time())then
            timeToAdd = result:getDataInt("goldviptime")+goldVipTime
        else
            timeToAdd = os.time()+goldVipTime
        end
        db.executeQuery("UPDATE `accounts` SET `goldviptime` = " .. timeToAdd .. " WHERE `name`='" .. accountName .. "' LIMIT 1;")
        result:free()
        return TRUE
    end
end

=

Lua:
function doAddVipTime(accountName, viptime, viptype)
    local result = db.getResult("SELECT " .. viptype .. " FROM `accounts` WHERE `name` = '" .. accountName .. "' LIMIT 1;")
    if(result:getID() ~= -1) then
        if (result:getDataInt(viptype) > os.time()) then
            timeToAdd = result:getDataInt(viptype) + viptime
        else
            timeToAdd = os.time() + viptime
        end
        db.executeQuery("UPDATE `accounts` SET " .. viptype .. " = " .. timeToAdd .. " WHERE `name`='" .. accountName .. "' LIMIT 1;")
        result:free()
        return true
    end
end

Lua:
doAddVipTime(accountName, viptime, 'silverviptime')
doAddVipTime(accountName, viptime, 'goldviptime')

Lua:
function isSilverVip(accountName)
    if(getSilverVipTime(accountName) > 0 or getBooleanFromString(getConfigInfo('freeSilverVip')))then
        return TRUE
    else
        return FALSE
    end
end

function isGoldVip(accountName)
    if(getGoldVipTime(accountName) > 0 or getBooleanFromString(getConfigInfo('freeGoldVip')))then
        return TRUE
    else
        return FALSE
    end
end

=

Lua:
function isSilverVip(accountName)
    return getBooleanFromString(getConfigInfo('freeSilverVip')) or (getVipTime(accountName, 'silverviptime') > 0)
end

--


function isGoldVip(accountName)
    return getBooleanFromString(getConfigInfo('freeGoldVip')) or (getVipTime(accountName, 'goldviptime') > 0)
end

or

Lua:
function isVip(accountName, viptype)
    return getBooleanFromString(getConfigInfo('free' .. viptype .. 'Vip')) or (getVipTime(accountName, viptype .. 'viptime') > 0)
end

isVip(accountName, 'silver')
isVip(accountName, 'gold')
 
also you forgot ask people to add new values in config.lua 8)
 
@up -> ?
It's all separeted to make it easier to configure as you want to.
If you like it together, edit the whole script and post it properly.
 
Last edited:
@up -> ?
It's all separeted to make it easier to configure as you want to.
If you like it together, edit the whole script and post it properly.

woah, what the point of making mutiple functions that basically are_the_same just changing a word, easier ~= useless
 
I bet a hundred dollars that if I just replace the codes you've post, there will be errors.
You would need to change all the database and the php part, I would do that if it would make some difference.
 
I bet a hundred dollars that if I just replace the codes you've post, there will be errors.
maybe a litle error with

Lua:
function isVip(accountName, viptype)
    return getBooleanFromString(getConfigInfo('free' .. viptype .. 'Vip')) or (getVipTime(accountName, viptype .. 'viptime') > 0)
end

isVip(accountName, 'silver')
isVip(accountName, 'gold')

because capital letter in config, easy to fix

isVip(accountName, 'Silver')
isVip(accountName, 'Gold')

and fixed 8)

if you change the rest of the scripts properly should be all ok, btw im not telling you to change, it was just a tip 8)

edit: why database and php ?_? lols i just optimized lua part, nothing else
 
Im thankfull, cuz im noob in lua, but still I made a nice script, for me, maybe when I have some freetime I will change.

You wouldnt have to edited database, I didnt see a detail.

Lua:
test
 
Im thankfull, cuz im noob in lua, but still I made a nice script, for me, maybe when I have some freetime I will change.

You wouldnt have to edited database, I didnt see a detail.

Lua Code:
test​

dont use Lua tags, is so fuckin annoying when you edit a post xDD peace
 
? I didnt get it :s
I checked here, I would need to change EVERY

-isSilverVip(accountName)
-isGoldVip(accountName)
-getSilverVipTime(accountName)
-getGoldTime(accountName)
-doAddSilverVipTime(accountName,silverVipTime)
-doAddGoldVipTime(accountName,goldVipTime)

in the script, a hell of work, for

isVip(accountName, viptype)
getVipTime(accountName,viptype)
doAddVipTime(accountName, viptime, viptype)

=/
 
? I didnt get it :s
I checked here, I would need to change EVERY

-isSilverVip(accountName)
-isGoldVip(accountName)
-getSilverVipTime(accountName)
-getGoldTime(accountName)
-doAddSilverVipTime(accountName,silverVipTime)
-doAddGoldVipTime(accountName,goldVipTime)

in the script, a hell of work, for

isVip(accountName, viptype)
getVipTime(accountName,viptype)
doAddVipTime(accountName, viptime, viptype)

=/

dont do it if you dont wish to, tomorrow ill change them maybe 8)
 
OTSYS_SQLITE3_PREPARE(): SQLITE ERROR: near "LIMIT": syntax error (UPDATE "accounts" SET "silverviptime" = 1272919472 WHERE "name"='998877' LIMIT 1;)

How to fix this?
:/
 
? I didnt get it :s
I checked here, I would need to change EVERY

-isSilverVip(accountName)
-isGoldVip(accountName)
-getSilverVipTime(accountName)
-getGoldTime(accountName)
-doAddSilverVipTime(accountName,silverVipTime)
-doAddGoldVipTime(accountName,goldVipTime)

in the script, a hell of work, for

isVip(accountName, viptype)
getVipTime(accountName,viptype)
doAddVipTime(accountName, viptime, viptype)

=/

ctrl + r?
 
Thanks for this foundation, I actually created a system similar to this with some help.

Code:
/addvip [name], [type], [time]
 
Back
Top