Ir para conteúdo

Featured Replies

Postado

Pessoal então estou fazendo um servidor bem balanceado para players pagantes e não pagantes.

o sistema de vip do meu projeto é comprado via gesior, gostaria que tive-se a opção em game também com user em um item seria ótimo.

alguém pode me da uma mão de como fazer isso, esse é meu sistema de vip atual.

vip = {
   name = "Vip system";
   author = "Mock";
   version = "1.0.0.0";
   query="ALTER TABLE `accounts` ADD `vip_time` INTEGER";
   query2="ALTER TABLE `accounts` ADD `vip_time` INT(15) NOT NULL"
}

function vip.setTable()
   dofile('config.lua')
   if sqlType == "sqlite" then
   	db.executeQuery(vip.query)
   else
        db.executeQuery(vip.query2)
   end
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

local retee = ae:getDataInt("vip_time") or 0
ae:free()
         return retee
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, a:free()
         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).."';")
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 return end;
         local t = vip.getVip(cid) or 0
         if os.time(day) < t then
            return TRUE
         else
            return FALSE
         end
end

function vip.hasVips(cid)
         assert(tonumber(cid),'Parameter must be a number')
         if isPlayer(cid) == FALSE then return end;
         local t = vip.getVip(cid)
         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 `accounts` SET `vip_time` = '"..(os.time()+time).."' WHERE `accounts`.`name` ='"..acc.."';")
         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

 

Editado por thiagobs (veja o histórico de edições)

  • Respostas 9
  • Visualizações 528
  • Created
  • Última resposta

Top Posters In This Topic

Postado
  • Autor
vip = {
   name = "Vip system";
   author = "Mock";
   version = "1.0.0.0";
   query="ALTER TABLE `accounts` ADD `vip_time` INTEGER";
   query2="ALTER TABLE `accounts` ADD `vip_time` INT(15) NOT NULL"
}
function vip.setTable()
   dofile('config.lua')
   if sqlType == "sqlite" then
       db.executeQuery(vip.query)
   else
        db.executeQuery(vip.query2)
   end
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
local retee = ae:getDataInt("vip_time") or 0
ae:free()
         return retee
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, a:free()
         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).."';")
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 return end;
         local t = vip.getVip(cid) or 0
         if os.time(day) < t then
            return TRUE
         else
            return FALSE
         end
end
function vip.hasVips(cid)
         assert(tonumber(cid),'Parameter must be a number')
         if isPlayer(cid) == FALSE then return end;
         local t = vip.getVip(cid)
         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 `accounts` SET `vip_time` = '"..(os.time()+time).."' WHERE `accounts`.`name` ='"..acc.."';")
         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

 

  Em 02/11/2017 em 03:16, Farathor disse:

Cara, da uma procurada na pasta lib e veja se tem algum arquivo que tenha VIP no nome e poste aqui

 

  Em 02/11/2017 em 13:12, thiagobs disse:

vip = {
   name = "Vip system";
   author = "Mock";
   version = "1.0.0.0";
   query="ALTER TABLE `accounts` ADD `vip_time` INTEGER";
   query2="ALTER TABLE `accounts` ADD `vip_time` INT(15) NOT NULL"
}
function vip.setTable()
   dofile('config.lua')
   if sqlType == "sqlite" then
       db.executeQuery(vip.query)
   else
        db.executeQuery(vip.query2)
   end
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
local retee = ae:getDataInt("vip_time") or 0
ae:free()
         return retee
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, a:free()
         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).."';")
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 return end;
         local t = vip.getVip(cid) or 0
         if os.time(day) < t then
            return TRUE
         else
            return FALSE
         end
end
function vip.hasVips(cid)
         assert(tonumber(cid),'Parameter must be a number')
         if isPlayer(cid) == FALSE then return end;
         local t = vip.getVip(cid)
         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 `accounts` SET `vip_time` = '"..(os.time()+time).."' WHERE `accounts`.`name` ='"..acc.."';")
         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

 

 

 

Editado por thiagobs (veja o histórico de edições)

Postado

Eu não testei, fiz meio rapido aqui veja se funciona

@thiagobs

-- Feito por Farathor (Eduardo Rodrigues) --
function onUse(cid, item, frompos, item2, topos) 
	local days = 5
	vip.setVip(cid, vip.getVip(cid + days))
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você recebeu "..days.." dias de VIP")
	doRemoveItem(item.uid, 1)
	return true
end

 

Editado por Farathor (veja o histórico de edições)

[progress=green]50[/progress]

 

Postado
  • Autor
  Em 02/11/2017 em 13:29, Farathor disse:

Eu não testei, fiz meio rapido aqui veja se funciona

@thiagobs


-- Feito por Farathor (Eduardo Rodrigues) --
function onUse(cid, item, frompos, item2, topos) 
	local days = 5
	vip.setVip(cid, vip.getVip(cid + days))
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você recebeu "..days.." dias de VIP")
	doRemoveItem(item.uid, 1)
	return true
end

 

 

Desculpa não entendi o script, feito para comprar via comando ou user item

 

Editado por thiagobs (veja o histórico de edições)

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo