TAG para este Globalevents

julhinhuu
em Scripts

julhinhuu

Sempre em busca de novidades
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 28/06/11Posts: 352Char no Tibia: Akor Rysea

Alguém poderia criar uma tag para este script:

function onThink()
    
if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then
        
setGlobalStorageValue(23456, (tonumber(os.date("%d"))))
        
db.executeQuery("UPDATE `players` SET `onlinetime7`=`onlinetime6`, `onlinetime6`=`onlinetime5`, `onlinetime5`=`onlinetime4`, `onlinetime4`=`onlinetime3`, `onlinetime3`=`onlinetime2`, `onlinetime2`=`onlinetime1`, `onlinetime1`=`onlinetimetoday`, `onlinetimetoday`=0;")
        
db.executeQuery("UPDATE `players` SET `exphist7`=`exphist6`, `exphist6`=`exphist5`, `exphist5`=`exphist4`, `exphist4`=`exphist3`, `exphist3`=`exphist2`, `exphist2`=`exphist1`, `exphist1`=`experience`-`exphist_lastexp`, `exphist_lastexp`=`experience`;")
    end
    
db.executeQuery("UPDATE `players` SET `onlinetimetoday`=`onlinetimetoday`+60, `onlinetimeall`=`onlinetimeall`+60 WHERE `online` = 1;")

end

Já tentei varias vezes e ainda não funcionou.

 

jvcasarin

Exorcizamus te
avatar
Barão
Barão

INFOS

Grupo: BarãoRegistrado: 13/07/15Posts: 242Char no Tibia: Sekk
<globalevent type="start" name="XXXX" script="script.lua"/>

???

Te ajudei? Da um REP+ que me ajuda bastante  biggrin.png

julhinhuu

Sempre em busca de novidades
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 28/06/11Posts: 352Char no Tibia: Akor Rysea
<globalevent type="start" name="XXXX" script="script.lua"/>

???

 

 

Function é onThink.

Conseguir fazer mais está dando erro é no script mesmo, ajuda ai você entende de website.

Script (globalevent, type: think, interval: 60 or 60000 [tfs 0.4]):
function onThink()
    if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then
        setGlobalStorageValue(23456, (tonumber(os.date("%d"))))
        db.query("UPDATE `players` SET `onlinetime7`=`onlinetime6`, `onlinetime6`=`onlinetime5`, `onlinetime5`=`onlinetime4`, `onlinetime4`=`onlinetime3`, `onlinetime3`=`onlinetime2`, `onlinetime2`=`onlinetime1`, `onlinetime1`=`onlinetimetoday`, `onlinetimetoday`=0;")
        db.query("UPDATE `players` SET `exphist7`=`exphist6`, `exphist6`=`exphist5`, `exphist5`=`exphist4`, `exphist4`=`exphist3`, `exphist3`=`exphist2`, `exphist2`=`exphist1`, `exphist1`=`experience`-`exphist_lastexp`, `exphist_lastexp`=`experience`;")
    end
    db.query("UPDATE `players` SET `onlinetimetoday`=`onlinetimetoday`+60, `onlinetimeall`=`onlinetimeall`+60 WHERE `online` = 1;")
end

MySQL:
ALTER TABLE `players` ADD `exphist_lastexp` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `exphist1` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `exphist2` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `exphist3` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `exphist4` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `exphist5` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `exphist6` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `exphist7` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `onlinetimetoday` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `onlinetime1` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `onlinetime2` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `onlinetime3` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `onlinetime4` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `onlinetime5` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `onlinetime6` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `onlinetime7` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `onlinetimeall` BIGINT( 20 ) NOT NULL DEFAULT '0';

Yan Liima

Scripter,Programador,WebMaster.
avatar
Diretor
Diretor

INFOS

Grupo: DiretorRegistrado: 12/05/12Posts: 818Gênero: MasculinoChar no Tibia: [ADM] Night

Informe o erro...

 

Tente assim:

function onThink()
    if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then
        setGlobalStorageValue(23456, (tonumber(os.date("%d"))))
        db.executeQuery("UPDATE `players` SET `onlinetime7`=`onlinetime6`, `onlinetime6`=`onlinetime5`, `onlinetime5`=`onlinetime4`, `onlinetime4`=`onlinetime3`, `onlinetime3`=`onlinetime2`, `onlinetime2`=`onlinetime1`, `onlinetime1`=`onlinetimetoday`, `onlinetimetoday`=0;")
        db.executeQuery("UPDATE `players` SET `exphist7`=`exphist6`, `exphist6`=`exphist5`, `exphist5`=`exphist4`, `exphist4`=`exphist3`, `exphist3`=`exphist2`, `exphist2`=`exphist1`, `exphist1`=`experience`-`exphist_lastexp`, `exphist_lastexp`=`experience`;")
    end
    db.executeQuery("UPDATE `players` SET `onlinetimetoday`=`onlinetimetoday`+60, `onlinetimeall`=`onlinetimeall`+60 WHERE `online` = 1;")
end

════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═══╗

ALGUNS DOS MEUS TRABALHOS:

Spoiler

WODBOHS[DOWNLOAD]

Newstory dbo+nto+bleach[DOWNLOAD]

 

>> Mais infos <<

- Projetos lançados também feitos por mim {

DBO SKY

POKE SKY

WODBOWARS

Tic-tac-War

Dbo Universe(em desenvolvimento)

}

universe.thumb.png.6840320998d0fc1a4652b3db81a585c0.png

Separador.PNG

Te Ajudei? Rep + e ficamos Quits

imageproxy.png.84dce08dd18d31663a72aa1ce37b858a.png

Precisando de ajuda?

discord.png.1ecd188791d0141f74d99db371a2e0a4.pngDiscord: Yan Liima #3702

Programador Júnior de LUA, PHP e JavaScript

Juntos somos lendas, separados somos Mitos!

╚══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═════════════════════════════╝

julhinhuu

Sempre em busca de novidades
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 28/06/11Posts: 352Char no Tibia: Akor Rysea

 

Informe o erro...

 

Tente assim:

function onThink()
    if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then
        setGlobalStorageValue(23456, (tonumber(os.date("%d"))))
        db.executeQuery("UPDATE `players` SET `onlinetime7`=`onlinetime6`, `onlinetime6`=`onlinetime5`, `onlinetime5`=`onlinetime4`, `onlinetime4`=`onlinetime3`, `onlinetime3`=`onlinetime2`, `onlinetime2`=`onlinetime1`, `onlinetime1`=`onlinetimetoday`, `onlinetimetoday`=0;")
        db.executeQuery("UPDATE `players` SET `exphist7`=`exphist6`, `exphist6`=`exphist5`, `exphist5`=`exphist4`, `exphist4`=`exphist3`, `exphist3`=`exphist2`, `exphist2`=`exphist1`, `exphist1`=`experience`-`exphist_lastexp`, `exphist_lastexp`=`experience`;")
    end
    db.executeQuery("UPDATE `players` SET `onlinetimetoday`=`onlinetimetoday`+60, `onlinetimeall`=`onlinetimeall`+60 WHERE `online` = 1;")
end

aqui o erro:

post-321783-0-79633700-1455150550_thumb.png

Skulls

Coordenador de Eventos
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 26/02/07Posts: 859Gênero: Masculino

Coluna online não existe ali.

julhinhuu

Sempre em busca de novidades
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 28/06/11Posts: 352Char no Tibia: Akor Rysea

Coluna online não existe ali.

 

Manda a coluna pra mim adicionar ai mano :D

Skulls

Coordenador de Eventos
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 26/02/07Posts: 859Gênero: Masculino

 

Manda a coluna pra mim adicionar ai mano :D

Abre seu banco de dados e ve se em players tem uma coluna chamada "online"

julhinhuu

Sempre em busca de novidades
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 28/06/11Posts: 352Char no Tibia: Akor Rysea

Abre seu banco de dados e ve se em players tem uma coluna chamada "online"

Tem não.

Skulls

Coordenador de Eventos
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 26/02/07Posts: 859Gênero: Masculino

Tem não.

O erro ta ai, então. rs mas não sei arrumar isso não, pq mesmo que você crie uma coluna online tem que mandar o servidor atualizar ela quando o player estiver online e quando ele deixar de estar.

Night Wolf

Coordenador de Desenvolvimento
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 14/02/14Posts: 341Gênero: MasculinoChar no Tibia: Night Wolf

a tag é assim

<globalevent name="xxxx" interval="60" event="script" value="yyyyyy.lua"/>

I9AtE9T.png
/NW