on for tfs 1.2?
- Fórum
- OTServ
- Recursos
- Scripting
- Mods, funções e outros
- Multi Language System
5
4.1k
1 ano depois...
info
Grupo: Campones
Registrado: 24/09/15
Posts: 7
Reputação: 0

11 de abril de 2017 às 19:45
info
Grupo: Conde
Registrado: 14/04/15
Posts: 956
Reputação: +333
Gênero: Masculino

12 de abril de 2017 às 16:48
20 horas atrás, daniofordon disse:on for tfs 1.2?
Will be need only some edits to work on TFS 1.2
2 meses depois...
info
Grupo: Campones
Registrado: 24/09/15
Posts: 7
Reputação: 0

19 de junho de 2017 às 18:32
Em 12.04.2017 at 21:48, Drazyn disse:Will be need only some edits to work on TFS 1.2
Hello:) or gave you the trick is to convert the TFS 1.3?
info
Grupo: Conde
Registrado: 14/04/15
Posts: 956
Reputação: +333
Gênero: Masculino

19 de junho de 2017 às 21:20
2 horas atrás, daniofordon disse:Hello:) or gave you the trick is to convert the TFS 1.3?
Everything what you do on TFS 1.2, this will work on TFS 1.3
But i don't have time to convert for my self and post it. My time is limited and i am giving her on my server.


info
Grupo: Conde
Registrado: 14/04/15
Posts: 956
Reputação: +333
Gênero: Masculino
Eae Xtibianos! Td na paz? Eu vim aqui para postar um script que achei na net do sistema de Multi Linguagem, eu creio que seja o primeiro do fórum, eu vi que o Zipter, fez um em um pedido, porém ele não funciona da mesma forma que este.
Então vamos começar...
Primeiramente Execute este código na sua database:
ALTER TABLE `accounts` ADD `language` INT( 11 ) NOT NULL DEFAULT '0'
Agora em data/lib/050-function.lua no final do arquivo adicione este código:
function getPlayerLanguage(cid) -- By Acubens
local Lang = db.getResult("SELECT `language` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
if Lang:getID() ~= LUA_ERROR then
local langid = Lang:getDataInt("language")
Lang:free()
return langid
end
return LUA_ERROR
end
function doPlayerSetLanguage(cid, new) -- By Drazyn1291
local acc = getPlayerAccountId(cid)
if new == 2 then
db.executeQuery("UPDATE `accounts` SET language = 2 WHERE `id` = " .. acc)
elseif new == 1 then
db.executeQuery("UPDATE `accounts` SET language = 1 WHERE `id` = " .. acc)
else
db.executeQuery("UPDATE `accounts` SET language = 0 WHERE `id` = " .. acc)
end
end
Agora em Agora em lib/000-constant.lua Adicione isso no final do arquivo:
ENGLISH = 0
SPANISH = 1
PORTUGUES = 2
Você pode criar suas linguagem com os ID's acima!
Funções:
getPlayerLanguage(cid) -- By Acubens
doPlayerSetLanguage(cid, new) -- By Drazyn1291
Creio que só de ler a função já saibam oque faz né??
Exemplo:
function onLogin(cid) -- By Drazyn
local msg = {
[PORTUGUES] = {"Bem-Vindo!"},
[sPANISH] = {"Bienvenida"},
[ENGLISH] = {"Welcome!"}
}
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, msg[getPlayerLanguage(cid)][1])
return true
end
Testado no Tfs 0.4
Créditos:
Acubens -- Por Criar o sistema
Drazyn1291 -- Por criar a função doPlayerSetLanguage(cid, new) e pelo Exemplo!
Editado Agosto 19 por Drazyn