Ir para conteúdo

Pergunta

Queria ao invés de os itens recebidos fossem fixo, queria que desse ele no sistema de Random para cada hora que um vencer ganhar diferentes itens aleatoriamente.

SCRIPT

 

  Mostrar conteúdo oculto

 

Link para o comentário
https://xtibia.com/forum/topic/211482-como-colocar-para-dar-item-random-nesse-script/
Compartilhar em outros sites

9 respostass a esta questão

Posts Recomendados

  • 0

Testa ai manolo:

 

function loseOnZombieArena(cid)
kickPlayerFromZombiesArea(cid)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "BOOM! Você está morto.")
local players = getZombiesEventPlayers()
if(#players <= 1) then
local winner = players[1]
local items = {2160, 7958, 2352, 12610}
if(winner) then
doPlayerAddItem(cid,items[math.random(1,#items)], math.random(1, 100))
doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, "Você Ganhou o Evento Zombie !!! Parabéns.")
doBroadcastMessage("After " .. os.time() - getPlayerZombiesEventStatus(winner) .. " segundos de evento " .. getCreatureName(winner) .. " você ganhou o Evento Zombie contra " .. getStorage(ZE_ZOMBIES_SPAWNED) .. " zombies !!!")
kickPlayerFromZombiesArea(winner)
else
doBroadcastMessage("Zombie Evento Acabou !!! Não teve vencedor ?!?!?! Como Assim ?")
end
doSetStorage(ZE_STATUS, 0)
doSetStorage(ZE_PLAYERS_NUMBER, ZE_DEFAULT_NUMBER_OF_PLAYERS)
doSetStorage(ZE_ZOMBIES_TO_SPAWN, 0)
doSetStorage(ZE_ZOMBIES_SPAWNED, 0)
local width = (math.max(ZE_spawnFromPosition.x, ZE_spawnToPosition.x) - math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)) / 2 + 1
local height = (math.max(ZE_spawnFromPosition.y, ZE_spawnToPosition.y) - math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)) / 2 + 1
local centerPos = {x=math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)+width,y=math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)+height,z=ZE_spawnFromPosition.z}
for z = math.min(ZE_spawnFromPosition.z, ZE_spawnToPosition.z), math.max(ZE_spawnFromPosition.z, ZE_spawnToPosition.z) do
centerPos.z = z
for i, uid in pairs(getSpectators(centerPos, width, height, false)) do
if(isMonster(uid)) then
doRemoveCreature(uid)
end
end
end
end
end
function onStatsChange(target, cid, changetype, combat, value)
if((cid and isMonster(cid) and getCreatureName(cid) == "Zombie Event") or (isInRange(getThingPosition(target), ZE_spawnFromPosition, ZE_spawnToPosition) and changetype == STATSCHANGE_HEALTHLOSS and math.abs(value) >= getCreatureHealth(target))) then
doCreatureAddHealth(target, getCreatureMaxHealth(target))
loseOnZombieArena(target)
return false
end
return true
end

Editado por PsyMcKenzie
  • 0
  Em 06/04/2013 em 07:56, PsyMcKenzie disse:

Testa ai manolo:

 

function loseOnZombieArena(cid)
kickPlayerFromZombiesArea(cid)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "BOOM! Você está morto.")
local players = getZombiesEventPlayers()
if(#players <= 1) then
local winner = players[1]
local items = {2160, 7958, 2352, 12610}
if(winner) then
doPlayerAddItem(cid,items[math.random(1,#items)], math.random(1, 100))
doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, "Você Ganhou o Evento Zombie !!! Parabéns.")
doBroadcastMessage("After " .. os.time() - getPlayerZombiesEventStatus(winner) .. " segundos de evento " .. getCreatureName(winner) .. " você ganhou o Evento Zombie contra " .. getStorage(ZE_ZOMBIES_SPAWNED) .. " zombies !!!")
kickPlayerFromZombiesArea(winner)
else
doBroadcastMessage("Zombie Evento Acabou !!! Não teve vencedor ?!?!?! Como Assim ?")
end
doSetStorage(ZE_STATUS, 0)
doSetStorage(ZE_PLAYERS_NUMBER, ZE_DEFAULT_NUMBER_OF_PLAYERS)
doSetStorage(ZE_ZOMBIES_TO_SPAWN, 0)
doSetStorage(ZE_ZOMBIES_SPAWNED, 0)
local width = (math.max(ZE_spawnFromPosition.x, ZE_spawnToPosition.x) - math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)) / 2 + 1
local height = (math.max(ZE_spawnFromPosition.y, ZE_spawnToPosition.y) - math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)) / 2 + 1
local centerPos = {x=math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)+width,y=math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)+height,z=ZE_spawnFromPosition.z}
for z = math.min(ZE_spawnFromPosition.z, ZE_spawnToPosition.z), math.max(ZE_spawnFromPosition.z, ZE_spawnToPosition.z) do
centerPos.z = z
for i, uid in pairs(getSpectators(centerPos, width, height, false)) do
if(isMonster(uid)) then
doRemoveCreature(uid)
end
end
end
end
end
function onStatsChange(target, cid, changetype, combat, value)
if((cid and isMonster(cid) and getCreatureName(cid) == "Zombie Event") or (isInRange(getThingPosition(target), ZE_spawnFromPosition, ZE_spawnToPosition) and changetype == STATSCHANGE_HEALTHLOSS and math.abs(value) >= getCreatureHealth(target))) then
doCreatureAddHealth(target, getCreatureMaxHealth(target))
loseOnZombieArena(target)
return false
end
return true
end

ta quase certo, os itens está indo pra quem perde o evento e não pra quem vence !!!!

  • 0

Thiago, troque por:

 

 

  Mostrar conteúdo oculto

 

  • 0
  Mostrar conteúdo oculto

  • 0
  Em 06/04/2013 em 13:45, Roksas disse:

Thiago, troque por:

 

 

  Mostrar conteúdo oculto

 

 

Funfo certinho agora obrigadão !!!

 

Dúvida Resolvida

×
×
  • Criar Novo...