GeKirAh
Banned User
Here are "Nahruto's Vip System",
It work by points, you addpoints to some player,
And this player can buy VIP DAYS, or VIP Items,
The vip system work for hours {not by restart, others vip system is by an restarters}
and there are the files:
This file on OT-Folder name "VIP" {lua archive!}:
2.0 This file in data\globalevents\scripts.
Name of file: "vip" {lua archive!}
3.0 Create an Text File, with name "Vip info" location: data\logs
4.0 The file with a name "vipE" with folder: "data\talkactions\scripts"
and add to talkaction:
Nahruto sended me all files, with exacly folder, to need only to paste files, and add it with talkactions etc~, But I maded all correct, and now found errors with this lastet TFS version, for tibia 8.41 client...
Can please someone help me with it?!
= PLEASE =
Thx OT-Land!!!
Please Someone Help me? :~~ REP++
It work by points, you addpoints to some player,
And this player can buy VIP DAYS, or VIP Items,
The vip system work for hours {not by restart, others vip system is by an restarters}
and there are the files:
This file on OT-Folder name "VIP" {lua archive!}:
Code:
dofile("./outfits.lua")
function VipInfo(ACC)
local Info = db.getResult("SELECT `vip_points`, `vip_days` FROM `accounts` WHERE `id` = " .. ACC .. "")
return {Puntos = Info:getDataInt("vip_points"), Dias = Info:getDataInt("vip_days")}
end
function getVipPlayers()
local res = db.getResult("SELECT p.name FROM accounts AS a INNER JOIN players AS p ON p.account_id = a.id WHERE a.vip_days > 0")
local players = {}
if res:getID() ~= LUA_ERROR then
while true do
table.insert(players, res:getDataString "name")
if not res:next() then
break
end
end
res:free()
end
return players
end
function getPlayerVipInfoByName(name)
return VipInfo(getAccountIdByName(name))
end
function doPlayerAddVipPoints(name, num)
db.executeQuery("UPDATE `accounts` SET `vip_points` = `vip_points` + "..num.." WHERE `id` = "..getAccountIdByName(name).."")
end
function doPlayerAddVipDays(name, num)
local days = num * 24 * 60 * 60
db.executeQuery("UPDATE `accounts` SET `vip_days` = `vip_days` + "..days.." WHERE `id` = "..getAccountIdByName(name).."")
end
function doPlayerRemoveVipPoints(name, num)
local dif = getPlayerVipInfoByName(name).Puntos - num
if dif >= 0 then
db.executeQuery("UPDATE `accounts` SET `vip_points` = `vip_points` - "..num.." WHERE `id` = "..getAccountIdByName(name).."")
return TRUE
end
return FALSE
end
function getPlayerVipTime(name)
return getPlayerVipInfoByName(name).Dias
end
function doPlayerRemoveVipTime(name, num) -- seconds
local dif = getPlayerVipTime(name) - num
if dif >= 0 then
db.executeQuery("UPDATE `accounts` SET `vip_days` = `vip_days` - "..num.." WHERE `id` = "..getAccountIdByName(name).."")
return TRUE
else
num = getPlayerVipTime(name)
db.executeQuery("UPDATE `accounts` SET `vip_days` = `vip_days` - "..num.." WHERE `id` = "..getAccountIdByName(name).."")
return FALSE
end
end
function getPlayerVipDays(name)
return math.roof(getPlayerVipInfoByName(name).Dias / 24 / 60 / 60)
end
function doPlayerRemoveVipDays(name, num)
local days = num * 24 * 60 * 60
if days >= 0 then
return doPlayerRemoveVipTime(name, days)
end
return FALSE
end
function math.roof(N)
-- Function by Colandus.
local v = math.floor(N)
return v + (N - v > 0 and 1 or 0)
end
function getOutfitStorage(Out, a)
for t = 10001, 10040 do
if isInArray(Outfits[t].Outs, Out) == TRUE and Outfits[t].addon == a then
return t
end
end
end
--CONFIG
ACCESS = 5
Registro = {Carpeta="data/logs/", archivo="Vip info.txt", Registrar=TRUE}
2.0 This file in data\globalevents\scripts.
Name of file: "vip" {lua archive!}
Code:
dofile("./VIP.lua")
function onThink(interval, lastExecution)
local seconds = 1 * 60 * 60 -- 1 hour (must be same as in globalevents.xml)
for _, name in ipairs(getVipPlayers()) do
doPlayerRemoveVipTime(name, seconds)
end
return TRUE
end
3.0 Create an Text File, with name "Vip info" location: data\logs
4.0 The file with a name "vipE" with folder: "data\talkactions\scripts"
Code:
dofile("./VIP.lua")
function onSay(cid, words, param)
local InitialPoints = VipInfo(getPlayerAccountId(cid)).Puntos
local InitialDays = getPlayerVipDays(getCreatureName(cid))
local myOutfit = getCreatureOutfit(cid).lookType
if words == "/addpoints" then
if getPlayerAccess(cid) >= ACCESS then
if #param > 0 then
local data = string.explode(param, ",")
if not getPlayerByName(data[1]) then
doPlayerSendCancel(cid, "Please write the name of the playerr.")
elseif tonumber(data[2]) == nil then
doPlayerSendCancel(cid, "Please write a valid number.")
else
local name, ptos = data[1], tonumber(data[2])
doPlayerAddVipPoints(name, ptos)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You added " .. ptos .. " vip points to " .. name ..".")
end
else
doPlayerSendCancel(cid, "Please write the info.")
end
else
doPlayerSendCancel(cid, "Command only executable by Gms.")
end
elseif words == "/removepoints" then
if getPlayerAccess(cid) >= ACCESS then
if #param > 0 then
local data = string.explode(param, ",")
if not getPlayerByName(data[1]) then
doPlayerSendCancel(cid, "Please write the name of the playerr.")
elseif tonumber(data[2]) == nil then
doPlayerSendCancel(cid, "Please write a valid number.")
else
local name, ptos = data[1], tonumber(data[2])
if doPlayerRemoveVipPoints(name, ptos) == TRUE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You removed " .. ptos .. " vip points to " .. name ..".")
else
doPlayerSendCancel(cid, "The player ".. name .." does not have enough points.")
end
end
else
doPlayerSendCancel(cid, "Please write the info.")
end
else
doPlayerSendCancel(cid, "Command only executable by Gms.")
end
elseif words == "/removedays" then
if getPlayerAccess(cid) >= ACCESS then
if #param > 0 then
local data = string.explode(param, ",")
if not getPlayerByName(data[1]) then
doPlayerSendCancel(cid, "Please write the name of the playerr.")
elseif tonumber(data[2]) == nil then
doPlayerSendCancel(cid, "Please write a valid number.")
else
local name, days = data[1], tonumber(data[2])
if doPlayerRemoveVipDays(name, days) == TRUE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Has removido " .. days .. " dias vip a "..name..".")
else
doPlayerSendCancel(cid, "The player "..name.." does not have enough vip days, removed all the time possible.")
end
end
else
doPlayerSendCancel(cid, "Please write the info.")
end
else
doPlayerSendCancel(cid, "Command only executable by Gms.")
end
elseif words == "/adddays" then
if getPlayerAccess(cid) >= ACCESS then
if #param > 0 then
local data = string.explode(param, ",")
if not getPlayerByName(data[1]) then
doPlayerSendCancel(cid, "Please write the name of the playerr.")
elseif tonumber(data[2]) == nil then
doPlayerSendCancel(cid, "Please write a valid number.")
else
local name, days = data[1], tonumber(data[2])
doPlayerAddVipDays(name, days)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You added " .. days .. " vip days to "..name..".")
end
else
doPlayerSendCancel(cid, "Please write the info.")
end
else
doPlayerSendCancel(cid, "Command only executable by Gms.")
end
elseif words == "/getvipinfo" then
if getPlayerAccess(cid) >= ACCESS then
if param ~= "" then
if not getPlayerByName(param) then
doPlayerSendCancel(cid, "Please write the name of the playerr.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The player "..param.." have " .. getPlayerVipDays(param) .. " vip days and "..getPlayerVipInfoByName(param).Puntos.." vip points.")
end
else
doPlayerSendCancel(cid, "Please write the name of the playerr.")
end
else
doPlayerSendCancel(cid, "Command only executable by Gms.")
end
--PLAYERS
elseif words == "!vipinfo" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have " .. getPlayerVipDays(getCreatureName(cid)) .. " vip days and "..getPlayerVipInfoByName(getCreatureName(cid)).Puntos.." vip points.")
--SHOP VIP
elseif words == "/buydays" then
if param ~= "" then
local days = tonumber(param)
if not days then
doPlayerSendCancel(cid, "Please write a number.")
else
local points = days * 2
if doPlayerRemoveVipPoints(getCreatureName(cid), points) == TRUE then
doPlayerAddVipDays(getCreatureName(cid), days)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You bought ".. days .." vip days for ".. points .." vip points.")
else
doPlayerSendCancel(cid, "You need ".. points .." vip points for buy ".. days .." vip days.")
end
end
else
doPlayerSendCancel(cid, "Please write a number.")
end
--[[
elseif words == "/buy" then
if param == "exp ring" then
if doPlayerRemoveVipPoints(getCreatureName(cid), R_Ptos) == TRUE then
local ring = doPlayerAddItem(cid, 2213, 1)
doSetItemActionId(ring, R_Duration + 1000)
setItemName(ring, getCreatureName(cid).."\´s Ring.")
doSetItemSpecialDescription(ring, "Esta nuevo.")
else
doPlayerSendCancel(cid, "No tienes suficientes puntos.")
end
else
doPlayerSendCancel(cid, "Item no valido.")
end
elseif words == "/addon" then
if #param > 0 then
local addon = tonumber(param)
if not addon then
doPlayerSendCancel(cid, "Ingresa un numero valido.")
elseif addon > 2 or addon < 1 then
doPlayerSendCancel(cid, "El numero solo puede ser 1 o 2.")
else
local Stor = getOutfitStorage(myOutfit, addon)
if getPlayerStorageValue(cid, Stor) ~= 1 then
if doPlayerRemoveVipPoints(getCreatureName(cid), Addons_P) == TRUE then
for q = 1, 2 do
doPlayerAddOutfit(cid, Outfits[Stor].Outs[q], addon)
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Has comprado el addon "..addon.." por "..Addons_P.." punto.")
setPlayerStorageValue(cid, Stor, 1)
else
doPlayerSendCancel(cid, "No tienes suficientes puntos.")
end
else
doPlayerSendCancel(cid, "Ya tienes este addon.")
end
end
else
doPlayerSendCancel(cid, "Ingresa el addons que deseas comprar.")
end
end
]]
--Register all the commands ~
if Registro.Registrar == TRUE then
local file = io.open(Registro.Carpeta .. Registro.archivo, "a")
file:write("".. os.date("%d %B %Y %X ", os.time()) .." --> "..getCreatureName(cid)..": "..words.." "..param.." Info: Pts. Before = "..InitialPoints..", Pts. After = "..VipInfo(getPlayerAccountId(cid)).Puntos..", Days Before = "..InitialDays..", Days After = "..getPlayerVipDays(getCreatureName(cid))..", Outfit = "..myOutfit.."\n")
file:close()
end
return TRUE
end
and add to talkaction:
<!--GODS-->
Code:
<talkaction words="/addpoints" script="vipE.lua" />
<talkaction words="/removepoints" script="vipE.lua" />
<talkaction words="/adddays" script="vipE.lua" />
<talkaction words="/removedays" script="vipE.lua" />
<talkaction words="/getvipEinfo" script="vipE.lua" />
<!--PLAYERS-->
Code:
<talkaction words="!vipEinfo" script="vipE.lua" />
<talkaction words="/buydays" script="vipE.lua" />
Nahruto sended me all files, with exacly folder, to need only to paste files, and add it with talkactions etc~, But I maded all correct, and now found errors with this lastet TFS version, for tibia 8.41 client...
Can please someone help me with it?!
= PLEASE =
Thx OT-Land!!!
Please Someone Help me? :~~ REP++