Solutions
-
joadson's post in (Resolvido)Force OpenChat was marked as the answerVá em data/creaturevents/scripts e crie um arquivo chamado deathchannel.lua e coloque isso
function onLogin(cid) if isPlayer(cid) and getPlayerAccountManager(cid) == MANAGER_NONE then doPlayerOpenChannel(cid, 9) doPlayerOpenChannel(cid, 10) registerCreatureEvent(cid, "playerDeathChannel") -- função do seu deathchannel end return true end abra seu login.lua e
registerCreatureEvent(cid, "playerDeathChannelLogin") agora abra creaturevents.xml e coloque
<event type="login" name="playerDeathChannelLogin" event="script" value="deathchannel.lua"/>
Caso dê algum erro é porque sua sourcer não tem o código para chamar a função, ai terá que adicionar.
Aqui funcionou sem nenhum erro.
-
joadson's post in (Resolvido)[PEDIDO] "Reborn" modificado was marked as the answerEDIT...
Crie o arquivo XML do npc.
<?xml version="1.0" encoding="UTF-8"?> <npc name="Rebornar" script="rebornar.lua" walkinterval="0"> <health now="100" max="100"/> <look type="446"/> <parameters> <parameter key="message_greet" value="Olá, |PLAYERNAME|! Eu posso te {Rebornar}." /> </parameters> </npc> e crie um arquivo rebornar.lua na pasta scripts
local hpADD = 10000 -- HP adicionado ao rebornar local mpADD = 10000 -- MP adicionado... local function doPlayerReborn(cid, level, looktype, vocation) setGlobalStorageValue(1000,getPlayerGUID(cid)) setPlayerStorageValue(cid, 30023, 4) setPlayerStorageValue(cid, 30024, getPlayerLevel(cid)) setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+hpADD) setCreatureMaxMana(cid, getCreatureMaxMana(cid)+mpADD) doCreatureAddHealth(cid, getCreatureMaxHealth(cid)) doCreatureAddMana(cid, getCreatureMaxMana(cid)) doRemoveCreature(cid) db.query("UPDATE `players` SET `level` = " .. level .. " WHERE `id` = " .. getGlobalStorageValue(1000) .. ";") db.query("UPDATE `players` SET `looktype` = " .. looktype .. " WHERE `id` = " .. getGlobalStorageValue(1000) .. ";") db.query("UPDATE `players` SET `vocation` = " .. vocation .. " WHERE `id` = " .. getGlobalStorageValue(1000) .. ";") return TRUE end ----------------------------funções padrão do NPC----- local focus = 0 local talk_start = 0 local target = 0 local following = false local attacking = false function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('???') focus = 0 talk_start = 0 end end function onCreatureTurn(creature) end function msgcontains(txt, str) return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)')) end function onCreatureSay(cid, type, msg) msg = string.lower(msg) if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then selfSay('Olá! Se voce está pronto, diga "reborn".') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Desculpe, ' .. getCreatureName(cid) .. '! Hey!.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'reborn') and getPlayerStorageValue(cid,30023) == 4 then selfSay('Desculpe, mas voce já é rebornado.') focus = 0 talk_start = 0 elseif msgcontains(msg, 'reborn') and (getPlayerLevel(cid) < 200 and getPlayerStorageValue(cid,30023) ~= 4) or (getPlayerLevel(cid) > 400 and getPlayerStorageValue(cid,30023) ~= 4) then selfSay('Apenas level 200 ao 400 podem rebornar.') focus = 0 talk_start = 0 elseif msgcontains(msg, 'reborn') then selfSay('Realmente quer isto?') talk_state = 2 -- configuração da vocação elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 400 and getPlayerVocation(cid) == 8 then -- mude o 8 para o numero da ultima transformação doPlayerReborn(cid,1,10,9)-- explicação: 1 é o level que ficará após rebornar, 10 é o looktype e 9 é a nova vocação talk_state = 0 elseif msgcontains(msg, 'yes') and talk_state == 2 then selfSay('Desculpe, ' .. getCreatureName(cid) .. '! Voce deve estar na ultima transformação.') elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Adeus!') focus = 0 talk_start = 0 end end end function onThink() doNpcSetCreatureFocus(focus) if (os.clock() - talk_start) > 45 then if focus > 0 then selfSay('Próximo por favor...') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Adeus!') focus = 0 end end end
-
joadson's post in (Resolvido)Erro em Script de Broadcast was marked as the answerlocal config = { storage = 19400, -- storage em que será salvo o tempo cor = "advance", -- de acordo com o constant.lua da lib tempo = 2, -- em minutos itemid = 2160, --- id do item que vai ser cobrado price = 1, -- preço pra usar o broadcast level = 30 -- level pra poder utilizar o broadcast } function onSay(cid, words, param, channel) if(param == '') then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.") return true end if getPlayerLevel(cid) >= config.level then if getPlayerStorageValue(cid, config.storage) - os.time() <= 0 then if doPlayerRemoveItem(cid, config.itemid, config.price) then setPlayerStorageValue(cid, config.storage, os.time() + (config.tempo*60)) doBroadcastMessage("[BROADCAST] "..getCreatureName(cid)..": "..param.."", config.cor) doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You have successfully sent a broadcast, now you'll have to wait " ..config.tempo.. " minute(s) until you broadcast again.") return false else doPlayerSendCancel(cid, "You don't have " ..config.price.. " gp's for broadcasting.") return false end else doPlayerSendCancel(cid, "You have to wait " ..(getPlayerStorageValue(cid, config.storage) - os.time()).. " seconds until you can broadcast again.") return false end else doPlayerSendCancel(cid, "You have to be level " ..config.level.. " or more in order to use broadcast.") end end Faltava uma ,(virgula) depois do 2160...
-
joadson's post in (Resolvido)[Erro] Porta de reputação was marked as the answerMude isso if getRepPoints(cid) >= config.repNeeded then pra isso if getPoints(cid) >= config.repNeeded then
Ou mude o nome da função no MOD.
Caso não funcione, adicione isso em lib/0-50function.lua
function getRepPoints(cid) -- Rep System local Info = db.getResult("SELECT `rep` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. " LIMIT 1") local p = Info:getDataInt("rep") Info:free() return p end -
joadson's post in (Resolvido)/Attr inutil was marked as the answeras sourcers foram modificadas.
antes era /attr set attack, 20, hoje é /attr set number attack 20
foi acrescentado int, number, text etc antes da função.
-
joadson's post in (Resolvido)Evento matar outro player ganhar EXP was marked as the answerVou ver aqui, posto um resultado.
EDIT: Aqui o resultado... coloquei pra mostrar o nome de quem matou e tudo...
Testado e dando a exp certinha.
function onDeath(cid, corpse, deathList) local config = { exp = math.random(300000, 900000), killer_name = getCreatureName(deathList[1]), target_name = getCreatureName(cid) } --if getPlayerIp(cid) == getPlayerIp(deathList[1]) then return true end --se nao for testar em casa remova os 2 sinais(de menos) no começo do script. essa função é para evitar que alguem use MC para ganhar exp; if isPlayer(deathList[1]) then doPlayerSendTextMessage(deathList[1], MESSAGE_INFO_DESCR, "Você recebeu ".. config.exp .. ", de EXP por matar o ".. config.target_name ..".") doPlayerAddExp(deathList[1], config.exp) end return true end -
joadson's post in (Resolvido)nao atacar player da mesma guild was marked as the answerVá em creaturescript e crie um arquivo chamado attackguild.lua e coloque isso dentro
function onCombat(cid, target) if getTileInfo(getThingPos (cid)). pvp then return true end -- caso queira que na arena pvp possa atacar normal, remova isso if isPlayer(target) and getPlayerGuildId(cid) ~= 0 and getPlayerGuildId(cid) == getPlayerGuildId(target) then doPlayerSendCancel(cid, "Não pode atacar players da mesma guild.") return false end return true end e em creatures.xml coloque isso
<event type="combat" name="attackguild" script="attackguild.lua"/> Agora abra o login.lua e adicione isso
registerCreatureEvent(cid, "attackguild") -
joadson's post in (Resolvido)RESOLVIDO Npc Primeiro Item was marked as the answerlocal keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end if(msgcontains(msg, 'item')) then if(getPlayerStorageValue(cid, 99746) == -1) then npcHandler:say('Opa, então voce ainda não tem items e precisa de ajuda ? tome isto vai lhe ajudar em sua jornada', cid) doPlayerAddItem(cid, 2160, 100) setPlayerStorageValue(cid, 99746, 1) return true end else npcHandler:say('Saia daqui já lhe ajudei', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
-
joadson's post in (Resolvido)Pedido Arena PVP was marked as the answerSe for só para trocar o outfit em determido local, aqui está...
vá em movements/script e crie outfit.lua e adicione isso dentro
local conditionOut = createConditionObject(CONDITION_OUTFIT) setConditionParam(conditionOut, CONDITION_PARAM_TICKS, -1) addOutfitCondition(conditionOut, {lookType = 134, lookHead = 114, lookBody = 114, lookLegs = 114, lookFeet = 114}) --Link dos numeros das cores > só trocar o 114 por qualquer cor http://s204.photobucket.com/user/swij1/media/npchelp.png.html function onStepIn(cid, item, position, fromPosition) if isPlayer(cid) == TRUE then doAddCondition(cid, conditionOut) end end Depois abra o movements.xml e coloque
<movevent type="StepIn" actionid="29123" event="script" value="outfit.lua"/> feito isso, é só abrir o RME e colocar actionID 29123 nos pisos onde o player irá mudar o outfit.
-
joadson's post in (Resolvido)[AJUDA] Problema com MoveEvents was marked as the answerTroque a tag "body" por "armor".
-
joadson's post in (Resolvido)[Pedido] Alavanca por tempo was marked as the answerAqui...
vá em action/script e crie um arquivo chamado summon.lua e coloque isso dentro
local config = { pos = {x = 160, y = 58, z = 7}, -- Posiçao name = "Demon", -- nome do mosntro Time = 10, -- 10 segundos Storage = 10123 -- storage do tempo } function onUse(cid, item, frompos, item2, topos) if(exhaustion.check(cid, config.Storage) == TRUE) then doPlayerSendCancel(cid, "Você só poder puxar a alavancar em " .. config.Time .. " segundos.") return false end if item.uid == 2512 and item.itemid == 1945 or item.itemid == 1946 then doSummonCreature(config.name, config.pos) exhaustion.set(cid, config.Storage, config.Time) doPlayerSendCancel(cid, "Você Sumonou o " .. config.name .." com sucesso") end return TRUE end e depois abra o action.xml e adicione isso
<action uniqueid="2512" script="Summon.lua" />
Depois disso é só abrir o RME e colocar UNIQUEID 2512 na alavanca de summon
-
joadson's post in (Resolvido)Erro no distro Reset. was marked as the answerTente agora.
-
joadson's post in (Resolvido)Ajuda: como fazer task uma única vez was marked as the answerOkay, já sei onde modifcar...
Breve edito aqui
EDIT: Tente assim agora
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local task = { ["Zulu"] = {{"Gloom", 15}, {"Tangela", 5 }}, } if msgcontains(msg, 'task') or msgcontains(msg, 'Task') then if isMyTaskComplete(cid, getNpcCid()) then selfSay("Wow you have already complete my task! Ok then, take your reward!", cid) doPlayerAddExperience(cid, 80000) --premio doPlayerAddItem(cid, 11441, 2) doPlayerAddItem(cid, 11447, 2) doPlayerAddItem(cid, 11442, 2) doPlayerAddItem(cid, 11639, 1) local sto = getMyTaskSto(cid, getNpcCid()) setPlayerStorageValue(cid, sto, 3) setPlayerStorageValue(cid, 181603, 1) --storage da outfit talkState[talkUser] = 0 return true else selfSay("Then, is a simple task, i want to you kill {15 Gloom, 5 Tangela,}, you accept the task?", cid) talkState[talkUser] = 2 end elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'Yes')) and talkState[talkUser] == 2 then if getMyTaskSto(cid, getNpcCid()) ~= -1 then selfSay("You are already doing my task! go end it!", cid) talkState[talkUser] = 0 return true end local sto = getFreeTaskStorage(cid) if sto == -1 then selfSay("You can't catch more tasks! You are already with the maximum of "..(maxTasks).." tasks!", cid) talkState[talkUser] = 0 return true end selfSay("OK then... Go kill your targets!", cid) setStorageArray(cid, sto, task) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) -
joadson's post in (Resolvido)[RESOLVIDO] [PEDIDO] TELEPORTAR TODOS OS PLAYERS ON-LINE was marked as the answerAqui...
Vá em talkaction/script e crie um arquivo chamado temple.lua e coloque o codigo abaixo
function onSay(cid, words, param, channel) local temple = { x = 1000, y = 1000, z = 7 } for _, cid in ipairs(getPlayersOnline()) do doTeleportThing(cid, temple) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Todos Players foram teleportados para o templo.") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS) end return TRUE end e depois abra talkaction.xml e coloque isso dentro
<talkaction access="4" words="!alltemple" event="script" value="temple.lua"/> -
joadson's post in (Resolvido)Error no RME was marked as the answerProblema solucionado...
Tive que formatar o PC
-
joadson's post in (Resolvido)[ PEDIDO ] Portinhas Por profissão was marked as the answerQual é o erro que dá?
é só você mudar os numero das vocações
-
joadson's post in (Resolvido)Erro ao usar o comando !reset was marked as the answerVá em lib/050-funciton.lua e add isso no final
function addReset(cid) resets = getResets(cid) setPlayerStorageValue(cid,36874,resets+1) return true end function getResets(cid) resets = getPlayerStorageValue(cid,36874) if resets < 0 then resets = 0 end return resets end Feito isso, vá em talkaction/script, e crie um arquivo chamado reset.lua e coloque isso dentro
function onSay(cid, words, param) local newlevel = 2500 -- level após reset local newexp = 0 -- Exp apos resetar local pos = getPlayerPosition(cid) if getResets(cid) >= 170 then --Limite de reset doPlayerPopupFYI(cid, "voce ja atingiu o maximo de resets.") return TRUE end if getPlayerLevel(cid) < 60 then -- Level para poder resetar doPlayerPopupFYI(cid, "Precisa ser level 60 para usar esse comando.") else addReset(cid) playerid = getPlayerGUID(cid) doRemoveCreature(cid) db.executeQuery("UPDATE `players` SET `level`="..newlevel..",`experience`="..newexp.." WHERE `players`.`id`= ".. playerid .."") end return TRUE end e adicione isso em talkaction.xml
<talkaction words="!reset" access="1" event="script" value="reset.lua"/>
Espero ter ajudado