Tudo que zipter98 postou
-
[Script] Advance Level
local storage = 8601 local level = xxx --Level que o jogador deve alcançar. local cash = xxx --Dinheiro que o jogador vai receber. function onAdvance(cid, skill, oldLevel, newLevel) if skill == SKILL__LEVEL and getPlayerStorageValue(cid, storage) < 1 then if newLevel >= level then broadcastMessage(getCreatureName(cid).." alcançou o nível "..newLevel) doPlayerAddMoney(cid, cash) setPlayerStorageValue(cid, storage, 1) end end return true end
-
[Script] Advance Level
Não se esqueça de registrar o evento em login.lua. local storage = 8601 local level = xxx --Level que o jogador deve alcançar. function onAdvance(cid, skill, oldLevel, newLevel) if skill == SKILL__LEVEL and getPlayerStorageValue(cid, storage) < 1 then if newLevel >= level then broadcastMessage(getCreatureName(cid).." alcançou o nível "..newLevel) setPlayerStorageValue(cid, storage, 1) end end return true end
-
Problemas ao usar a Pokedex
Basta você configurar normalmente o pokémon em configuration.lua, e as informações para a pokedex serão pegas automaticamente. Ex.: moves na tabela movestable, level na tabela pokes e evolução na tabela poevo.
-
Texto em teleports (8.6)
Se não se importa, fiz minha versão do código (configuração mais fácil): local config = { --["text"] = {{position}, effect, color}, ["Batata"] = {{x = 500, y = 500, z = 7}, 11, 140}, ["Cenoura"] = {{x = 497, y = 503, z = 7}, 13, 123}, } function onThink() for text, info in pairs(config) do doSendAnimatedText(info[1], text, info[3]) doSendMagicEffect(info[1], info[2]) end return true end
-
Evento Assasin
Falta de atenção no creaturescript, obrigado por alertar. E, na verdade, são segundos sim. Após entrar a quantidade máxima de jogadores no evento ou se passarem os 5 minutos de espera, os jogadores tem config.startTime segundos para se preparar.
-
(Resolvido)Sistema rare!
local price = {itemid, count} --Troque itemid pelo ID do item que será cobrado, e count pela quantia. local items = { --[itemid] = {chance, count}, >> Onde itemid é o ID do item, chance, obviamente, a chance dele ser sorteado, e count, a quantidade. --Exemplo: >> Para adicionar mais items, siga o modelo indicado acima. [itemid] = {chance, count}, --[2160] = {50, 10}, >> Assim, o item de ID 2160 teria 50% de chance de ser sorteado. Quantidade -> 10. [8303] = {70, 5}, [8302] = {70, 5}, [7422] = {30, 1}, } function onUse(cid) local _table = {} local number = math.random(1, 100) local item = 0 if doPlayerRemoveItem(cid, price[1], price[2]) then for itemid, chance in pairs(items) do if item == 0 then table.insert(_table, itemid) item = itemid else local new_chance = math.abs(chance[1] - number) local old_chance = math.abs(items[item][1] - number) if new_chance < old_chance then if #_table > 0 then _table = {} end table.insert(_table, itemid) item = itemid elseif new_chance == old_chance then table.insert(_table, itemid) end end end if item ~= 0 then if #_table > 1 then item = _table[math.random(1, #_table)] end local count = items[item][2] if not isItemStackable(item) then if count > 1 then for i = 1, count do doPlayerAddItem(cid, item, 1) end else doPlayerAddItem(cid, item, 1) end else doPlayerAddItem(cid, item, count) end broadcastMessage(getCreatureName(cid).." apostou e ganhou "..getItemNameById(item)..".") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You received: "..count.."x "..getItemNameById(item)..(count > 1 and "s" or "")..".") end else return doPlayerSendCancel(cid, "You do not have "..price[2].." "..getItemNameById(price[1])..".") end return true end
-
(Resolvido)Um Script de um evento Diario
Optei por fazer uma premiação justa - assim, é possível que haja mais de um ganhador em alguma(s) colocação(ões). Se isto ocorrer, o prêmio em dinheiro será dividido automaticamente entre os ganhadores. Ex.: Número sorteado: 48 Jogadores participando do evento: {Fulano, escolheu número 32}, {Ciclano, número 47}, {Error, número 49}, {Troglodita, número 30}, {zipter, número 29}. Assim, a colocação ficará: [1 lugar] = Ciclano e Error (o dinheiro será dividido entre ambos) [2 lugar] = Fulano [3 lugar] = Troglodita A configuração, como pode ver, é simples: winners = { [colocação] = {cash = prêmio_em_dinheiro, items = {ID do item prêmio, quantidade do item prêmio}}, }, Enfim, vamos ao código: Talkaction: local storages = {8932, 8931} local price = 100000 --Preço para participar do sorteio. function onSay(cid, words, param) if getGlobalStorageValue(storages[1]) < 1 then return doPlayerSendCancel(cid, "Event is not on.") elseif getPlayerStorageValue(cid, storages[2]) > -1 then return doPlayerSendCancel(cid, "You already chose your number.") elseif param == "" or not tonumber(param) or tonumber(param) < 1 or tonumber(param) > 100 then return doPlayerSendCancel(cid, "/sorteio 1-100") elseif getPlayerMoney(cid) < price then return doPlayerSendCancel(cid, "You do not have enough money ("..price..").") end setPlayerStorageValue(cid, storages[2], tonumber(param)) doPlayerRemoveMoney(cid, price) doPlayerSendTextMessage(cid, 27, "Agora você está participando do evento, seu número: "..param..", Aguarde o resultado, Boa sorte!") return true end Tag: <talkaction words="/sorteio" event="script" value="nome_do_arquivo.lua"/> Globalevent: local config = { days = {"Monday", "Tuesday", "Saturday"}, --Dias que o evento ocorrerá. time = 5, --Tempo para o sorteio ocorrer. winners = { --[place] = {cash = xxx, items = {itemid, count}}, }, storages = {8931, 8932}, } function getRuffleNumbers(a) local z = {} local c = {} for _, cid in pairs(getPlayersOnline()) do if getPlayerStorageValue(cid, config.storages[1]) > -1 then table.insert(z, math.abs(getPlayerStorageValue(cid, config.storages[1]) - a)) end end for i = 1, #config.winners do for j = 1, #z do if not table.find(c, z[j]) then if not c[i] then c[i] = z[j] else if z[j] < c[i] then c[i] = z[j] end end end end end return c end function onTime() if isInArray(config.days, os.date("%A")) then broadcastMessage("O evento do sorteio iniciou, diga /sorteio numero(de 1 a 100) para escolher seu numero, em aproximadamente 5 minutos saira o resultado!") setGlobalStorageValue(config.storages[2], 1) addEvent(function() local a = math.random(1, 100) if #getRuffleNumbers(a) < 1 then broadcastMessage("Ninguém participou do sorteio. :/") setGlobalStorageValue(config.storages[2], -1) else broadcastMessage("E o número sorteado foi... "..a.."! Os ganhadores foram:") local c = getRuffleNumbers(a) for i = 1, #c do local players, p, gold = {}, "", 0 gold = config.winners[i].cash for _, cid in pairs(getPlayersOnline()) do if getPlayerStorageValue(cid, config.storages[1]) > -1 then if getPlayerStorageValue(cid, config.storages[1]) == math.abs(c[i] - a) or getPlayerStorageValue(cid, config.storages[1]) == math.abs(c[i] + a) then table.insert(players, cid) doPlayerAddItem(cid, config.winners[i].items[1], config.winners[i].items[2]) end setPlayerStorageValue(cid, config.storages[1], -1) end end for j = 1, #players do gold = math.floor(config.winners[i].cash / #players) doPlayerAddMoney(players[j], gold) if p == "" then p = getCreatureName(players[j]) else p = p..(j == #players and " and" or ",").." "..getCreatureName(players[j]) end end broadcastMessage(i.." lugar: "..p.." - cash: "..gold.." - item: "..config.winners[i].items[2].."x "..getItemNameById(config.winners[i].items[1])..".") end end local query = db.getResult("SELECT id, online FROM players") if query:getID() == -1 then return true end repeat local online = query:getDataInt("online") local i = query:getDataInt("id") if online < 1 then db.executeQuery("UPDATE player_storage SET value = -1 WHERE key = "..config.storages[1].." AND value > -1 AND player_id = "..i) end until not query:next() query:free() end, config.time * 60 * 1000) end return true end Tag: <!-- Coloque, em time, o horário 5 minutos antes do sorteio ser realizado. --> <!-- Por exemplo, se colocar 19:55, o sorteio vai ser realizado as 20:00. --> <globalevent name="Sorteio" time="19:55" event="script" value="nome_do_arquivo.lua"/> OBS: Testei o código apenas em situações hipotéticas (como aquele exemplo no começo do post) num depurador de lua.
-
Char não poder ter nick de monstro
Isso teria que ser feito em C++, não lua. :v
-
(Resolvido)Sistema rare!
A mensagem só vai aparecer com o item raro, ou com todos os items?
-
(Resolvido)Sistema rare!
Hm, troca por esse código: local price = {itemid, count} --Troque itemid pelo ID do item que será cobrado, e count pela quantia. local items = { --[itemid] = {chance, count}, >> Onde itemid é o ID do item, chance, obviamente, a chance dele ser sorteado, e count, a quantidade. --Exemplo: >> Para adicionar mais items, siga o modelo indicado acima. [itemid] = {chance, count}, --[2160] = {50, 10}, >> Assim, o item de ID 2160 teria 50% de chance de ser sorteado. Quantidade -> 10. [8303] = {70, 5}, [8302] = {70, 5}, [7422] = {30, 1}, } function onUse(cid) local _table = {} local number = math.random(1, 100) local item = 0 if doPlayerRemoveItem(cid, price[1], price[2]) then for itemid, chance in pairs(items) do if item == 0 then table.insert(_table, itemid) item = itemid else local new_chance = math.abs(chance[1] - number) local old_chance = math.abs(items[item][1] - number) if new_chance < old_chance then if #_table > 0 then _table = {} end table.insert(_table, itemid) item = itemid elseif new_chance == old_chance then table.insert(_table, itemid) end end end if item ~= 0 then if #_table > 1 then item = _table[math.random(1, #_table)] end local count = items[item][2] if not isItemStackable(item) then if count > 1 then for i = 1, count do doPlayerAddItem(cid, item, 1) end else doPlayerAddItem(cid, item, 1) end else doPlayerAddItem(cid, item, count) end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You received: "..count.."x "..getItemNameById(item)..(count > 1 and "s" or "")..".") end else return doPlayerSendCancel(cid, "You do not have "..price[2].." "..getItemNameById(price[1])..".") end return true end
-
Actios que remueve dos items
Se possível, poste o seu código atual. Além de ter relido o script várias vezes, o testei e funcionou perfeitamente.
-
(Resolvido)Sistema rare!
Você usa duas travessões (--) apenas quando quer deixar um comentário no código. Assim, a parte que vier depois não será lida quando o script for executado. Troque: --[8303] = {70, 5}, --[8302] = {70, 5}, --[7422] = {30, 1}, >> Onde itemid é o ID do item, chance, obviamente, a chance dele ser sorteado, e count, a quantidade. por: [8303] = {70, 5}, [8302] = {70, 5}, [7422] = {30, 1},
-
Actios que remueve dos items
Você provavelmente não copiou corretamente o código.
-
(Resolvido)Sistema de Cofre
De nada. (:
-
(Resolvido)Sistema rare!
^ Se o item não for stackable, a quantia adicionada será sempre 1, não importando o que você coloca no parâmetro. @Kd meu arrozz Testarei o código e verei o que pode estar causando tal erro. Se possível, poste o código com suas alterações. Talvez, na verdade, o erro esteja nas configurações. EDIT: Testei o código, e está funcionando perfeitamente. Há algum erro no console? E, novamente: poste o código alterado por você, por favor.
-
(Resolvido)[PEDIDO] Teleport que ao passar entrega um item para o player.
Na função getItemWeight, o primeiro parâmetro deve ser um UID (unique ID), não um itemid. getItemWeight(uid[, precise])
- [AJUDA] DistanceEffect
-
[LUA] Function onUse
Claro, mande uma PM a vontade.
-
Actios que remueve dos items
local items = {{5903, 1}, {itemid, count}} --Troque itemid pelo ID do item e count pela quantidade. function onUse(cid, item, frompos, item2, topos) if item.uid == 3010 then if getPlayerStorageValue(cid, 30010) < 1 then for i = 1, #items do if getPlayerItemCount(cid, items[i][1]) < items[i][2] then return doPlayerSendCancel(cid, "You do not have "..items[i][2].." "..getItemNameById(items[i][1])..".") end end doPlayerSendTextMessage(cid, 22, "You have found Mage Addons.") for i = 1, 2 do doPlayerAddOutfit(cid, 138, i) doPlayerAddOutfit(cid, 130, i) end for i = 1, #items do doPlayerRemoveItem(cid, items[i][1], items[i][2]) end doSendMagicEffect(topos, 12) setPlayerStorageValue(cid, 30010, 1) else doPlayerSendTextMessage(cid, 22, "You already have this addons.") end end return true end
-
[LUA] Function onUse
O correto é item.actionid, não item.aid.
-
(Resolvido)[PEDIDO] Teleport que ao passar entrega um item para o player.
De nada. (:
-
(Resolvido)[PEDIDO] Teleport que ao passar entrega um item para o player.
@Bruno No seu código, caso a criatura que execute a ação (ou seja, cid) não seja um jogador, haverá erro de player not found. Recomendaria deixar a seguinte verificação no início do script: if not isPlayer(cid) then return true end
-
(Resolvido)[AJUDA] starter.lua
Mude: local storage = 90561 para: local storage = 66966 Ou poste o código do teleporte (data/movements/scripts). Você não preferiria que o jogador fosse automaticamente teleportado ao pegar o pokémon inicial, ao invés de ter que passar por um teleporte? Se sim, delete o teleporte e troque o código da action por este: local pokemons = { [4230] = "Torchic", [4231] = "Mudkip", [4232] = "Treecko", [4233] = "Charmander", [4234] = "Squirtle", [4235] = "Bulbasaur", } local toPos = {x = x, y = y, z = z} --Para onde o jogador será teleportado. local storage = 90561 function onUse(cid, item) if pokemons[item.actionid] and getPlayerStorageValue(cid, storage) < 1 then doPlayerSendTextMessage(cid, 27, "Parabéns!! Você pegou seu Pokemon Inicial!! BEM-VINDO AO POKEMON ENTRE NO TELEPORT") setPlayerStorageValue(cid, storage, 1) doSendMagicEffect(getThingPos(cid), 29) doPlayerAddItem(cid, 2392, 100) doPlayerAddItem(cid, 12344, 100) doTeleportThing(cid, toPos) addPokeToPlayer(cid, pokemons[item.actionid], false, false, nil, 0, "super", false) end return true end
-
(Resolvido)[AJUDA] starter.lua
Pode sim.
-
(Resolvido)[PEDIDO] Teleport que ao passar entrega um item para o player.
Faltou um end. t.t