Ir para conteúdo

MatheusGlad

Conde
  • Total de itens

    528
  • Registro em

  • Última visita

  • Dias Ganhos

    30

Tudo que MatheusGlad postou

  1. Primeiro, vai ter que saber o code php de criar contas do seu ot... Poste-o se quizer que alguem tente fazer algo
    1. victormoaz

      victormoaz

      eu utilizei seu sistema,

      porem quando fui adicionar a funcao no script da quest não funcionou.

      eu coloquei assim:

      setItemOwner(item, cid)

      ond item foi declarado como id do item que o player vai receber!

      poderia me ajudar? posso ter entendido errado como funciona o sistema.

  2. Pronto agora tem um video pra voces verem e intenderem melhor o objetivo do script. BLOOD HEROES NEVER DIE!!
  3. Bem o sistema é basicamente isso: Fazer com que so um player possa equipar determinado item. Eu fiquei em duvida se botava ou nao botava para aparecer o nome do owner no item, por isso fiz uma enquete para esse topico, a que vencer eu faço. Youtube: O script esta em mod, voce nao precisa nem mexer no mod. Crie um arquivo.xml na pasta mods do seu ot e nomeie-o de ownersystem (é extremamente importante que o nome seja esse.) e bote esse script: <?xml version="1.0" encoding="UTF-8"?> <mod name="OwnerSystem" enabled="yes" author="MatheusMkalo" credits="Cezar (Patterns)"> <config name="OwnerLib"><![CDATA[ function getSlotIds(tag) local file = "mods/ownersystem.xml" local input = assert(io.open(file)) local content = assert(input:read("*a")) local tag = content:match("(<movevent[^>]*slot=[\"']".. tag .."[\"'][^>]*>)") local itemid = tag:match("itemid=[\"'](.-)[\"']") input:close() return itemid:explode(";") end function writeId(tag, id) local file = "mods/ownersystem.xml" local input = assert(io.open(file)) local content = assert(input:read("*a")) local tag = content:match("(<movevent[^>]*slot=[\"']".. tag .."[\"'][^>]*>)") local itemid = tag:match("itemid=[\"'](.-)[\"']") input:close() if(itemid:match(tostring(id))) then return true end if(itemid == "") then itemid = id else itemid = itemid .. ";" .. id end local ntag = tag:gsub("itemid=[\"'](.-)[\"']", "itemid=\"" .. itemid .. "\"") local content = content:gsub(tag, ntag) local output = assert(io.open(file, "w")) output:write(content) output:close() addEvent(doReloadInfo, 1000, 22) end function getItemType(itemid) local slottypes = {"head", "body", "legs", "feet"} local arq = io.open("data/items/items.xml", "r"):read("*all") local attributes = arq:match('<item id="' .. itemid .. '".+name="' .. getItemNameById(itemid) ..'">(.-)</item>') local slot = "" for i,x in pairs(slottypes) do if attributes:find(x) then slot = x break end end if slot == "body" then slot = "armor" end return slot end function isHandedWeapon(itemuid) local typee = getItemWeaponType(itemuid) or 0 if typee >= 1 and typee <= 6 then return TRUE end end function isPlayerOwnerItem(cid, itemuid) return not getItemAttribute(itemuid, "ownerguid") or getItemAttribute(itemuid, "ownerguid") == getPlayerGUID(cid) end function setItemOwner(itemuid, cid) if isHandedWeapon(itemuid) then local equips = getSlotIds("hand") if not table.find(equips, getItemIdByName(getItemName(itemuid))) then writeId("hand", getItemIdByName(getItemName(itemuid))) end doItemSetAttribute(itemuid, "ownerguid", getPlayerGUID(cid)) elseif getItemType(getItemIdByName(getItemName(itemuid))) then local equips = getSlotIds(getItemType(getItemIdByName(getItemName(itemuid)))) if not table.find(equips, getItemIdByName(getItemName(itemuid))) then writeId(getItemType(getItemIdByName(getItemName(itemuid))), getItemIdByName(getItemName(itemuid))) end doItemSetAttribute(itemuid, "ownerguid", getPlayerGUID(cid)) end end ]]></config> <movevent type="Equip" itemid="" slot="head" event="script"><![CDATA[ domodlib("OwnerLib") if not isPlayerOwnerItem(cid, item.uid) then addEvent(doPlayerSendCancel, 1, cid, "You are not the owner of this item.") else return TRUE end ]]></movevent> <movevent type="Equip" itemid="" slot="hand" event="script"><![CDATA[ domodlib("OwnerLib") if not isPlayerOwnerItem(cid, item.uid) then addEvent(doPlayerSendCancel, 1, cid, "You are not the owner of this item.") else return TRUE end ]]></movevent> <movevent type="Equip" itemid="" slot="legs" event="script"><![CDATA[ domodlib("OwnerLib") if not isPlayerOwnerItem(cid, item.uid) then addEvent(doPlayerSendCancel, 1, cid, "You are not the owner of this item.") else return TRUE end ]]></movevent> <movevent type="Equip" itemid="" slot="armor" event="script"><![CDATA[ domodlib("OwnerLib") if not isPlayerOwnerItem(cid, item.uid) then addEvent(doPlayerSendCancel, 1, cid, "You are not the owner of this item.") else return TRUE end ]]></movevent> <movevent type="Equip" itemid="" slot="feet" event="script"><![CDATA[ domodlib("OwnerLib") if not isPlayerOwnerItem(cid, item.uid) then addEvent(doPlayerSendCancel, 1, cid, "You are not the owner of this item.") else return TRUE end ]]></movevent> </mod> Agora vá na pasta libs e abra o arquivo.lua que tem o nome de functions ou 050-functions (pode variar de ot pra ot) e adicione essa funçao: function setItemOwner(itemuid, cid) domodlib("OwnerLib") return setItemOwner(itemuid, cid) end Agora vá em data/talkactions/scripts e abra o arquivo createitem.lua e mude o script para esse: function onSay(cid, words, param, channel) if(param == '') then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.") return true end local t = string.explode(param, ",") local ret = RETURNVALUE_NOERROR local pos = getCreaturePosition(cid) local id = tonumber(t[1]) if(not id) then id = getItemIdByName(t[1], false) if(not id) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.") return true end end local amount = 100 if(t[2]) then amount = t[2] end local item = doCreateItemEx(id, amount) if(t[3] and getBooleanFromString(t[3])) then if(t[4] and getBooleanFromString(t[4])) then pos = getCreatureLookPosition(cid) end ret = doTileAddItemEx(pos, item) else doPlayerAddItem(cid, id, amount) ret = RETURNVALUE_NOERROR end if(ret ~= RETURNVALUE_NOERROR) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Couldn't add item: " .. t[1]) return true end doDecayItem(item) if(not isPlayerGhost(cid)) then doSendMagicEffect(pos, CONST_ME_MAGIC_RED) end return true end É de extrema importancia que voce mude o script do /i, pois o i que vem nos ots contem um bug que arruina com o sistema de owner. Pronto agora você so precisa juntar a minha funçao setItemOwner(itemuid, cid) com qualquer outro script de quest whatever. Lembre-se se voce quizer algum script que use esse meu sistema, peça-o na sessao de pedidos de scripts, não aqui.
  4. Bem, como todos sabem, não da pra criar 2 items com o mesmo sprite, somente editando a source e o dat etc... Usando esse sistema que eu fiz voce nao precisara editar nada somente adicionar os scripts. Primeiramente vá na pasta lib e crie um arquivo ItemsEditedLib.lua e adicione isso dentro: function doPlayerAddEditedItem(cid, itemid) local newxml = io.open("data/items/newitems.xml", "r") local configs = {} for i in newxml:read("*a"):gmatch("<item (.-)</item>") do local itemid = tonumber(i:match('id="(.-)"')) local itemconfig = { ["spriteid"] = tonumber(i:match('spriteid.-=.-"(.-)"')), ["article"] = i:match('article.-=.-"(.-)"'), ["name"] = i:match('name.-=.-"(.-)"'), ["description"] = i:match('key.-=.-"description".-value.-=.-"(.-)"'), ["defense"] = tonumber(i:match('key.-=.-"defense".-value.-=.-"(.-)"')), ["attack"] = tonumber(i:match('key.-=.-"attack".-value.-=.-"(.-)"')), ["extradefense"] = tonumber(i:match('key.-=.-"extradef".-value.-=.-"(.-)"')), ["armor"] = tonumber(i:match('key.-=.-"armor".-value.-=.-"(.-)"')), ["extraattack"] = tonumber(i:match('key.-=.-"extraatk".-value.-=.-"(.-)"')), } configs[itemid] = itemconfig end if configs[itemid] then local item = doPlayerAddItem(cid, configs[itemid].spriteid) for i,x in pairs(configs[itemid]) do doItemSetAttribute(item, i, x) end end end Depois vá na pasta items e adicione um arquivo newitems.XML (XML NAO LUA!!!) e adicione isso dentro: <?xml version="1.0" encoding="UTF-8"?> <items> <item id="100" spriteid="2400" article="a" name="magic edited sword"> <attribute key="description" value="Arma editada." /> <attribute key="defense" value="45" /> <attribute key="attack" value="100" /> <attribute key="extradef" value="10" /> <attribute key="extraatk" value="10" /> </item> <item id="101" spriteid="2472" article="a" name="master plate armor"> <attribute key="description" value="Armor editada." /> <attribute key="armor" value="19" /> </item> </items> Bem como voces podem ver, o xml guarda os novos items, o xml funciona praticamente como o items.xml so que tem um novo campo o "spriteid", nele fica o itemid original. Eu sei que ainda faltam atributos, com o tempo e com os pedidos eu vou adicionando. (É importante que voces peçam por novos atributos, porque os outros são mais complicados e eu nao vou faze-los para ninguem usar) Atributos: "description" "defense" "attack" "extradefense" "armor" "extraattack" Para adicionar os novos itemids aos players use doPlayerAddEditedItem(cid, ITEMID) em vez de doPlayerAddItem...
  5. Faltam informaçoes '-' Aonde vai ficar os itens que o player bota? IDS... Pode trocar mais de uma vez? Os itens que seram trocados vao ficar um em cima do outro?
  6. Crítica ou problema: Pedidos de scripts repetidos. Sugestão: Quando um moderador movese um topico que foi solucionado para a seçao de pedidos entregues, renomea-se o titulo do topico para exatamente o que contem nele e se possivel botar o post que entregou o pedido corretetamente fosse 'quotado' no post principal, assim antes de pedir, a pessoa procura na area de pedidos entregues pra ver se o que ela quer ja tem la ou nao.
  7. Explica mais o script, como ele escolhe a cidade? Tem uma estatua pra cada cidade?
  8. Vá em data/talkactions/scripts e adicione um arquivo em formato LUA com nome de itemcreate e bote esse script dentro: function onSay(cid, words, param) local configs = {"Magic Plate Armor", "Plate Armor"} -- Nome dos items que podem ser criados local items = { -- Item id dos itens requeridos entre [] e a quantidade depois do = [9971] = 2, [2160] = 100, } local remove = "no" -- Se vai remover os itens requeridos. "yes" ou "no" local stat = true -- Não mecha for i,x in pairs(configs) do configs[i] = x:lower() end if table.find(configs, param:lower()) then for i,x in pairs (items) do if not (getPlayerItemCount(cid, i) >= x) then stat = false end end if stat then doPlayerAddItem(cid, getItemIdByName(param:lower())) if remove:lower() == "yes" then for i,x in pairs(items) do doPlayerRemoveItem(cid, i, x) end end else doPlayerSendCancel(cid, "Voce nao tem os itens requeridos para usar essa talkaction.") end else doPlayerSendCancel(cid, "Voce nao pode criar esse item, ele nao esta disponivel.") end return TRUE end Configure o script como quizer. Agora va em talkactions.xml e adicione essa linha: <talkaction words="!create" event="script" value="itemcreate.lua"/>
  9. Nao precisa fazer double topic. o outro ja foi respondido Denunciado
  10. Peço que parem com as brigas, aqui eh sessão de pedidos. Vá em data/actions/scripts adiciona um arquivo em formato LUA e bote o nome de leveritems e bote esse script: function onUse(cid, item, frompos, item2, topos) local sqmpos = {x=80, y=311, z=7} -- Posiçao do sqm que vao estar os items. local configs = { -- Items a venda, use o nome do item ou seu id. [2472] = 10000, ["Plate Armor"] = 300, ["gold ingot"] = 10000, } local sell = false for i,x in pairs(configs) do for s = 0,255 do sqmpos.stackpos = s if getThingFromPos(sqmpos).itemid == (type(i) == "number" and i or getItemIdByName(i)) then sell = type(sell) == "number" and sell+(getThingFromPos(sqmpos).type > 0 and getThingFromPos(sqmpos).type or 1)*x or (getThingFromPos(sqmpos).type > 0 and getThingFromPos(sqmpos).type or 1)*x doRemoveItem(getThingFromPos(sqmpos).uid) end end end if sell then doPlayerAddMoney(cid, sell) return doPlayerSendTextMessage(cid, 22, "Voce vendeu os items e ganhou " .. sell .. " gold coins.") else return doPlayerSendCancel(cid, "Não tem nenhum item na mesa que esteja a venda.") end end Depois va em actions.xml e bote essa linha: <action actionid="45666" event="script" value="leveritems.lua"/> Adicione o ActionID 45666 na alavanca de vender item e configure a posiçao do sqm que vao estar os itens no script. Botando outros items no script: Vá no script e veja aonde esta assim: Copie a ultima linha e bote logo em baixo e mude a configuraçao: Se voce for usar o nome do item lembre-se de botar entre chaves Exemplo: "magic plate armor"
  11. Bem, existem varios scripts por ai de pontes que aparecem e desaparecem que sao bugadas e pequenas entao eu fiz esse script para que voce pudesse fazer uma ponte grande e decorada: ScreenShot: Vá em data/actions/scripts e bote um arquivo.lua com o nome de pontealavanca com esse script: function removeAll(configs, leverpos, tp, water, leveroff, leveron) local player = nil for i,x in pairs(configs) do for s, t in pairs(x) do for l = 0,255 do if isPlayer(getThingFromPos({x=t.x, y=t.y, z=t.z, stackpos = l}).uid) then player = {x=t.x, y=t.y, z=t.z, stackpos = l} break end end end end if player then doTeleportThing(getThingFromPos(player).uid, tp) end for i,x in pairs(configs) do for s, t in pairs(x) do for l = 0,255 do t.stackpos = l if getThingFromPos(t).itemid == i then if l == 0 then doTransformItem(getThingFromPos(t).uid, water) else doRemoveItem(getThingFromPos(t).uid) end end end end end for l = 0,255 do leverpos.stackpos = l if getThingFromPos(leverpos).itemid == leveron then doTransformItem(getThingFromPos(leverpos).uid, leveroff) break end end end function onUse(cid, item, fromPosition, itemEx, toPosition) local configs = { [1284] = {{x=56, y=60, z=7},{x=56, y=61, z=7},{x=56, y=62, z=7},{x=56, y=63, z=7},{x=56, y=64, z=7},{x=56, y=65, z=7},{x=56, y=66, z=7},{x=55, y=60, z=7},{x=55, y=61, z=7},{x=55, y=62, z=7},{x=55, y=63, z=7},{x=55, y=64, z=7},{x=55, y=65, z=7},{x=55, y=66, z=7},{x=54, y=60, z=7},{x=54, y=61, z=7},{x=54, y=62, z=7},{x=54, y=63, z=7},{x=54, y=64, z=7},{x=54, y=65, z=7},{x=54, y=66, z=7}}, [2742] = {{x=55, y=62, z=7}}, [1543] = {{x=54, y=60, z=7},{x=54, y=61, z=7},{x=54, y=62, z=7},{x=54, y=63, z=7},{x=54, y=64, z=7},{x=54, y=65, z=7},{x=54, y=66, z=7},{x=56, y=60, z=7},{x=56, y=61, z=7},{x=56, y=62, z=7},{x=56, y=63, z=7},{x=56, y=64, z=7},{x=56, y=65, z=7},{x=56, y=66, z=7}}, } local firstpos = {x=56,y=67,z=7} -- Posiçao do lado inicial da ponte local waterid = 4612 -- Item ID da agua. local time = 5 -- Em segundos local leveroff, leveron = 1945, 1946 -- Ids da alavanca puxada e nao puxada, respectivamente. if item.itemid == leveroff then for i,x in pairs(configs) do for s, t in pairs(x) do doCreateItem(i, t) doTransformItem(item.uid, leveron) end end addEvent(removeAll, time*1000, configs, getThingPos(item.uid), firstpos, waterid, leveroff, leveron) end return TRUE end Agora vá em actions.xml e bote essa linha: <action actionid="45666" event="script" value="pontealavanca.lua"/> Bote o actionid 45666 na alavanca e divirta-se '-' Para configurar a ponte basta voce fazer isso: Va no local configs = { ...... Apague tudo e deixe assim: local configs = { } Agora bote o itemid que sera criado ao puxar alavanca entre [] .. assim: local configs = { [1284] } Agora bote um = {}, ... local configs = { [1284] = {}, } Agora bote as posiçoes aonde vao ser criados os items 1284 separados por virgulas. local configs = { [1284] = {{x=1,y=2,z=3},{x=7,y=4,z=3}}, } By MatheusMkalo
  12. Testa ai: function removeAll(configs, leverpos, tp, water, leveroff, leveron) for i,x in pairs(configs) do for s, t in pairs(x) do for l = 0,255 do if isPlayer(getThingFromPos({x=t.x, y=t.y, z=t.z, stackpos = l}).uid) then player = {x=t.x, y=t.y, z=t.z, stackpos = l} break end end end end if player then doTeleportThing(getThingFromPos(player).uid, tp) end for i,x in pairs(configs) do for s, t in pairs(x) do for l = 0,255 do t.stackpos = l if getThingFromPos(t).itemid == i then if l == 0 then doTransformItem(getThingFromPos(t).uid, water) else doRemoveItem(getThingFromPos(t).uid) end end end end end for l = 0,255 do leverpos.stackpos = l if getThingFromPos(leverpos).itemid == leveron then doTransformItem(getThingFromPos(leverpos).uid, leveroff) break end end end function onUse(cid, item, fromPosition, itemEx, toPosition) local configs = { [1284] = {{x=56, y=60, z=7},{x=56, y=61, z=7},{x=56, y=62, z=7},{x=56, y=63, z=7},{x=56, y=64, z=7},{x=56, y=65, z=7},{x=56, y=66, z=7},{x=55, y=60, z=7},{x=55, y=61, z=7},{x=55, y=62, z=7},{x=55, y=63, z=7},{x=55, y=64, z=7},{x=55, y=65, z=7},{x=55, y=66, z=7},{x=54, y=60, z=7},{x=54, y=61, z=7},{x=54, y=62, z=7},{x=54, y=63, z=7},{x=54, y=64, z=7},{x=54, y=65, z=7},{x=54, y=66, z=7}}, [2742] = {{x=55, y=62, z=7}}, [1543] = {{x=54, y=60, z=7},{x=54, y=61, z=7},{x=54, y=62, z=7},{x=54, y=63, z=7},{x=54, y=64, z=7},{x=54, y=65, z=7},{x=54, y=66, z=7},{x=56, y=60, z=7},{x=56, y=61, z=7},{x=56, y=62, z=7},{x=56, y=63, z=7},{x=56, y=64, z=7},{x=56, y=65, z=7},{x=56, y=66, z=7}} } local firstpos = {x=56,y=67,z=7} -- Posiçao do lado inicial da ponte local waterid = 4612 -- Item ID da agua. local time = 15 -- Em segundos local leveroff, leveron = 1945, 1946 if item.itemid == leveroff then for i,x in pairs(configs) do for s, t in pairs(x) do doCreateItem(i, t) doTransformItem(item.uid, leveron) end end addEvent(removeAll, time*1000, configs, getThingPos(item.uid), firstpos, waterid, leveroff, leveron) end return TRUE end Nao se esqueça de configurar essa linha: local firstpos = {x=000,y=000,z=000} -- Posiçao do lado inicial da ponte Testei aqui e funcionou perfeitamente.
  13. Nao precisa postar 2 topicos com o mesmo assunto.
  14. Aqui funcionou vei '-' kk tenso qual versao do seu ot? Que seja tenta muda isso aki no seu config.lua rateExperienceFromPlayers = 0 Talvez funcione
  15. Bem eu fiz oq eu consegui: Vá em data/creaturescripts/scripts e adicione um arquivo.lua com o nome de power.lua com esse script: local damage = 2 -- Aqui voce configura quando vai dar (Se for menor ou igual a um nao vai dar dano extra e nem menos dano.) function onStatsChange(cid, attacker, type, combat, value) damage = damage-1 if damage <= 0 then return TRUE end if isPlayer(attacker) then if getPlayerSlotItem(attacker, 9).itemid == 2203 then doCreatureAddHealth(cid, -(value*damage)) doSendAnimatedText(getCreaturePosition(cid), value*damage, COLOR_YELLOW) doPlayerSendTextMessage(attacker, 23, "You deal +" .. value*damage .. " damage to " .. getCreatureName(cid)) end end return TRUE end Agora vá em creaturescripts.xml e adicione essa linha: <event type="statschange" name="PowerRing" event="script" value="power.lua"/> Agora vá em login.lua e procure por registerCreatureEvent, voce vai ver varias funçoes, bote no meio delas essa linha: registerCreatureEvent(cid, "PowerRing") Bem esta tudo pronto, mas so vai funcionar quando atacar players, se voce quizer que funcione quando atacar monstros tambem faça isso: Adicione em TODOS os monstros do seu ot, antes do </monster> isso: <script> <event name="PowerRing"/> </script> Bem é oq eu pude fazer. Espero que ajude.
  16. Bem fiz uma formula aki que voce muda o exprate e vai aumentar a exp que eles vao ganhar ao matar alguem.. Va na pasta mods do seu ot e adicione um arquivo.xml com o nome de PvpEnforced.xml e bota isso dentro: <?xml version="1.0" encoding="UTF-8"?> <mod name="PvpEnforced" enabled="yes" author="MatheusMkalo" for="Copas"> <creaturescript type="kill" name="KillWar" event="script"><![CDATA[ local exprate = 1 function expGain(killerexp, killedexp, rate) return ((killedexp-killerexp)/100)+(killedexp*0.07)*rate >= 0 and ((killedexp-killerexp)/100)+(killedexp*0.07)*rate or 0 end if isPlayer(target) then if getPlayerIp(cid) ~= getPlayerIp(target) then if lastHit then doPlayerAddExp(cid, expGain(getPlayerExperience(cid), getPlayerExperience(target), exprate)) end end end return TRUE ]]></creaturescript> <creaturescript type="login" name="WarEvent" event="script"><![CDATA[ registerCreatureEvent(cid, "KillWar") return TRUE ]]></creaturescript> </mod> Mude o exprate = 1 para a quantidade que voce desejar, quanto maior mais exp os players vao ganhar ao se mata
  17. Adicionado /rank guilds, que mostra as guilds que mais mataram no ot. Agora com aparencia e frases exatamente iguais ao /rank padrao.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...