[Anti Clone System]

W0lfer
Por W0lfer
em Globalevents e Spells

W0lfer

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 28/10/12Posts: 43

Aqui neste tópico postarei para voces um Script "anti clone". Ele NÃO evitará o clone mas com ele você poderá verificar os items clonados e deleta-los.

 

Primeiro vá em data/lib/functions.lua e coloque antes ou depois da ultima function:

 

function generateSerial()
local strings = "AaBbCcDdEeFfGgHhIiJjKkLlMmOoPpQqRrSsTtUuVvWwXxYyZz"
local newSerialStr, newSerialInt = "", 0
local newSerial = ""
local query, query2, query3
repeat
for k = 1, math.random(1, 10) do
local l = math.random(1, string.len(strings))
newSerialStr = newSerialStr .. string.sub(strings, l, l)
end
newSerialInt = math.random(999999)
newSerial = newSerialStr .. "-" .. newSerialInt
query = db.getResult("select * from player_items where substring(convert(attributes using latin1) from 18) = " .. db.escapeString(newSerial))
query2 = db.getResult("select * from player_depotitems where substring(convert(attributes using latin1) from 18) = " .. db.escapeString(newSerial))
query3 = db.getResult("select * from tile_items where substring(convert(attributes using latin1) from 18) = " .. db.escapeString(newSerial))
until query:getID() == -1 and query2:getID() == -1 and query3:getID() == -1
return "!" .. newSerial
end

 

Agora em Globalevents/Scripts crie um arquivo track.lua e coloque dentro:

 

tablesToCheck = {"player_items", "player_depotitems", "tile_items", {"player_items", {"player_depotitems", "tile_items"}}, {"player_depotitems", "tile_items"}}

function onstartup()
local text, final = "", ""
local filex = "data/logs/duplicated.txt"
local f = io.open(filex, "a+")
local count = 0
for i = 1, table.maxn(tablesToCheck) do
if type(tablesToCheck[i]) == "string" then
local query = db.getResult("SELECT *, SUBSTRING(CONVERT(attributes USING latin1) FROM 18) AS 'track' FROM " .. tablesToCheck[i] .. " WHERE SUBSTRING(CONVERT(attributes USING latin1) FROM 18) IN (SELECT SUBSTRING(CONVERT(attributes USING latin1) FROM 18) FROM " .. tablesToCheck[i] .. " WHERE CONVERT(attributes USING latin1) LIKE '%serial%' GROUP BY SUBSTRING(CONVERT(attributes USING latin1) FROM 18) HAVING COUNT(*) > 1)")
if query:getID() ~= -1 then
while(true) do
 local delete = db.executeQuery("delete from " .. tablesToCheck[i] .. " where SUBSTRING(CONVERT(attributes USING latin1) FROM 18) = " .. db.escapeString(query:getDataString("track")) .. " and player_id = " .. query:getDataInt("player_id") .. ";")
 text = "[!] -> Deleting items with duplicated serial from '" .. tablesToCheck[i] .. "': [Player: " .. getPlayerNameByGUID(query:getDataInt("player_id")) .. ", Item: " .. query:getDataInt("itemtype") .. ", Count: " .. query:getDataInt("count") .. ", Serial: " .. query:getDataString("track") .."]... " .. (delete and "Success!" or "Failed!")
 count = (delete and count + 1 or count)
 final = final .. (final ~= "" and "\n" or "") .. text
 print(text)
 if not query:next() then break end
end
end
else
if type(tablesToCheck[i][2]) == "string" then
local query = db.getResult("SELECT *, SUBSTRING(CONVERT(attributes USING latin1) FROM 18) AS 'track' FROM " .. tablesToCheck[i][1] .. " WHERE SUBSTRING(CONVERT(attributes USING latin1) FROM 18) IN (SELECT SUBSTRING(CONVERT(attributes USING latin1) FROM 18) FROM " .. tablesToCheck[i][2] .. " WHERE CONVERT(attributes USING latin1) LIKE '%serial%' GROUP BY SUBSTRING(CONVERT(attributes USING latin1) FROM 18) HAVING COUNT(*) > 0)")
if query:getID() ~= -1 then
 while(true) do
 local query_ = db.getResult("SELECT *, SUBSTRING(CONVERT(attributes USING latin1) FROM 18) AS 'track' FROM " .. tablesToCheck[i][2] .. " WHERE SUBSTRING(CONVERT(attributes USING latin1) FROM 18) IN (SELECT SUBSTRING(CONVERT(attributes USING latin1) FROM 18) FROM " .. tablesToCheck[i][1] .. " WHERE CONVERT(attributes USING latin1) LIKE '%serial%' GROUP BY SUBSTRING(CONVERT(attributes USING latin1) FROM 18) HAVING COUNT(*) > 0)")
 local delete = db.executeQuery("delete from " .. tablesToCheck[i][1] .. " where SUBSTRING(CONVERT(attributes USING latin1) FROM 18) = " .. db.escapeString(query:getDataString("track")) .. ";")
 count = (delete and count + 1 or count)
 local delete2 = db.executeQuery("delete from " .. tablesToCheck[i][2] .. " where SUBSTRING(CONVERT(attributes USING latin1) FROM 18) = " .. db.escapeString(query:getDataString("track")) .. ";")
 count = (delete2 and count + 1 or count)
 text = "[!] -> Deleting item with duplicated serial from '" .. tablesToCheck[i][1] .. "' [Player: " .. getPlayerNameByGUID(query:getDataInt("player_id")) .. ", Item: " .. query:getDataInt("itemtype") .. ", Count: " .. query:getDataInt("count") .. ", Serial: " .. query:getDataString("track") .."]... " .. (delete and "Success!" or "Failed!") ..
 "\n[!] -> Deleting item with duplicated serial from '" .. tablesToCheck[i][2] .. "' [Player: " .. getPlayerNameByGUID(query_:getDataInt("player_id")) .. ", Item: " .. query_:getDataInt("itemtype") .. ", Count: " .. query_:getDataInt("count") .. ", Serial: " .. query_:getDataString("track") .."]... " .. (delete and "Success!" or "Failed!")
 final = final .. (final ~= "" and "\n" or "") .. text
 print(text)
 if not query:next() then break end
 end
end
else
for j = 1, #tablesToCheck[i][2] do
 local query = db.getResult("SELECT *, SUBSTRING(CONVERT(attributes USING latin1) FROM 18) AS 'track' FROM " .. tablesToCheck[i][1] .. " WHERE SUBSTRING(CONVERT(attributes USING latin1) FROM 18) IN (SELECT SUBSTRING(CONVERT(attributes USING latin1) FROM 18) FROM " .. tablesToCheck[i][2][j] .. " WHERE CONVERT(attributes USING latin1) LIKE '%serial%' GROUP BY SUBSTRING(CONVERT(attributes USING latin1) FROM 18) HAVING COUNT(*) > 0)")
 if query:getID() ~= -1 then
 while(true) do
 local query_ = db.getResult("SELECT *, SUBSTRING(CONVERT(attributes USING latin1) FROM 18) AS 'track' FROM " .. tablesToCheck[i][2][j] .. " WHERE SUBSTRING(CONVERT(attributes USING latin1) FROM 18) IN (SELECT SUBSTRING(CONVERT(attributes USING latin1) FROM 18) FROM " .. tablesToCheck[i][1] .. " WHERE CONVERT(attributes USING latin1) LIKE '%serial%' GROUP BY SUBSTRING(CONVERT(attributes USING latin1) FROM 18) HAVING COUNT(*) > 0)")
 local delete = db.executeQuery("delete from " .. tablesToCheck[i][1] .. " where SUBSTRING(CONVERT(attributes USING latin1) FROM 18) = " .. db.escapeString(query:getDataString("track")) .. ";")
 count = (delete and count + 1 or count)
 local delete2 = db.executeQuery("delete from " .. tablesToCheck[i][2][j] .. " where SUBSTRING(CONVERT(attributes USING latin1) FROM 18) = " .. db.escapeString(query:getDataString("track")) .. ";")
 count = (delete2 and count + 1 or count)
 text = "[!] -> Deleting item with duplicated serial from '" .. tablesToCheck[i][1] .. "' [Player: " .. getPlayerNameByGUID(query:getDataInt("player_id")) .. ", Item: " .. query:getDataInt("itemtype") .. ", Count: " .. query:getDataInt("count") .. ", Serial: " .. query:getDataString("track") .."]... " .. (delete and "Success!" or "Failed!") ..
 "\n[!] -> Deleting item with duplicated serial from '" .. tablesToCheck[i][2][j] .. "' [Player: " .. getPlayerNameByGUID(query_:getDataInt("player_id")) .. ", Item: " .. query_:getDataInt("itemtype") .. ", Count: " .. query_:getDataInt("count") .. ", Serial: " .. query_:getDataString("track") .."]... " .. (delete and "Success!" or "Failed!")
 final = final .. (final ~= "" and "\n" or "") .. text
 print(text)
 if not query:next() then break end
 end
 end
end
end
end
end
if f ~= nil then
f:write("[" .. os.date("%d %B %Y %X ", os.time()) .. "] >> [Anti-Dupe] " .. count .. " duplicated items have been deleted from the database.\n" .. (final == "" and "[!] -> No duplicated item was found in the database" or final) .. "\n\n")
f:close()
else
print("[!] -> [Anti-Dupe] Cannot save info to file!")
end
return true
end

 

e em Globalvents.xml

 

<globalevent name="trackitems" type="start" event="script" value="trackitems.lua"/>

 

Para "adicionar" a table Serial na Database execute essa query:

 

SELECT * , SUBSTRING( CONVERT( attributes
USING latin1 )
FROM 18 ) AS 'serial'
FROM player_items
WHERE CONVERT( attributes

 

ippb3n.png

 

Para verificar os items duplicados execute essa query:

 

--Use this command to see duplicated items on players inventory
SELECT * , SUBSTRING( CONVERT( attributes
USING latin1 )
FROM 18 ) AS 'duplicated serials'
FROM player_items
WHERE SUBSTRING( CONVERT( attributes
USING latin1 )
FROM 18 )
IN (

SELECT SUBSTRING( CONVERT( attributes
USING latin1 )
FROM 18 )
FROM player_items
WHERE CONVERT( attributes
USING latin1 ) LIKE '%serial%'
GROUP BY SUBSTRING( CONVERT( attributes
USING latin1 )
FROM 18 )
HAVING COUNT( * ) >1
)

--Use this command to see duplicated items on players inventory or depot items
SELECT * , SUBSTRING( CONVERT( attributes
USING latin1 )
FROM 18 ) AS 'duplicated serials'
FROM player_items
WHERE SUBSTRING( CONVERT( attributes
USING latin1 )
FROM 18 )
IN (

SELECT SUBSTRING( CONVERT( attributes
USING latin1 )
FROM 18 )
FROM player_depotitems
WHERE CONVERT( attributes
USING latin1 ) LIKE '%serial%'
GROUP BY SUBSTRING( CONVERT( attributes
USING latin1 )
FROM 18 )
HAVING COUNT( * ) >1
)

--Use this command to see duplicated items on players depots
SELECT * , SUBSTRING( CONVERT( attributes
USING latin1 )
FROM 18 ) AS 'duplicated serials'
FROM player_depotitems
WHERE SUBSTRING( CONVERT( attributes
USING latin1 )
FROM 18 )
IN (

SELECT SUBSTRING( CONVERT( attributes
USING latin1 )
FROM 18 )
FROM player_depotitems
WHERE CONVERT( attributes
USING latin1 ) LIKE '%serial%'
GROUP BY SUBSTRING( CONVERT( attributes
USING latin1 )
FROM 18 )
HAVING COUNT( * ) >1
)

--Use this command to see duplicated items on player_items and player_depotitems (Example of usage)
--Use this command to see duplicated items on players depots
SELECT * , SUBSTRING( CONVERT( attributes
USING latin1 )
FROM 18 ) AS 'duplicated serials'
FROM player_items
WHERE SUBSTRING( CONVERT( attributes
USING latin1 )
FROM 18 )
IN (

SELECT SUBSTRING( CONVERT( attributes
USING latin1 )
FROM 18 )
FROM player_depotitems
WHERE CONVERT( attributes
USING latin1 ) LIKE '%serial%'
GROUP BY SUBSTRING( CONVERT( attributes
USING latin1 )
FROM 18 )
HAVING COUNT( * ) >0

 

709ovs.png

 

Créditos: Darkhaos

"O sucesso é apenas uma consequência!"

 

banner2.png

 

 

VPS 4GB RAM POR APENAS 90,00 COM DOMINIO GRATIS



 

VPS 3GB RAM POR APENAS 80,00 COM DOMINIO GRATIS

 

100% QUALIDADE E PREÇO JUSTO

 

MSN: CONTATO@OTMAKER.COM

GodalonexD

é Melhor
avatar
Barão
Barão

INFOS

Grupo: BarãoRegistrado: 23/03/08Posts: 205

ta mais alguem ja testo?

 

e outra voce nao colocou como vamo implantar isso em nosso otserv...

 

tipo comprar no shop e fica com serial...

Ajudei? da REP+

Custa nada!

W0lfer

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 28/10/12Posts: 43

E atravez das querys que coloquei !

"O sucesso é apenas uma consequência!"

 

banner2.png

 

 

VPS 4GB RAM POR APENAS 90,00 COM DOMINIO GRATIS



 

VPS 3GB RAM POR APENAS 80,00 COM DOMINIO GRATIS

 

100% QUALIDADE E PREÇO JUSTO

 

MSN: CONTATO@OTMAKER.COM

DinoAdmin

Ex Estagiário de Scripting
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 27/07/12Posts: 757Char no Tibia: [ADM] Bhoris

milbradt

Desativado
avatar
Cavaleiro
Cavaleiro

INFOS

Grupo: CavaleiroRegistrado: 04/12/09Posts: 188

Certeza q pra adiciona a tabela é só isso aki?

 

 

SELECT * , SUBSTRING( CONVERT( attributes
USING latin1 )
FROM 18 ) AS 'serial'
FROM player_items
WHERE CONVERT( attributes

Site NtoUltimate:

www.ntoultimate.com.br

W0lfer

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 28/10/12Posts: 43

Não adiciona tabela, ele apenas vai adicionar um serial em cada item.

"O sucesso é apenas uma consequência!"

 

banner2.png

 

 

VPS 4GB RAM POR APENAS 90,00 COM DOMINIO GRATIS



 

VPS 3GB RAM POR APENAS 80,00 COM DOMINIO GRATIS

 

100% QUALIDADE E PREÇO JUSTO

 

MSN: CONTATO@OTMAKER.COM

dragonfight

Sometimes I can't believe it
avatar
Barão
Barão

INFOS

Grupo: BarãoRegistrado: 12/09/10Posts: 249

alguem ja testou:?

tumblr_mbtch9L7iC1r2wtdzo1_500.jpg

Oneshot

avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 05/07/09Posts: 1347

Isso que dá copiar um script apenas para ganhar reputação. Não sabe explicar como instalar o script com eficiência para funcionar corretamente.

 

Do jeito que o Darkhaos fez, só é possível usar o sistema com MySQL.

 

Abraços.

AnikilatorShadow

avatar
Banidos
Banidos

INFOS

Grupo: BanidosRegistrado: 03/02/13Posts: 62Char no Tibia: Anikilator

Muito Bom!

Att:AnikilatorShadow

JasonLucas

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 03/01/12Posts: 32Char no Tibia: nick ant

Tenho um sistema aqui parecido com esse, porem muito mais complexo.

vudi

Deick
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 21/11/11Posts: 323Char no Tibia: Nao tenhu

Isso pega pra Poketibia 8.54 com SqlLite?

Metas
[]Fazer um milhão de Rep+
[] Hit na loteria
[] Mover para o Havaí
[] Ser famoso
[] Construir um carro Lamborghini kit
[] Criar um clone de mim mesmo / então eu não tenho que trabalhar

Tem um corno lendo essa frase. Ele vai ler até o fim porque além de corno é curioso e vai confirmar isso dando uma risadinha

bruno333

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 18/12/05Posts: 29

eu segui o tutorial como vc explicou ai ... sendo q quando eu vou executar

SELECT * , SUBSTRING( CONVERT( attributes

USING latin1 )

FROM 18 ) AS 'serial'

FROM player_items

WHERE CONVERT( attributes

no banco de dados ... da um erro

 

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 0, 30' at line 6

SELECT * , SUBSTRING( CONVERT( attributes

USING latin1 )

FROM 18 ) AS 'serial'

FROM player_items

WHERE CONVERT( attributes

LIMIT 0 , 30

 

 

eu estou usando o xampp 1.7.3

 

alguem pode me ajudar ????