Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado

Salve galera, boa tarde. Estou com um probleminha em meu evento.. é o seguinte: Entra varios guilds no castle para matar a torre, ultimo player que mata ganha storage para ele a toda sua guild online, so que o erro é que so ele ganha a storage e nao a guild toda !

 

Spoiler

function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
local killer = lastHitKiller[1]
 if isPlayer(killer) and (getCreatureName(cid) == "Gran Tower") then
    if (getGlobalStorageValue(GRANTOWER.FINALWINNER) ~= getCreatureName(killer)) then
     if getPlayerGuildId(killer) >= 1 then
      for index, creature in ipairs(getGranTowerPlayers()) do
       if getPlayerGuildId(creature) ~= getPlayerGuildId(killer) then
        doTeleportThing(creature, getTownTemplePosition(getPlayerTown(creature)), true)
        end
      end
     else
      for index, creature in ipairs(getGranTowerPlayers()) do
       if getPlayerStorageValue(creature, GRANTOWER.AURA) ~= -1 then
        doTeleportThing(creature, getTownTemplePosition(getPlayerTown(creature)), true)
       end              
      end
     end
     if (getPlayerGuildId(killer) >= 1) then
      setGlobalStorageValue(GRANTOWER.SAVEWINNERGUILDID, getPlayerGuildId(killer))
      for index, creature in ipairs(getGranTowerGuild(getPlayerGuildId(killer))) do
       setPlayerStorageValue(creature, GRANTOWER.AURA, 1)
      end
     end
     setPlayerStorageValue(killer, GRANTOWER.AURA, 1)
     addEvent(changeOutfit, 0, killer)
     setGlobalStorageValue(GRANTOWER.SAVELASTWINNER, getCreatureName(killer))
     addEvent(doCreateMonster, 2 * 1000, "Gran Tower", GRANTOWER.TOWERPOSITION)
     setGlobalStorageValue(GRANTOWER.FINALWINNER, getCreatureName(killer))
     setGlobalStorageValue(GRANTOWER.DESTROYCOUNT, (getGlobalStorageValue(GRANTOWER.DESTROYCOUNT) + 1))
     doBroadcastMessage("[Gran Tower] The Gran Aura is with "..getCreatureName(killer)..", run to destroy the Grand Tower and take it.")
    end
 end
 return true
end

function onTarget(cid, target)
 if isPlayer(cid) and isMonster(target) and (getCreatureName(target) == "Gran Tower") then
    if (getGlobalStorageValue(GRANTOWER.FINALWINNER) == getCreatureName(cid)) then
     doPlayerSendCancel(cid, "Você não pode atacar o Gran Tower, proteja ele!")
     return false
    end
 end
 return true
end

function onStatsChange(cid, attacker, type, combat, value)
 if (type == STATSCHANGE_HEALTHLOSS) and isMonster(cid) and isPlayer(attacker) and (getCreatureName(cid) == "Gran Tower") then
     if (getGlobalStorageValue(GRANTOWER.FINALWINNER) == getCreatureName(attacker)) then
      return false
     end
  end
 return true
end

 

Valendo REP+

@Kemmlly CASO POSSA AJUDAR :d

UPPP!

@Wakon @Absolute Pode me ajudar ? Vlw ;3

Postado
6 horas atrás, Mathwsz disse:

Salve galera, boa tarde. Estou com um probleminha em meu evento.. é o seguinte: Entra varios guilds no castle para matar a torre, ultimo player que mata ganha storage para ele a toda sua guild online, so que o erro é que so ele ganha a storage e nao a guild toda !

 

  Ocultar conteúdo

function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
local killer = lastHitKiller[1]
 if isPlayer(killer) and (getCreatureName(cid) == "Gran Tower") then
    if (getGlobalStorageValue(GRANTOWER.FINALWINNER) ~= getCreatureName(killer)) then
     if getPlayerGuildId(killer) >= 1 then
      for index, creature in ipairs(getGranTowerPlayers()) do
       if getPlayerGuildId(creature) ~= getPlayerGuildId(killer) then
        doTeleportThing(creature, getTownTemplePosition(getPlayerTown(creature)), true)
        end
      end
     else
      for index, creature in ipairs(getGranTowerPlayers()) do
       if getPlayerStorageValue(creature, GRANTOWER.AURA) ~= -1 then
        doTeleportThing(creature, getTownTemplePosition(getPlayerTown(creature)), true)
       end              
      end
     end
     if (getPlayerGuildId(killer) >= 1) then
      setGlobalStorageValue(GRANTOWER.SAVEWINNERGUILDID, getPlayerGuildId(killer))
      for index, creature in ipairs(getGranTowerGuild(getPlayerGuildId(killer))) do
       setPlayerStorageValue(creature, GRANTOWER.AURA, 1)
      end
     end
     setPlayerStorageValue(killer, GRANTOWER.AURA, 1)
     addEvent(changeOutfit, 0, killer)
     setGlobalStorageValue(GRANTOWER.SAVELASTWINNER, getCreatureName(killer))
     addEvent(doCreateMonster, 2 * 1000, "Gran Tower", GRANTOWER.TOWERPOSITION)
     setGlobalStorageValue(GRANTOWER.FINALWINNER, getCreatureName(killer))
     setGlobalStorageValue(GRANTOWER.DESTROYCOUNT, (getGlobalStorageValue(GRANTOWER.DESTROYCOUNT) + 1))
     doBroadcastMessage("[Gran Tower] The Gran Aura is with "..getCreatureName(killer)..", run to destroy the Grand Tower and take it.")
    end
 end
 return true
end

function onTarget(cid, target)
 if isPlayer(cid) and isMonster(target) and (getCreatureName(target) == "Gran Tower") then
    if (getGlobalStorageValue(GRANTOWER.FINALWINNER) == getCreatureName(cid)) then
     doPlayerSendCancel(cid, "Você não pode atacar o Gran Tower, proteja ele!")
     return false
    end
 end
 return true
end

function onStatsChange(cid, attacker, type, combat, value)
 if (type == STATSCHANGE_HEALTHLOSS) and isMonster(cid) and isPlayer(attacker) and (getCreatureName(cid) == "Gran Tower") then
     if (getGlobalStorageValue(GRANTOWER.FINALWINNER) == getCreatureName(attacker)) then
      return false
     end
  end
 return true
end

 

Valendo REP+

@Kemmlly CASO POSSA AJUDAR :d

UPPP!

@Wakon @Absolute Pode me ajudar ? Vlw ;3

 

Pelo que vi, esse script pega o GUILDID do cara que deu o ultimo hit e joga no GlobalStorage, só que acredito que seja necessário outro script para comparar se o GUILDID do player é igual ao GUILDID jogado no global storage, se sim, setPlayerStorageValue(GRANTOWER.SAVEWINNERGUILID, guild id dele), acredito que um script no global event verificando isso constatemente resolva o caso. Alguém sabe outra maneira sem precisar de outro script? Se souber se pronunciem.

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo