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

The best vip system functions [ vip for account! ]

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Reaction score
53
Location
Włocławek
Hello!
Im back!: D
It's my simple, and best vip system, Vip like premium on account, not on player ;d

simple functions add to our data/lib/functions.lua
PHP:
  function getAccountVipTime(accountName)
  local result = db.getResult("SELECT `viptime` FROM `accounts` WHERE `name` = '" .. accountName .. "' LIMIT 1;")
   if(result:getID() ~= -1) then
     if(result:getDataInt("viptime") > os.time())then
      return result:getDataInt("viptime")-os.time()
     else
      return 0
     end
   else
    return FALSE
   end
   result:free()
 end
 
 function isVip(accountName)
  if(getAccountVipTime(accountName) > 0 or getConfigInfo("freeVip") == "yes")then
   return TRUE
  else
   return FALSE
  end
 end
 
 function doAccountAddVipTime(accountName, vipTime)
  local result = db.getResult("SELECT `viptime` FROM `accounts` WHERE `name` = '" .. accountName .. "' LIMIT 1;")
   if(result:getID() ~= -1) then
    if(result:getDataInt("viptime") > os.time())then
     timeToAdd = result:getDataInt("viptime")+vipTime
    else
     timeToAdd = os.time()+vipTime
    end
    db.executeQuery("UPDATE `accounts` SET `viptime` = " .. timeToAdd .. " WHERE `name`='" .. accountName .. "' LIMIT 1;")
    result:free()
   return TRUE
   end
 end

how do use? easy!

GM COMMAND FOR ADD SOME VIP DAY'S and for lookup vip time (functions list and timeString need):
PHP:
function onSay(cid, words, param)

	 if(words == "/vip")then
		accountName = getPlayerAccount(cid)
		if(isVip(accountName))then
			time = getAccountVipTime(accountName)
			if(time > 0)then
				doPlayerSendTextMessage(cid, 19, "Your account have "..timeString(time).." of vip time left.")
			else
				doPlayerSendTextMessage(cid, 19, "Your account gratis vip time.")
			end
		else
			doPlayerSendTextMessage(cid, 19, "You haven't any vip time.")
		end
	elseif(words == "/addvip")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)
					doAccountAddVipTime(getPlayerAccount(player), days)
				else
					doPlayerSendCancel(cid, "Days ammount must be in numeric format.")
				end
			else
				doPlayerSendCancel(cid, "Player is not online.")
			end
		else
			doPlayerSendCancel(cid, "Command requires param.")
		end
	end
	return TRUE
end
talkactions.xml
PHP:
<talkaction log="yes" words="/addvip" access="5" event="script" value="vip.lua"/>
<talkaction log="yes" words="/vip" access="0" event="script" value="vip.lua"/>

and to your config.lua
PHP:
freeVip = "no" -- gratis vip for all? :D

remember to add in our database:
PHP:
ALTER TABLE `accounts` ADD `viptime` BIGINT( 20 ) NOT NULL ;
: ))
 
Last edited:
thanks, i ate once character, thx. :D

#darex
you can add viprune and use function doPlayerAddVipTime ;d
 
Last edited:
@darex: its not hard to do it for shopsystem. If you wanna i can make it xd
 
and how the server remove the vip time automatically?? awser my question pleaaaseeeeeee
 
Last edited:
#up
yes, if time has out - player don't have vip (not must relog) : ))
#master-m
it's my script because i post only my scripts and you dont know my skills?
 
#up
yes, if time has out - player don't have vip (not must relog) : ))
#master-m
it's my script because i post only my scripts and you dont know my skills?

I know you created scripts before thats why I asked it^^ Good script again;)
 
Must the command to add a vip be like the this: /addvip god djow,5 ???
doesn't works here..., appears the "Ammount of days must be numeric."

(sorry, bad english >.<)

when i sayd the command to view the vip days(here is !vipdays) the dialog window shows
[09/05/2009 10:47:28] Lua Script Error: [TalkAction Interface]
[09/05/2009 10:47:28] data/talkactions/scripts/vipdays.lua: onSay

[09/05/2009 10:47:28] data/talkactions/scripts/vipdays.lua:5: attempt to call global 'timeString' (a nil value)
[09/05/2009 10:47:28] stack traceback:
[09/05/2009 10:47:28] data/talkactions/scripts/vipdays.lua:5: in function <data/talkactions/scripts/vipdays.lua:1>
 
Last edited:
Look first post, need function timeString, you can found it in this forum.
 
In fuction addvip is error:
Code:
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/vip.lua:onSay

data/lib/function.lua:782: attempt to get length of local 'values' (a nil value)

stack traceback:
        data/lib/function.lua:782: in function 'list'
        data/talkactions/scripts/vip.lua:16: in function <data/talkactions/scrip
ts/vip.lua:1>
 
Back
Top