
Histórico de Curtidas
-
MySticaL recebeu reputação de deza em [0.3.6] Função doPlayerOpenChannelEDITADO REMOVIDO A VERSÃO 0.4 QUE CONTIA!
SE QUISER A VERSÃO 0.4 SÓ VER NO PERFIL DO ALEXY.
Oi, vim trazer a função doPlayerOpenChannel para tfs 0.3.6
Essa função nada mais é que quando o player loga abre os chat selecionado no login.lua automaticamente
Essa função é para 0.3.6
Versões testada: 8.54
Vamos ao código
em LuaScript.cpp
Procure:
//getChannelUsers(channelId) lua_register(m_luaState, "getChannelUsers", LuaScriptInterface::luaGetChannelUsers); Adicione em baixo:
//doPlayerOpenChannel(cid, channelId) lua_register(m_luaState, "doPlayerOpenChannel", LuaScriptInterface::luaDoPlayerOpenChannel); Continuando procure:
int32_t LuaScriptInterface::internalGetPlayerInfo(lua_State* L, PlayerInfo_t info) Acima adicione:
int32_t LuaScriptInterface::luaDoPlayerOpenChannel(lua_State* L) { //doPlayerOpenChannel(cid, channelId) uint32_t channelId = popNumber(L); uint32_t cid = popNumber(L); ScriptEnviroment* env = getEnv(); Player* player = env->getPlayerByUID(cid); if(player) lua_pushnumber(L, g_game.playerOpenChannel(cid, channelId) ? true : false); else { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushnumber(L, false); } return 1; } Agora em LuaScript.h
Procure por:
static int32_t luaGetChannelUsers(lua_State* L); abaixo adicione:
static int32_t luaDoPlayerOpenChannel(lua_State* L); Agora em data/creaturescripts/scripts/login.lua
Antes do último
return true Adicione:
doPlayerOpenChannel(cid, 7) -- 7 é o número do channel para ver é em data/xml/channels.xml
Rep não cai o dedo
-
MySticaL recebeu reputação de Espedito em [Action] Script QuestScript Quest:
--[[ Script: Exemplo de Quest Autor: MySticaL Email: [email protected] ]] function onUse(cid, item, frompos, item2, topos) -- Não mecha. storage = 938312 -- Storage a cada quest que for criada aumente um numero da storage pra qnd vc pegar o baú de outra quest ñ aparecer que vc já fez. item = 2160 -- Id do item ira ganhar. quantidade = 1 -- Quantidade ira ganhar. level = 5 -- Level que precisa pra fazer. if getPlayerLevel(cid) >= level and getPlayerStorageValue(cid,storage) == -1 then -- Não mecha. doPlayerSendTextMessage(cid,25,"Você ganhou um pouco de dinheiro") -- Mensagem que aparecera quando ganhar o item. doPlayerAddItem(cid, item, quantidade) -- Não mecha. setPlayerStorageValue(cid,storage,1) -- Não mecha. elseif getPlayerLevel(cid) <= level then -- Não mecha doPlayerSendTextMessage(cid,25,"Você precisa ser level 5 ou mais.") -- Mensagem que ira aparecer se o player tiver menos level que o necessario. elseif getPlayerStorageValue(cid,storage) >= 1 then -- Não mecha. doPlayerSendTextMessage(cid,25,"Você já fez está quest") -- Quando tentar pegar mais de uma vez o baú. end return true end Actions.xml
<action actionid="3123" event="script" value="script.lua"/> Obs: O actionid="3123" é o que você deve botar no item no Remeres Map Editor
Caso você queria criar outra quest aumente a storage no script e o id no actions.xml !
Como configurar ?
R- \/
================================================================================================================================
storage = 938312 -- Storage a cada quest que for criada aumente um numero da storage pra quando você for pegar o baú de outra quest não aparecer que você já fez.
================================================================================================================================
item = 2160 -- Id do item ira ganhar.
======================================================
quantidade = 1 -- Quantidade ira ganhar.
======================================================
level = 5 -- Level que precisa pra fazer.
======================================================
Script bem simples mais irá ajudar alguns membros.
Rep não cai o dedo
Não sei muito sobre script.
100% Créditos meu caso for postar em outro lugar deixe os créditos para min !
Desculpem o tópico mal arrumado
-
MySticaL recebeu reputação de XGaduX em |Torneio| erro na premiação!para que ele seja teleportado é só fazer uma modificação no onUse
function onUse(cid, item) local pos = {x = 1227, y = 1754, z = 7} -- Posição pra onde ele vai ir ao clicar na porta ou outro objeto if #getCreatureSummons(cid) >= 1 then doPlayerSendCancel(cid, "Retire seu summon!") return true end if #getPlayersInArea(torneio.area) == 1 then doTeleportThing(cid, pos) doBroadcastMessage("[Torneio] Parabéns ao treinador "..getCreatureName(cid).." foi o ganhador do torneio de hoje, verifique o rank em nosso site www.seusite.com!") doPlayerAddItem(cid,2148,300) doPlayerAddItem(cid, torneio.awardTournament, torneio.awardAmount) else doPlayerSendTextMessage(cid, 20 ,"Só o ultimo que ficar na arena, poderá abrir está porta! ") end end
-
MySticaL recebeu reputação de Sparkyz em Outfit exclusivaDesculpa me intrometer, mas..
esse "1" em storageValue significa que se o valor da storage(1111) for igual a "1" é para aparecer a outfit, outros valores a não ser o valor definido não iriam aparecer a outfit.
por exemplo:
setPlayerStorageValue(cid, 1111, 1) -- CASO UM setPlayerStorageValue(cid, 1111, 0) -- CASO DOIS setPlayerStorageValue(cid, 1111, 2) -- CASO TRES O CASO UM iria aparecer a outfit para o player, já o CASO DOIS e CASO TRES não.
-
MySticaL recebeu reputação de XGaduX em Item com dia/minutostava vendo aqui isso é nas sources (item.cpp)
if(item && item->hasIntegerAttribute("duration")) { int32_t duration = item->getDuration() / 1000; s << " that has energy for "; if(duration >= 120) s << duration / 60 << " minutes left"; else if(duration > 60) s << "1 minute left"; else s << " less than a minute left"; }
-
MySticaL recebeu reputação de ZeeroBR em [Action] Script QuestScript Quest:
--[[ Script: Exemplo de Quest Autor: MySticaL Email: [email protected] ]] function onUse(cid, item, frompos, item2, topos) -- Não mecha. storage = 938312 -- Storage a cada quest que for criada aumente um numero da storage pra qnd vc pegar o baú de outra quest ñ aparecer que vc já fez. item = 2160 -- Id do item ira ganhar. quantidade = 1 -- Quantidade ira ganhar. level = 5 -- Level que precisa pra fazer. if getPlayerLevel(cid) >= level and getPlayerStorageValue(cid,storage) == -1 then -- Não mecha. doPlayerSendTextMessage(cid,25,"Você ganhou um pouco de dinheiro") -- Mensagem que aparecera quando ganhar o item. doPlayerAddItem(cid, item, quantidade) -- Não mecha. setPlayerStorageValue(cid,storage,1) -- Não mecha. elseif getPlayerLevel(cid) <= level then -- Não mecha doPlayerSendTextMessage(cid,25,"Você precisa ser level 5 ou mais.") -- Mensagem que ira aparecer se o player tiver menos level que o necessario. elseif getPlayerStorageValue(cid,storage) >= 1 then -- Não mecha. doPlayerSendTextMessage(cid,25,"Você já fez está quest") -- Quando tentar pegar mais de uma vez o baú. end return true end Actions.xml
<action actionid="3123" event="script" value="script.lua"/> Obs: O actionid="3123" é o que você deve botar no item no Remeres Map Editor
Caso você queria criar outra quest aumente a storage no script e o id no actions.xml !
Como configurar ?
R- \/
================================================================================================================================
storage = 938312 -- Storage a cada quest que for criada aumente um numero da storage pra quando você for pegar o baú de outra quest não aparecer que você já fez.
================================================================================================================================
item = 2160 -- Id do item ira ganhar.
======================================================
quantidade = 1 -- Quantidade ira ganhar.
======================================================
level = 5 -- Level que precisa pra fazer.
======================================================
Script bem simples mais irá ajudar alguns membros.
Rep não cai o dedo
Não sei muito sobre script.
100% Créditos meu caso for postar em outro lugar deixe os créditos para min !
Desculpem o tópico mal arrumado
-
MySticaL deu reputação a LeoTK em [Spell / cooldown] Channel própriaFala galera bom eu coloquei esse "sistema" recentemente no meu servidor e achei muito bacana então resolvi compartilhar com vocês que basicamente funciona da seguinte maneira quando o jogador usar a spell e subir o exaust de cooldown vai aparecer a mensagem no chat configurado assim não floodando o chat do default dos jogadores enfim vamos lá
Primeiramente vocês vão precisar editar a source
Source 0.3.6 8.54
Usem esse tópico do membro @MySticaL
Clique Aqui
Source 0.4 8.60
Usem esse tópico do membro @L3K0T
Clique Aqui
Após aplicar as configurações na source vamos configurar o servidor, criando um channel para spell no meu caso vou criar com nome registro de spells
Vá na pasta do seu servidor/data/xml/channel.xml
<?xml version="1.0" encoding="UTF-8"?> <channels> <channel id="11" active="no" logged="yes" name="Registro De Spells"/> </channels> Explicando: nessa configuração o jogador não vai poder falar no chat apenas ler o que aparece lá, no caso o cooldown das spells.
Agora vamos configurar a lib do servidor para registrar o novo channel
pasta do servidor/data/lib/000-constant.lua
procure por CHANNEL_HELP
e logo abaixo configure a sua nova channel.
Exemplo:
CHANNEL_HELP = 9
CHANNEL_SPELL = 10
Explicando: no caso o channel do help é o último então vamos aumentar um número depois dele deixando o channel da spell como 10
no meu caso ficando assim
CHANNEL_GUILD = 0 CHANNEL_PARTY = 1 CHANNEL_RVR = 3 CHANNEL_HELP = 9 CHANNEL_SPELL = 10 CHANNEL_DEFAULT = 0xFFFE CHANNEL_PRIVATE = 0xFFFF Após ter configurado essa parte vamos na pasta do servidor/data/creaturescripts/login.lua
dentro do login lua vamos até o final
antes do último return true coloque o seguinte código
doPlayerOpenChannel(cid, 4)
doPlayerOpenChannel(cid, 9)
doPlayerOpenChannel(cid, 10)
Explicando: usando essa configuração toda vez que o player entrar no servidor os channels 4, 9 e 10 vão abrir automaticamente no meu caso são os channels gamechat, help e spells
Após ter feito isso vamos adicionar o cooldown nas spells para enviar a mensagem para o channel
Obs: deixe o cooldown de todas as spells no spell.xml em 0 vamos adicionar o cooldown da spells no script de cada spell
Na script da spell embaixo de function onCastSpell(cid, var)
Adicione
local waittime = 1 local storage = 111102 if exhaustion.check(cid, storage) then doPlayerSendChannelMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde ".. exhaustion.get(cid, storage) .. " segundos para usar o jutsu novamente.", TALKTYPE_CHANNEL_O, CHANNEL_SPELL) return false end Explicando Waittime = 1 é o cooldown da spell que vai ser de 1 segundo
Storage é a storage que o jogador vai ter após usar a spell para contar os segundos (cada spell tem que ter a storage diferente)
doPlayerSendChannelMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde ".. exhaustion.get(cid, storage) .. " segundos para usar o jutsu novamente.", TALKTYPE_CHANNEL_O, CHANNEL_SPELL Nessa linha é onde vamos editar para a mensagem do cooldown ir para o channel no final da linha nesta parte
TALKTYPE_CHANNEL_O, CHANNEL_SPELL
Caso vocês usarem o mesmo nome que eu postei aqui não tem necessidade de mudar o channel apenas copiar e colar caso usarem outro nome mude o
CHANNEL_SPELL << o spell para o nome colocado na lib
Por fim no último return True do script da spell coloque
exhaustion.set(cid, storage, waittime)
e pronto assim que usar a spell e mostrar o cooldown vai ficar assim
Ficando assim não vai ficar floodando o chat default do seu servidor
Espero que tenham gostado
by: Brunds
Crédito pelas alterações na source aos membros
@MySticaL
@L3K0T
-
MySticaL recebeu reputação de LeoTK em [0.3.6] Função doPlayerOpenChannelEDITADO REMOVIDO A VERSÃO 0.4 QUE CONTIA!
SE QUISER A VERSÃO 0.4 SÓ VER NO PERFIL DO ALEXY.
Oi, vim trazer a função doPlayerOpenChannel para tfs 0.3.6
Essa função nada mais é que quando o player loga abre os chat selecionado no login.lua automaticamente
Essa função é para 0.3.6
Versões testada: 8.54
Vamos ao código
em LuaScript.cpp
Procure:
//getChannelUsers(channelId) lua_register(m_luaState, "getChannelUsers", LuaScriptInterface::luaGetChannelUsers); Adicione em baixo:
//doPlayerOpenChannel(cid, channelId) lua_register(m_luaState, "doPlayerOpenChannel", LuaScriptInterface::luaDoPlayerOpenChannel); Continuando procure:
int32_t LuaScriptInterface::internalGetPlayerInfo(lua_State* L, PlayerInfo_t info) Acima adicione:
int32_t LuaScriptInterface::luaDoPlayerOpenChannel(lua_State* L) { //doPlayerOpenChannel(cid, channelId) uint32_t channelId = popNumber(L); uint32_t cid = popNumber(L); ScriptEnviroment* env = getEnv(); Player* player = env->getPlayerByUID(cid); if(player) lua_pushnumber(L, g_game.playerOpenChannel(cid, channelId) ? true : false); else { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushnumber(L, false); } return 1; } Agora em LuaScript.h
Procure por:
static int32_t luaGetChannelUsers(lua_State* L); abaixo adicione:
static int32_t luaDoPlayerOpenChannel(lua_State* L); Agora em data/creaturescripts/scripts/login.lua
Antes do último
return true Adicione:
doPlayerOpenChannel(cid, 7) -- 7 é o número do channel para ver é em data/xml/channels.xml
Rep não cai o dedo
-
MySticaL deu reputação a KotZletY em [OPCODE] Opcode não funciona@MySticaL isso está errado:
g_game.getProtocolGame():sendExtendedOpcode(5, "pk") Caso o protocolgame não esteja inicializado vai retorna nil, e você estará chamando um método para uma userdata nula.
Correto:
local protocolGame = g_game.getProtocolGame() if protocolGame then protocolGame:sendExtendedOpcode(5, "pk") end
-
MySticaL deu reputação a KotZletY em [OPCODE] Opcode não funcionaEste tópico foi movido para a área correta. Esta é uma mensagem automática!
Pedimos que leia as regras do fórum!
@MySticaL onExtendedOpcode é um callback que precisa ser registrado no player!
-
MySticaL recebeu reputação de samuelandrade45 em [Action] Script QuestScript Quest:
--[[ Script: Exemplo de Quest Autor: MySticaL Email: [email protected] ]] function onUse(cid, item, frompos, item2, topos) -- Não mecha. storage = 938312 -- Storage a cada quest que for criada aumente um numero da storage pra qnd vc pegar o baú de outra quest ñ aparecer que vc já fez. item = 2160 -- Id do item ira ganhar. quantidade = 1 -- Quantidade ira ganhar. level = 5 -- Level que precisa pra fazer. if getPlayerLevel(cid) >= level and getPlayerStorageValue(cid,storage) == -1 then -- Não mecha. doPlayerSendTextMessage(cid,25,"Você ganhou um pouco de dinheiro") -- Mensagem que aparecera quando ganhar o item. doPlayerAddItem(cid, item, quantidade) -- Não mecha. setPlayerStorageValue(cid,storage,1) -- Não mecha. elseif getPlayerLevel(cid) <= level then -- Não mecha doPlayerSendTextMessage(cid,25,"Você precisa ser level 5 ou mais.") -- Mensagem que ira aparecer se o player tiver menos level que o necessario. elseif getPlayerStorageValue(cid,storage) >= 1 then -- Não mecha. doPlayerSendTextMessage(cid,25,"Você já fez está quest") -- Quando tentar pegar mais de uma vez o baú. end return true end Actions.xml
<action actionid="3123" event="script" value="script.lua"/> Obs: O actionid="3123" é o que você deve botar no item no Remeres Map Editor
Caso você queria criar outra quest aumente a storage no script e o id no actions.xml !
Como configurar ?
R- \/
================================================================================================================================
storage = 938312 -- Storage a cada quest que for criada aumente um numero da storage pra quando você for pegar o baú de outra quest não aparecer que você já fez.
================================================================================================================================
item = 2160 -- Id do item ira ganhar.
======================================================
quantidade = 1 -- Quantidade ira ganhar.
======================================================
level = 5 -- Level que precisa pra fazer.
======================================================
Script bem simples mais irá ajudar alguns membros.
Rep não cai o dedo
Não sei muito sobre script.
100% Créditos meu caso for postar em outro lugar deixe os créditos para min !
Desculpem o tópico mal arrumado
-
MySticaL recebeu reputação de joaobenhur em [Action] Script QuestScript Quest:
--[[ Script: Exemplo de Quest Autor: MySticaL Email: [email protected] ]] function onUse(cid, item, frompos, item2, topos) -- Não mecha. storage = 938312 -- Storage a cada quest que for criada aumente um numero da storage pra qnd vc pegar o baú de outra quest ñ aparecer que vc já fez. item = 2160 -- Id do item ira ganhar. quantidade = 1 -- Quantidade ira ganhar. level = 5 -- Level que precisa pra fazer. if getPlayerLevel(cid) >= level and getPlayerStorageValue(cid,storage) == -1 then -- Não mecha. doPlayerSendTextMessage(cid,25,"Você ganhou um pouco de dinheiro") -- Mensagem que aparecera quando ganhar o item. doPlayerAddItem(cid, item, quantidade) -- Não mecha. setPlayerStorageValue(cid,storage,1) -- Não mecha. elseif getPlayerLevel(cid) <= level then -- Não mecha doPlayerSendTextMessage(cid,25,"Você precisa ser level 5 ou mais.") -- Mensagem que ira aparecer se o player tiver menos level que o necessario. elseif getPlayerStorageValue(cid,storage) >= 1 then -- Não mecha. doPlayerSendTextMessage(cid,25,"Você já fez está quest") -- Quando tentar pegar mais de uma vez o baú. end return true end Actions.xml
<action actionid="3123" event="script" value="script.lua"/> Obs: O actionid="3123" é o que você deve botar no item no Remeres Map Editor
Caso você queria criar outra quest aumente a storage no script e o id no actions.xml !
Como configurar ?
R- \/
================================================================================================================================
storage = 938312 -- Storage a cada quest que for criada aumente um numero da storage pra quando você for pegar o baú de outra quest não aparecer que você já fez.
================================================================================================================================
item = 2160 -- Id do item ira ganhar.
======================================================
quantidade = 1 -- Quantidade ira ganhar.
======================================================
level = 5 -- Level que precisa pra fazer.
======================================================
Script bem simples mais irá ajudar alguns membros.
Rep não cai o dedo
Não sei muito sobre script.
100% Créditos meu caso for postar em outro lugar deixe os créditos para min !
Desculpem o tópico mal arrumado
-
MySticaL deu reputação a Tio Marshmello em Modificar imagem para item de slotOtimo Conteudo Lukão♥
-
MySticaL recebeu reputação de Tio Marshmello em Modificar imagem para item de slotAlguém ai poderia me ajudar no seguinte
Abaixo tem a imagem com 2 quadrados marcados 1 e 2, gostaria de mudar o 1 para aparecer com o item que tivesse no slot 2 (legs)
No .lua do module é o seguinte.
pokeinfowindow:getChildById('PT'):setItemId(portraiit) e no .otui
UIItem id: PT anchors.top: parent.top anchors.left: parent.left margin-left: 3 size: 40 40 margin-top: 35 margin-left: 13 phantom: false opacity: 2
Imagem:
Uma pa de rep pra quem ajudar e funfar! s2
-
MySticaL recebeu reputação de vanderley1234 em [0.3.6] Função doPlayerOpenChannelEDITADO REMOVIDO A VERSÃO 0.4 QUE CONTIA!
SE QUISER A VERSÃO 0.4 SÓ VER NO PERFIL DO ALEXY.
Oi, vim trazer a função doPlayerOpenChannel para tfs 0.3.6
Essa função nada mais é que quando o player loga abre os chat selecionado no login.lua automaticamente
Essa função é para 0.3.6
Versões testada: 8.54
Vamos ao código
em LuaScript.cpp
Procure:
//getChannelUsers(channelId) lua_register(m_luaState, "getChannelUsers", LuaScriptInterface::luaGetChannelUsers); Adicione em baixo:
//doPlayerOpenChannel(cid, channelId) lua_register(m_luaState, "doPlayerOpenChannel", LuaScriptInterface::luaDoPlayerOpenChannel); Continuando procure:
int32_t LuaScriptInterface::internalGetPlayerInfo(lua_State* L, PlayerInfo_t info) Acima adicione:
int32_t LuaScriptInterface::luaDoPlayerOpenChannel(lua_State* L) { //doPlayerOpenChannel(cid, channelId) uint32_t channelId = popNumber(L); uint32_t cid = popNumber(L); ScriptEnviroment* env = getEnv(); Player* player = env->getPlayerByUID(cid); if(player) lua_pushnumber(L, g_game.playerOpenChannel(cid, channelId) ? true : false); else { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushnumber(L, false); } return 1; } Agora em LuaScript.h
Procure por:
static int32_t luaGetChannelUsers(lua_State* L); abaixo adicione:
static int32_t luaDoPlayerOpenChannel(lua_State* L); Agora em data/creaturescripts/scripts/login.lua
Antes do último
return true Adicione:
doPlayerOpenChannel(cid, 7) -- 7 é o número do channel para ver é em data/xml/channels.xml
Rep não cai o dedo
-
MySticaL recebeu reputação de ravilliJD em [Action] Script QuestScript Quest:
--[[ Script: Exemplo de Quest Autor: MySticaL Email: [email protected] ]] function onUse(cid, item, frompos, item2, topos) -- Não mecha. storage = 938312 -- Storage a cada quest que for criada aumente um numero da storage pra qnd vc pegar o baú de outra quest ñ aparecer que vc já fez. item = 2160 -- Id do item ira ganhar. quantidade = 1 -- Quantidade ira ganhar. level = 5 -- Level que precisa pra fazer. if getPlayerLevel(cid) >= level and getPlayerStorageValue(cid,storage) == -1 then -- Não mecha. doPlayerSendTextMessage(cid,25,"Você ganhou um pouco de dinheiro") -- Mensagem que aparecera quando ganhar o item. doPlayerAddItem(cid, item, quantidade) -- Não mecha. setPlayerStorageValue(cid,storage,1) -- Não mecha. elseif getPlayerLevel(cid) <= level then -- Não mecha doPlayerSendTextMessage(cid,25,"Você precisa ser level 5 ou mais.") -- Mensagem que ira aparecer se o player tiver menos level que o necessario. elseif getPlayerStorageValue(cid,storage) >= 1 then -- Não mecha. doPlayerSendTextMessage(cid,25,"Você já fez está quest") -- Quando tentar pegar mais de uma vez o baú. end return true end Actions.xml
<action actionid="3123" event="script" value="script.lua"/> Obs: O actionid="3123" é o que você deve botar no item no Remeres Map Editor
Caso você queria criar outra quest aumente a storage no script e o id no actions.xml !
Como configurar ?
R- \/
================================================================================================================================
storage = 938312 -- Storage a cada quest que for criada aumente um numero da storage pra quando você for pegar o baú de outra quest não aparecer que você já fez.
================================================================================================================================
item = 2160 -- Id do item ira ganhar.
======================================================
quantidade = 1 -- Quantidade ira ganhar.
======================================================
level = 5 -- Level que precisa pra fazer.
======================================================
Script bem simples mais irá ajudar alguns membros.
Rep não cai o dedo
Não sei muito sobre script.
100% Créditos meu caso for postar em outro lugar deixe os créditos para min !
Desculpem o tópico mal arrumado
-
MySticaL recebeu reputação de .Foxxy em [0.3.6] Função doPlayerOpenChannelEDITADO REMOVIDO A VERSÃO 0.4 QUE CONTIA!
SE QUISER A VERSÃO 0.4 SÓ VER NO PERFIL DO ALEXY.
Oi, vim trazer a função doPlayerOpenChannel para tfs 0.3.6
Essa função nada mais é que quando o player loga abre os chat selecionado no login.lua automaticamente
Essa função é para 0.3.6
Versões testada: 8.54
Vamos ao código
em LuaScript.cpp
Procure:
//getChannelUsers(channelId) lua_register(m_luaState, "getChannelUsers", LuaScriptInterface::luaGetChannelUsers); Adicione em baixo:
//doPlayerOpenChannel(cid, channelId) lua_register(m_luaState, "doPlayerOpenChannel", LuaScriptInterface::luaDoPlayerOpenChannel); Continuando procure:
int32_t LuaScriptInterface::internalGetPlayerInfo(lua_State* L, PlayerInfo_t info) Acima adicione:
int32_t LuaScriptInterface::luaDoPlayerOpenChannel(lua_State* L) { //doPlayerOpenChannel(cid, channelId) uint32_t channelId = popNumber(L); uint32_t cid = popNumber(L); ScriptEnviroment* env = getEnv(); Player* player = env->getPlayerByUID(cid); if(player) lua_pushnumber(L, g_game.playerOpenChannel(cid, channelId) ? true : false); else { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushnumber(L, false); } return 1; } Agora em LuaScript.h
Procure por:
static int32_t luaGetChannelUsers(lua_State* L); abaixo adicione:
static int32_t luaDoPlayerOpenChannel(lua_State* L); Agora em data/creaturescripts/scripts/login.lua
Antes do último
return true Adicione:
doPlayerOpenChannel(cid, 7) -- 7 é o número do channel para ver é em data/xml/channels.xml
Rep não cai o dedo
-
MySticaL recebeu reputação de Vodkart em [0.3.6] Função doPlayerOpenChannelEDITADO REMOVIDO A VERSÃO 0.4 QUE CONTIA!
SE QUISER A VERSÃO 0.4 SÓ VER NO PERFIL DO ALEXY.
Oi, vim trazer a função doPlayerOpenChannel para tfs 0.3.6
Essa função nada mais é que quando o player loga abre os chat selecionado no login.lua automaticamente
Essa função é para 0.3.6
Versões testada: 8.54
Vamos ao código
em LuaScript.cpp
Procure:
//getChannelUsers(channelId) lua_register(m_luaState, "getChannelUsers", LuaScriptInterface::luaGetChannelUsers); Adicione em baixo:
//doPlayerOpenChannel(cid, channelId) lua_register(m_luaState, "doPlayerOpenChannel", LuaScriptInterface::luaDoPlayerOpenChannel); Continuando procure:
int32_t LuaScriptInterface::internalGetPlayerInfo(lua_State* L, PlayerInfo_t info) Acima adicione:
int32_t LuaScriptInterface::luaDoPlayerOpenChannel(lua_State* L) { //doPlayerOpenChannel(cid, channelId) uint32_t channelId = popNumber(L); uint32_t cid = popNumber(L); ScriptEnviroment* env = getEnv(); Player* player = env->getPlayerByUID(cid); if(player) lua_pushnumber(L, g_game.playerOpenChannel(cid, channelId) ? true : false); else { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushnumber(L, false); } return 1; } Agora em LuaScript.h
Procure por:
static int32_t luaGetChannelUsers(lua_State* L); abaixo adicione:
static int32_t luaDoPlayerOpenChannel(lua_State* L); Agora em data/creaturescripts/scripts/login.lua
Antes do último
return true Adicione:
doPlayerOpenChannel(cid, 7) -- 7 é o número do channel para ver é em data/xml/channels.xml
Rep não cai o dedo
-
MySticaL recebeu reputação de arthurm299 em [Action] Script QuestScript Quest:
--[[ Script: Exemplo de Quest Autor: MySticaL Email: [email protected] ]] function onUse(cid, item, frompos, item2, topos) -- Não mecha. storage = 938312 -- Storage a cada quest que for criada aumente um numero da storage pra qnd vc pegar o baú de outra quest ñ aparecer que vc já fez. item = 2160 -- Id do item ira ganhar. quantidade = 1 -- Quantidade ira ganhar. level = 5 -- Level que precisa pra fazer. if getPlayerLevel(cid) >= level and getPlayerStorageValue(cid,storage) == -1 then -- Não mecha. doPlayerSendTextMessage(cid,25,"Você ganhou um pouco de dinheiro") -- Mensagem que aparecera quando ganhar o item. doPlayerAddItem(cid, item, quantidade) -- Não mecha. setPlayerStorageValue(cid,storage,1) -- Não mecha. elseif getPlayerLevel(cid) <= level then -- Não mecha doPlayerSendTextMessage(cid,25,"Você precisa ser level 5 ou mais.") -- Mensagem que ira aparecer se o player tiver menos level que o necessario. elseif getPlayerStorageValue(cid,storage) >= 1 then -- Não mecha. doPlayerSendTextMessage(cid,25,"Você já fez está quest") -- Quando tentar pegar mais de uma vez o baú. end return true end Actions.xml
<action actionid="3123" event="script" value="script.lua"/> Obs: O actionid="3123" é o que você deve botar no item no Remeres Map Editor
Caso você queria criar outra quest aumente a storage no script e o id no actions.xml !
Como configurar ?
R- \/
================================================================================================================================
storage = 938312 -- Storage a cada quest que for criada aumente um numero da storage pra quando você for pegar o baú de outra quest não aparecer que você já fez.
================================================================================================================================
item = 2160 -- Id do item ira ganhar.
======================================================
quantidade = 1 -- Quantidade ira ganhar.
======================================================
level = 5 -- Level que precisa pra fazer.
======================================================
Script bem simples mais irá ajudar alguns membros.
Rep não cai o dedo
Não sei muito sobre script.
100% Créditos meu caso for postar em outro lugar deixe os créditos para min !
Desculpem o tópico mal arrumado
-
MySticaL recebeu reputação de gustavof em Language SystemComo funciona esse sistema?
R-> Simples caso seu otServ for para todos os players, de todos continentes e você não
queira deixar as funções em lua apenas em uma língua, você pode utilizar esse sistema.
Como usar?
R-> Após o sistema estar instalado 100%, vai ter 3 comandos: !lang en (setar a linguagem para english), !lang pt (setar a linguagem portuguese) &
!lang es (setar a linguagem espanõl).
Vamos começar, vai em data/lib/ e crie um arquivo chamado lang system.lua e coloque isto dentro:
function getPlayerLanguage(cid) 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) 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 Ainda em data/lib encontre o arquivo 000-constant.lua e coloque ao final dele isto:
ENGLISH = 2 SPANISH = 1 PORTUGUES = 0 Agora execute este código na sua SQL:
ALTER TABLE `accounts` ADD `language` INT( 11 ) NOT NULL DEFAULT '0' Pronto, o sistema está pronto agora vamos criar um comando para que troque a linguagem, vá em data/talkactions/scripts
e crie um arquivo chamado lang.lua e coloque isto dentro:
function onSay(cid, words, param) if(param == '') then return true end if(param == 'en') then if getPlayerLanguage(cid) == 2 then doPlayerSendTextMessage(cid, 20, "[Language System (Beta)] Your language is alredy set to english.") return true else doPlayerSendTextMessage(cid, 27, "[Language System (Beta)] You have set english as your language.") doPlayerSetLanguage(cid, 2) return true end end if(param == 'pt') then if getPlayerLanguage(cid) == 0 then doPlayerSendTextMessage(cid, 20, "[Language System (Beta)] Sua língua já está definida como português.") return true else doPlayerSendTextMessage(cid, 27, "[Language System (Beta)] Você definiu o português como sua língua.") doPlayerSetLanguage(cid, 0) return true end end if(param == 'es') then if getPlayerLanguage(cid) == 1 then doPlayerSendTextMessage(cid, 20, "[Language System (Beta)] Su lengua ya esta definida como español.") return true else doPlayerSendTextMessage(cid, 27, "[Language System (Beta)] Tu definistes el español como tu lengua.") doPlayerSetLanguage(cid, 1) return true end end end E em data/talkactions abra o talkactions.xml e coloque está tag:
<talkaction log="yes" words="!lang" event="script" value="lang.lua"/> Vou dar um exemplo de como usa-la em .lua:
if getPlayerLanguage(cid) == 2 then doPlayerSendTextMessage(cid, 25, "This message will be displayed in English if the language of the player is in -en!") end if getPlayerLanguage(cid) == 0 then doPlayerSendTextMessage(cid, 25, "Está mensagem será exibida em português se a linguagem do jogador estiver em -pt!") end if getPlayerLanguage(cid) == 1 then doPlayerSendTextMessage(cid, 25, "Usted mensaje se mostrará en Espanõl si el jugador está en el lenguaje -es!") end Outro Exemplo:
function onLogin(cid) local langmsg = { [ENGLISH] = {"This message will be displayed in English if the language of the player is in -en!"} [SPANISH] = {"Usted mensaje se mostrará en Espanõl si el jugador está en el lenguaje -es!"}, [PORTUGUES] = {"Está mensagem será exibida em português se a linguagem do jogador estiver em -pt!"}, } doPlayerSendTextMessage(cid, 25, langmsg[getPlayerLanguage(cid)][1]) return true end Pronto, agora o sistema está perfeito, os comandos estão no começo do tópico em "Como usar?"
créditos:
Acubens
Drazyn1291
MySticaL
-
MySticaL recebeu reputação de hian.araujo16 em habilitar pvp systemEm data/lib/some functions.lua
procure por:
if ehMonstro(cid) and ehMonstro(pid) then return "Can" end e coloque isto em cima
if getTileInfo(getThingPos(cid)).pvp then return "Can" end
REP se ajudei?
-
MySticaL recebeu reputação de L3K0T em Language SystemComo funciona esse sistema?
R-> Simples caso seu otServ for para todos os players, de todos continentes e você não
queira deixar as funções em lua apenas em uma língua, você pode utilizar esse sistema.
Como usar?
R-> Após o sistema estar instalado 100%, vai ter 3 comandos: !lang en (setar a linguagem para english), !lang pt (setar a linguagem portuguese) &
!lang es (setar a linguagem espanõl).
Vamos começar, vai em data/lib/ e crie um arquivo chamado lang system.lua e coloque isto dentro:
function getPlayerLanguage(cid) 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) 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 Ainda em data/lib encontre o arquivo 000-constant.lua e coloque ao final dele isto:
ENGLISH = 2 SPANISH = 1 PORTUGUES = 0 Agora execute este código na sua SQL:
ALTER TABLE `accounts` ADD `language` INT( 11 ) NOT NULL DEFAULT '0' Pronto, o sistema está pronto agora vamos criar um comando para que troque a linguagem, vá em data/talkactions/scripts
e crie um arquivo chamado lang.lua e coloque isto dentro:
function onSay(cid, words, param) if(param == '') then return true end if(param == 'en') then if getPlayerLanguage(cid) == 2 then doPlayerSendTextMessage(cid, 20, "[Language System (Beta)] Your language is alredy set to english.") return true else doPlayerSendTextMessage(cid, 27, "[Language System (Beta)] You have set english as your language.") doPlayerSetLanguage(cid, 2) return true end end if(param == 'pt') then if getPlayerLanguage(cid) == 0 then doPlayerSendTextMessage(cid, 20, "[Language System (Beta)] Sua língua já está definida como português.") return true else doPlayerSendTextMessage(cid, 27, "[Language System (Beta)] Você definiu o português como sua língua.") doPlayerSetLanguage(cid, 0) return true end end if(param == 'es') then if getPlayerLanguage(cid) == 1 then doPlayerSendTextMessage(cid, 20, "[Language System (Beta)] Su lengua ya esta definida como español.") return true else doPlayerSendTextMessage(cid, 27, "[Language System (Beta)] Tu definistes el español como tu lengua.") doPlayerSetLanguage(cid, 1) return true end end end E em data/talkactions abra o talkactions.xml e coloque está tag:
<talkaction log="yes" words="!lang" event="script" value="lang.lua"/> Vou dar um exemplo de como usa-la em .lua:
if getPlayerLanguage(cid) == 2 then doPlayerSendTextMessage(cid, 25, "This message will be displayed in English if the language of the player is in -en!") end if getPlayerLanguage(cid) == 0 then doPlayerSendTextMessage(cid, 25, "Está mensagem será exibida em português se a linguagem do jogador estiver em -pt!") end if getPlayerLanguage(cid) == 1 then doPlayerSendTextMessage(cid, 25, "Usted mensaje se mostrará en Espanõl si el jugador está en el lenguaje -es!") end Outro Exemplo:
function onLogin(cid) local langmsg = { [ENGLISH] = {"This message will be displayed in English if the language of the player is in -en!"} [SPANISH] = {"Usted mensaje se mostrará en Espanõl si el jugador está en el lenguaje -es!"}, [PORTUGUES] = {"Está mensagem será exibida em português se a linguagem do jogador estiver em -pt!"}, } doPlayerSendTextMessage(cid, 25, langmsg[getPlayerLanguage(cid)][1]) return true end Pronto, agora o sistema está perfeito, os comandos estão no começo do tópico em "Como usar?"
créditos:
Acubens
Drazyn1291
MySticaL
-
MySticaL recebeu reputação de leozincorsair em Language SystemComo funciona esse sistema?
R-> Simples caso seu otServ for para todos os players, de todos continentes e você não
queira deixar as funções em lua apenas em uma língua, você pode utilizar esse sistema.
Como usar?
R-> Após o sistema estar instalado 100%, vai ter 3 comandos: !lang en (setar a linguagem para english), !lang pt (setar a linguagem portuguese) &
!lang es (setar a linguagem espanõl).
Vamos começar, vai em data/lib/ e crie um arquivo chamado lang system.lua e coloque isto dentro:
function getPlayerLanguage(cid) 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) 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 Ainda em data/lib encontre o arquivo 000-constant.lua e coloque ao final dele isto:
ENGLISH = 2 SPANISH = 1 PORTUGUES = 0 Agora execute este código na sua SQL:
ALTER TABLE `accounts` ADD `language` INT( 11 ) NOT NULL DEFAULT '0' Pronto, o sistema está pronto agora vamos criar um comando para que troque a linguagem, vá em data/talkactions/scripts
e crie um arquivo chamado lang.lua e coloque isto dentro:
function onSay(cid, words, param) if(param == '') then return true end if(param == 'en') then if getPlayerLanguage(cid) == 2 then doPlayerSendTextMessage(cid, 20, "[Language System (Beta)] Your language is alredy set to english.") return true else doPlayerSendTextMessage(cid, 27, "[Language System (Beta)] You have set english as your language.") doPlayerSetLanguage(cid, 2) return true end end if(param == 'pt') then if getPlayerLanguage(cid) == 0 then doPlayerSendTextMessage(cid, 20, "[Language System (Beta)] Sua língua já está definida como português.") return true else doPlayerSendTextMessage(cid, 27, "[Language System (Beta)] Você definiu o português como sua língua.") doPlayerSetLanguage(cid, 0) return true end end if(param == 'es') then if getPlayerLanguage(cid) == 1 then doPlayerSendTextMessage(cid, 20, "[Language System (Beta)] Su lengua ya esta definida como español.") return true else doPlayerSendTextMessage(cid, 27, "[Language System (Beta)] Tu definistes el español como tu lengua.") doPlayerSetLanguage(cid, 1) return true end end end E em data/talkactions abra o talkactions.xml e coloque está tag:
<talkaction log="yes" words="!lang" event="script" value="lang.lua"/> Vou dar um exemplo de como usa-la em .lua:
if getPlayerLanguage(cid) == 2 then doPlayerSendTextMessage(cid, 25, "This message will be displayed in English if the language of the player is in -en!") end if getPlayerLanguage(cid) == 0 then doPlayerSendTextMessage(cid, 25, "Está mensagem será exibida em português se a linguagem do jogador estiver em -pt!") end if getPlayerLanguage(cid) == 1 then doPlayerSendTextMessage(cid, 25, "Usted mensaje se mostrará en Espanõl si el jugador está en el lenguaje -es!") end Outro Exemplo:
function onLogin(cid) local langmsg = { [ENGLISH] = {"This message will be displayed in English if the language of the player is in -en!"} [SPANISH] = {"Usted mensaje se mostrará en Espanõl si el jugador está en el lenguaje -es!"}, [PORTUGUES] = {"Está mensagem será exibida em português se a linguagem do jogador estiver em -pt!"}, } doPlayerSendTextMessage(cid, 25, langmsg[getPlayerLanguage(cid)][1]) return true end Pronto, agora o sistema está perfeito, os comandos estão no começo do tópico em "Como usar?"
créditos:
Acubens
Drazyn1291
MySticaL
-
MySticaL recebeu reputação de KotZletY em Language SystemComo funciona esse sistema?
R-> Simples caso seu otServ for para todos os players, de todos continentes e você não
queira deixar as funções em lua apenas em uma língua, você pode utilizar esse sistema.
Como usar?
R-> Após o sistema estar instalado 100%, vai ter 3 comandos: !lang en (setar a linguagem para english), !lang pt (setar a linguagem portuguese) &
!lang es (setar a linguagem espanõl).
Vamos começar, vai em data/lib/ e crie um arquivo chamado lang system.lua e coloque isto dentro:
function getPlayerLanguage(cid) 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) 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 Ainda em data/lib encontre o arquivo 000-constant.lua e coloque ao final dele isto:
ENGLISH = 2 SPANISH = 1 PORTUGUES = 0 Agora execute este código na sua SQL:
ALTER TABLE `accounts` ADD `language` INT( 11 ) NOT NULL DEFAULT '0' Pronto, o sistema está pronto agora vamos criar um comando para que troque a linguagem, vá em data/talkactions/scripts
e crie um arquivo chamado lang.lua e coloque isto dentro:
function onSay(cid, words, param) if(param == '') then return true end if(param == 'en') then if getPlayerLanguage(cid) == 2 then doPlayerSendTextMessage(cid, 20, "[Language System (Beta)] Your language is alredy set to english.") return true else doPlayerSendTextMessage(cid, 27, "[Language System (Beta)] You have set english as your language.") doPlayerSetLanguage(cid, 2) return true end end if(param == 'pt') then if getPlayerLanguage(cid) == 0 then doPlayerSendTextMessage(cid, 20, "[Language System (Beta)] Sua língua já está definida como português.") return true else doPlayerSendTextMessage(cid, 27, "[Language System (Beta)] Você definiu o português como sua língua.") doPlayerSetLanguage(cid, 0) return true end end if(param == 'es') then if getPlayerLanguage(cid) == 1 then doPlayerSendTextMessage(cid, 20, "[Language System (Beta)] Su lengua ya esta definida como español.") return true else doPlayerSendTextMessage(cid, 27, "[Language System (Beta)] Tu definistes el español como tu lengua.") doPlayerSetLanguage(cid, 1) return true end end end E em data/talkactions abra o talkactions.xml e coloque está tag:
<talkaction log="yes" words="!lang" event="script" value="lang.lua"/> Vou dar um exemplo de como usa-la em .lua:
if getPlayerLanguage(cid) == 2 then doPlayerSendTextMessage(cid, 25, "This message will be displayed in English if the language of the player is in -en!") end if getPlayerLanguage(cid) == 0 then doPlayerSendTextMessage(cid, 25, "Está mensagem será exibida em português se a linguagem do jogador estiver em -pt!") end if getPlayerLanguage(cid) == 1 then doPlayerSendTextMessage(cid, 25, "Usted mensaje se mostrará en Espanõl si el jugador está en el lenguaje -es!") end Outro Exemplo:
function onLogin(cid) local langmsg = { [ENGLISH] = {"This message will be displayed in English if the language of the player is in -en!"} [SPANISH] = {"Usted mensaje se mostrará en Espanõl si el jugador está en el lenguaje -es!"}, [PORTUGUES] = {"Está mensagem será exibida em português se a linguagem do jogador estiver em -pt!"}, } doPlayerSendTextMessage(cid, 25, langmsg[getPlayerLanguage(cid)][1]) return true end Pronto, agora o sistema está perfeito, os comandos estão no começo do tópico em "Como usar?"
créditos:
Acubens
Drazyn1291
MySticaL
-
MySticaL deu reputação a jefersonzc em Erro Ao Criar Conta No SiteAmigo, estava tendo o mesmo problema, vou postar a resolução.
Primeiramente vc irá precisar localizar e abrir dois arquivos, o account.php e o character.php. Os caminhos são esses:
C:\xampp\htdocs\system\application\controllers\account.php
C:\xampp\htdocs\system\application\controllers\character.php
Em ambos os arquivo vc precisará inserir um simples trecho de código.
Procure pela função _validName($name) e coloque global $config; conforme mostrado abaixo:
function _validName($name) { require("config.php"); global $config; //OLHA ELE INSERIDO AQUI $name = explode(" ", $name); foreach($name as $unit) { if(in_array(strtolower($unit), $config['invalidNameTags'])) { $this->form_validation->set_message('_validName', 'Invalid Name'); return false; } else if(strlen($unit) == 1) { $this->form_validation->set_message('_validName', 'Invalid Name'); return false; } else continue; } } Espero ter sido claro e ter ajudado.