Ir para conteúdo

[Creaturescripts] 3 Dias Vip A Todas Accounts.


Isbigo

Posts Recomendados

Olá galera do :XTibia_smile: .

 

Vamos la.

 

Gostaria que alguem pode-se me conseguir o script citado:

 

O que ele faz:

Da 3 dias vip para todas as accounts criandas.

 

Explicação:

Ela tem que dar apenas paras as accounts, para que o players não fique recebendo VIP por ficar criando character na mesma acc.

 

Meus sistemas:

Name = "Vip system";
author = "Mock";
Version = "1.0.0.0";

 

Scripts lib: 049-vipsys

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.query(vip.query)
  else
       db.query(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.query("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.query("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

 

Creaturescript: VIP

function onLogin(cid)
local pos = {x=32360, y=31782, z=7}
pos = {x=32360, y=31782, z=7}
if vip.hasVip(cid) == TRUE then
if getPlayerStorageValue(cid,55555) ~= 1 then
setPlayerStorageValue(cid,55555,1)
end
elseif vip.hasVip(cid) ~= TRUE and vip.getVip(cid) ~= 0 then
if getPlayerStorageValue(cid,55555) == 1 then
doTeleportThing(cid, pos, TRUE)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your VIP's over!")
doPlayerSendTextMessage(cid,22,"Your VIP's over!")
setPlayerPromotionLevel(cid, 1)
setPlayerStorageValue(cid,55555,2)
elseif getPlayerStorageValue(cid,55555) == -1 then
setPlayerStorageValue(cid,55555,2)
end
end
return TRUE
end

 

 

 

Quem puder me ajudar REP+ :button_ok:

Editado por Isbigo
Link para o comentário
Compartilhar em outros sites

  • 6 months later...

Vai em "data/creaturescripts/scripts" duplica um arquivo e renomeia para "vipgain" sem as aspas e nele cole:

function onLogin(cid)

if (getPlayerStorageValue(cid, 203021) <= 0) then
   vip.setVip(cid,3)
   doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT,"Você ganhou 3 dias vips!")
   setPlayerStorageValue(cid, 203021, 1)
end

return TRUE
end

 

Agora em "data/creaturescripts/creaturescripts.xml" cola a tag:

<event type="login" name="VipGain" event="script" value="vipgain.lua"/>

 

É isso aew! happy.png

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...