- 0
pedido [Pedido] Modificação em Script de Prêmio
-
Quem Está Navegando 0 membros estão online
- Nenhum usuário registrado visualizando esta página.
-
Conteúdo Similar
-
- 0 respostas
- 2161 visualizações
-
- 0 respostas
- 1401 visualizações
-
[TFS 0.4/8.60] NPC que aumenta a velocidade de upar todas as skill no trainer em 40% durante 7 dias!
Por BrunoBrilha,
- 1 resposta
- 2052 visualizações
-
- 1 resposta
- 1689 visualizações
-
- 0 respostas
- 1401 visualizações
-

Pergunta
Farathor 22
Eu tenho um script de evento que funciona assim, O evento é o seguinte, existe um castelo, e nesse castelo são criadas varias torres, e os jogadores irão matar essas torres, no fim do evento, que é quando toda as torres morrem, o jogador que mais bateu, ou seja que rancou mais vida de todas as torres vence, e a guild que mais rancou vida de todas as torres vence também
Esse script abaixo, só da o prêmio, para 1 jogador, o que mais rancou vida das torres, mas eu queria fazer uma modificação, colocar para todas as vocações ganharam, ou seja,
O Sorcerer que mais rancar vida ganha,
O Druid também
Paladin também
Knight também, conseguiram entender
Esse script atual, também tem o seguinte, ele manda uma mensagem que o jogador venceu o evento, e eu gostaria que ele mandasse uma mensagem para cada vocação
{Castle War} O jogador com maior desempenho da vocação Sorcerer foi ...
local query = db.query or db.executeQuery local premios = { -- -- [chance] -- itemid,amount [{1, 5}] = {{12674}, {11754}}, [{10, 30}] = {{2390}, {2469}, {2646}, {8306,5}, {2408}}, [{80, 100}] = {{2160,1000}} } local function getGuildNameById(id) local name = "" local query = db.getResult('SELECT `name` FROM `guilds` WHERE `id` = "'.. id ..'"') if query:getID() == -1 then return true end name = query:getDataString("name") query:free() return name end function pointNumber(number) if not tonumber(number) then return false end local str = "" number = tostring(number):reverse() local count = 0 for i = 1, number:len() do count = count + 1 if count <= 3 then if str == "" then str = number:sub(i, i) else str = str..number:sub(i, i) end else count = 1 str = str.."."..number:sub(i, i) end end return str:reverse() end function onStatsChange(cid, attacker, type, combat, value) if isMonster(cid) and isPlayer(attacker) and type == STATSCHANGE_HEALTHLOSS then if isInArray({"Castle Guardian I", "Castle Guardian II", "Castle Guardian III", "Castle Guardian IV", "Castle Generator", "Ice Crystal"}, getCreatureName(cid)) then doPlayerSetStorageValue(attacker, 1827311, getPlayerStorageValue(attacker, 1827311) + value) local quant = guild_hit_count[getPlayerGuildId(attacker)] and guild_hit_count[getPlayerGuildId(attacker)] or 0 guild_hit_count[getPlayerGuildId(attacker)] = quant + value end end return true end function onDeath(cid, corpse, deathList) local gid = 0 local winner = 0 if isMonster(cid) and getCreatureName(cid) == "Ice Crystal" then if not getPlayingGuilds() then return true end local guilds = getPlayingGuilds() local max = 0 for index, var in pairs(guild_hit_count) do if var > max then max = var gid = index end end setGlobalStorageValue(1823999, gid) query("UPDATE `castle_dono` SET `guild_id` = '"..gid.."' WHERE `guild_id` > 0") doBroadcastMessage("{Castle War} O evento acabou, a guild com maior desempenho foi "..getGuildNameById(gid)..", com "..pointNumber(max).." pontos sobre o castelo.") updateCastleData() setGlobalStorageValue(18219113, -1) if gid > 0 then local mx = 0 for _, pid in pairs(getPlayersOnline()) do if getPlayerGuildId(pid) == gid then local st = getPlayerStorageValue(pid, 1827311) if st > mx then mx = st winner = pid end end end if isPlayer(winner) then local r = math.random(1,100) for v, k in pairs(premios) do if r >= v[1] and r <= v[2] then local rand = k[math.random(#k)] itemr, amountr = rand[1], (not rand[2] and 1 or rand[1] and rand[2] or 1) end end local recompensa = doPlayerAddItem(winner, itemr, amountr) doBroadcastMessage("{Castle War} O jogador com maior desempenho foi "..getCreatureName(winner)..", com "..pointNumber(mx).." pontos sobre o castelo. Ele recebeu "..pointNumber(amountr).."x "..getItemNameById(itemr).." como premio.") doItemSetAttribute(recompensa, 'description', "Premio do jogador "..getCreatureName(winner).." ganho no evento castle war do dia "..os.date("%d/%m/%y")..".") local medal = doPlayerAddItem(winner, 10127, 1) doItemSetAttribute(medal, 'description', "Trofeu ganho pelo jogador "..getCreatureName(winner).." no evento castle war do dia "..os.date("%d/%m/%y")..".") end end for _, pid in pairs(getPlayersOnline()) do if isInArea(getThingPos(pid), {x = 500, y = 574, z = 6}, {x = 575, y = 620, z = 6}) or isInArea(getThingPos(pid), {x = 511, y = 588, z = 5}, {x = 556, y = 607, z = 5}) or isInArea(getThingPos(pid), {x = 511, y = 588, z = 4}, {x = 556, y = 607, z = 4}) or isInArea(getThingPos(pid), {x = 511, y = 588, z = 3}, {x = 556, y = 607, z = 3}) or isInArea(getThingPos(pid), {x = 481, y = 580, z = 7}, {x = 683, y = 798, z = 7}) then doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid))) end end guild_hit_count = {} end return true endEditado por FarathorLink para o comentário
https://xtibia.com/forum/topic/239305-pedido-modifica%C3%A7%C3%A3o-em-script-de-pr%C3%AAmio/Compartilhar em outros sites
Top Posters For This Question
29
25
5
Popular Days
Fev 15
31
Fev 14
13
Fev 10
5
Fev 18
4
Top Posters For This Question
Farathor 29 posts
Skulls 25 posts
othereality 5 posts
Popular Days
Fev 15 2016
31 posts
Fev 14 2016
13 posts
Fev 10 2016
5 posts
Fev 18 2016
4 posts
Popular Posts
Skulls
Troca pointNumber(mx) por pointNumber(mx) E ae?
Skulls
Eu já sei o pq, vou editar aqui 2 segundos. Troca: local st = getPlayerStorageValue(pid, 1827311) local i = getPlayerVocation(pid) if st > mx[i%4] then... por local st = getPlayerSto
Skulls
Troca: local st = getPlayerStorageValue(pid, 1827311) local i = getPlayerVocation(pid) if st > mx[i%4] then... por local st = getPlayerStorageValue(pid, 1827311) local i = getPlayerVocat
58 respostass a esta questão
Posts Recomendados