Ir para conteúdo

Featured Replies

Postado

Galera é o seguinte, eu estou com essa script de zombie event 100% , mas porem quando começa a nascer os zombie todo mundo do servidor ficam vendo as msg dos zombies nascendo, eu gostaria de por só quem está dentro do evento ver as mensagem do zombies.

Quem poder ajudar, vou agradece muito. 

aqui a foto \/ -> todo mundo ver essa msg, quero que só os perssonagem do evento vejam 

 

Sem título.png

local config = {
    playerCount = 2001, -- Global storage for counting the players left/entered in the event
    zombieCount = 2002, -- Global storage for counting the zombies in the event
    teleportActionId = 2008, -- Action id of the teleport needed for the movement script
    teleportPosition = {x = 1004, y = 1003, z = 7, stackpos = 1}, -- Where the teleport will be created
    teleportToPosition = {x = 1096, y = 207, z = 7}, -- Where the teleport will take you
    teleportId = 1387, -- Id of the teleport
    timeToStartEvent = 1, -- Minutes, after these minutes the teleport will be removed and the event will be declared started
    timeBetweenSpawns = 1, -- Seconds between each spawn of zombie
    zombieName = "event zombie", -- Name of the zombie that should be summoned
    playersNeededToStartEvent = 2, -- Players needed before the zombies can spawn.
    
    -- Should be the same as in the creaturescript!
    -- The zombies will spawn randomly inside this area
      fromPosition = {x = 1081, y = 188, z = 7}, -- top left cornor of the playground
    toPosition = {x = 1111, y = 207, z = 7}, -- bottom right cornor of the playground
    }

function onTime()
    local tp = doCreateTeleport(config.teleportId, config.teleportToPosition, config.teleportPosition)
    doItemSetAttribute(tp, "aid", config.teleportActionId)
    doBroadcastMessage("Zombie event sera iniciado em " .. config.timeToStartEvent .. " minutos! O teleport foi removido para o evento comecar!", MESSAGE_STATUS_WARNING)
    setGlobalStorageValue(config.playerCount, 0)
    setGlobalStorageValue(config.zombieCount, 0)
    addEvent(startEvent, config.timeToStartEvent * 1000 * 60)
    print(getGlobalStorageValue(2001))
end

function startEvent()
    local get = getThingfromPos(config.teleportPosition)
    if get.itemid == config.teleportId then
        doRemoveItem(get.uid, 1)
    end
    
    local fromp, top = config.fromPosition, config.toPosition

    if getGlobalStorageValue(config.playerCount) >= config.playersNeededToStartEvent then
        addEvent(spawnZombie, config.timeBetweenSpawns * 1000)
        doBroadcastMessage("Boa sorte no evento todos os players que entraram no evento de zumbis! O teleport fechou!", MESSAGE_STATUS_WARNING)
        
        for x = fromp.x, top.x do
            for y = fromp.y, top.y do
                for z = fromp.z, top.z do
                    areapos = {x = x, y = y, z = z, stackpos = 253}
                    getPlayers = getThingfromPos(areapos)
                    if isPlayer(getPlayers.uid) then
                        doPlayerSendTextMessage(getPlayers.uid, MESSAGE_EVENT_ADVANCE, "Primeiro zumbi irá nascer em " .. config.timeBetweenSpawns .. " segundos! Boa sorte!")
                    end
                end
            end
        end
    else
        doBroadcastMessage("O evento Zombie não pode iniciar devido a pouca quantidade de jogadores participantes.\n Pelo menos " .. config.playersNeededToStartEvent .. " players é necessário!", MESSAGE_STATUS_WARNING)
        for x = fromp.x, top.x do
            for y = fromp.y, top.y do
                for z = fromp.z, top.z do
                    areapos = {x = x, y = y, z = z, stackpos = 253}
                    getPlayers = getThingfromPos(areapos)
                    if isPlayer(getPlayers.uid) then
                        doTeleportThing(getPlayers.uid, getTownTemplePosition(getPlayerTown(getPlayers.uid)), false)
                        doSendMagicEffect(getPlayerPosition(getPlayers.uid), CONST_ME_TELEPORT)
                    end
                end
            end
        end
    end
end

function spawnZombie()
    if getGlobalStorageValue(config.playerCount) >= 2 then
        pos = {x = math.random(config.fromPosition.x, config.toPosition.x), y = math.random(config.fromPosition.y, config.toPosition.y), z = math.random(config.fromPosition.z, config.toPosition.z)}
        doSummonCreature(config.zombieName, pos)
        doSendMagicEffect(pos, CONST_ME_MORTAREA)
        setGlobalStorageValue(config.zombieCount, getGlobalStorageValue(config.zombieCount)+1)
        doBroadcastMessage("A zombie has spawned! There is currently " .. getGlobalStorageValue(config.zombieCount) .. " zombies in the zombie event!", MESSAGE_STATUS_CONSOLE_RED)
        addEvent(spawnZombie, config.timeBetweenSpawns * 1000)
    end
end

 

Editado por helix758 (veja o histórico de edições)

  • Respostas 9
  • Visualizações 494
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • ah cara, dai eu teria que revisar o seu script, e na verdade eu já estou desenvolvendo um zombie system para 8.6 e TFS 1.2+   eu ainda não terminei devido á uns problemas, mas creio que até

Posted Images

Postado

Bom dia!

Troque sua função spawnZombie() por essa e veja se resolve.

function spawnZombie()
    if getGlobalStorageValue(config.playerCount) >= 2 then
        pos = {x = math.random(config.fromPosition.x, config.toPosition.x), y = math.random(config.fromPosition.y, config.toPosition.y), z = math.random(config.fromPosition.z, config.toPosition.z)}
        doSummonCreature(config.zombieName, pos)
        doSendMagicEffect(pos, CONST_ME_MORTAREA)
        setGlobalStorageValue(config.zombieCount, getGlobalStorageValue(config.zombieCount)+1)
	  if isPlayer(getPlayers.uid) then
            doPlayerSendTextMessage(getPlayers.uid, MESSAGE_STATUS_WARNING, "A zombie has spawned! There is currently " .. getGlobalStorageValue(config.zombieCount) .. " zombies in the zombie event!")
        end
	   addEvent(spawnZombie, config.timeBetweenSpawns * 1000)
    end
end

até!

Postado
  • Autor
8 horas atrás, DeiaFB disse:

Bom dia!

Troque sua função spawnZombie() por essa e veja se resolve.


function spawnZombie()
    if getGlobalStorageValue(config.playerCount) >= 2 then
        pos = {x = math.random(config.fromPosition.x, config.toPosition.x), y = math.random(config.fromPosition.y, config.toPosition.y), z = math.random(config.fromPosition.z, config.toPosition.z)}
        doSummonCreature(config.zombieName, pos)
        doSendMagicEffect(pos, CONST_ME_MORTAREA)
        setGlobalStorageValue(config.zombieCount, getGlobalStorageValue(config.zombieCount)+1)
	  if isPlayer(getPlayers.uid) then
            doPlayerSendTextMessage(getPlayers.uid, MESSAGE_STATUS_WARNING, "A zombie has spawned! There is currently " .. getGlobalStorageValue(config.zombieCount) .. " zombies in the zombie event!")
        end
	   addEvent(spawnZombie, config.timeBetweenSpawns * 1000)
    end
end

até!

Opá  boa tarde, mas não funcionou :(, simplesmente as msg sumiram e não aparece mais nada :p 

10 horas atrás, DeiaFB disse:

Bom dia!

Troque sua função spawnZombie() por essa e veja se resolve.


function spawnZombie()
    if getGlobalStorageValue(config.playerCount) >= 2 then
        pos = {x = math.random(config.fromPosition.x, config.toPosition.x), y = math.random(config.fromPosition.y, config.toPosition.y), z = math.random(config.fromPosition.z, config.toPosition.z)}
        doSummonCreature(config.zombieName, pos)
        doSendMagicEffect(pos, CONST_ME_MORTAREA)
        setGlobalStorageValue(config.zombieCount, getGlobalStorageValue(config.zombieCount)+1)
	  if isPlayer(getPlayers.uid) then
            doPlayerSendTextMessage(getPlayers.uid, MESSAGE_STATUS_WARNING, "A zombie has spawned! There is currently " .. getGlobalStorageValue(config.zombieCount) .. " zombies in the zombie event!")
        end
	   addEvent(spawnZombie, config.timeBetweenSpawns * 1000)
    end
end

até!

Opá  boa tarde, mas não funcionou :(, simplesmente as msg sumiram e não aparece mais nada :p 

up

up

UP

Postado
local config = {
	playerCount = 2001, -- Global storage for counting the players left/entered in the event
	zombieCount = 2002, -- Global storage for counting the zombies in the event
	teleportActionId = 2008, -- Action id of the teleport needed for the movement script
	teleportPosition = {x = 1004, y = 1003, z = 7, stackpos = 1}, -- Where the teleport will be created
	teleportToPosition = {x = 1096, y = 207, z = 7}, -- Where the teleport will take you
	teleportId = 1387, -- Id of the teleport
	timeToStartEvent = 1, -- Minutes, after these minutes the teleport will be removed and the event will be declared started
	timeBetweenSpawns = 1, -- Seconds between each spawn of zombie
	zombieName = "event zombie", -- Name of the zombie that should be summoned
	playersNeededToStartEvent = 2, -- Players needed before the zombies can spawn.
	fromPosition = {x = 1081, y = 188, z = 7}, -- top left cornor of the playground
	toPosition = {x = 1111, y = 207, z = 7}, -- bottom right cornor of the playground
}
function onTime()
	local tp = doCreateTeleport(config.teleportId, config.teleportToPosition, config.teleportPosition)
	doItemSetAttribute(tp, "aid", config.teleportActionId)
	doBroadcastMessage("Zombie event sera iniciado em " .. config.timeToStartEvent .. " minutos! O teleport foi removido para o evento comecar!", MESSAGE_STATUS_WARNING)
	setGlobalStorageValue(config.playerCount, 0)
	setGlobalStorageValue(config.zombieCount, 0)
	addEvent(startEvent, config.timeToStartEvent * 1000 * 60)
	print(getGlobalStorageValue(2001))
end

function doBroadCastZombie(type, msg)
	for _, cid in pairs(getPlayersOnline()) do
		if isInRange(getCreaturePosition(cid), config.fromPosition, config.toPosition) then
			doPlayerSendTextMessage(cid, type, msg)
		end
	end
end

function startEvent()
	local get = getThingfromPos(config.teleportPosition)
	if get.itemid == config.teleportId then
		doRemoveItem(get.uid, 1)
	end
	
	local fromp, top = config.fromPosition, config.toPosition
	if getGlobalStorageValue(config.playerCount) >= config.playersNeededToStartEvent then
		addEvent(spawnZombie, config.timeBetweenSpawns * 1000)
		doBroadcastMessage("Boa sorte no evento todos os players que entraram no evento de zumbis! O teleport fechou!", MESSAGE_STATUS_WARNING)
		
		for x = fromp.x, top.x do
			for y = fromp.y, top.y do
				for z = fromp.z, top.z do
					areapos = {x = x, y = y, z = z, stackpos = 253}
					getPlayers = getThingfromPos(areapos)
					if isPlayer(getPlayers.uid) then
						doPlayerSendTextMessage(getPlayers.uid, MESSAGE_EVENT_ADVANCE, "Primeiro zumbi irá nascer em " .. config.timeBetweenSpawns .. " segundos! Boa sorte!")
					end
				end
			end
		end
	else
		doBroadcastMessage("O evento Zombie não pode iniciar devido a pouca quantidade de jogadores participantes.\n Pelo menos " .. config.playersNeededToStartEvent .. " players é necessário!", MESSAGE_STATUS_WARNING)
		for x = fromp.x, top.x do
			for y = fromp.y, top.y do
				for z = fromp.z, top.z do
					areapos = {x = x, y = y, z = z, stackpos = 253}
					getPlayers = getThingfromPos(areapos)
					if isPlayer(getPlayers.uid) then
						doTeleportThing(getPlayers.uid, getTownTemplePosition(getPlayerTown(getPlayers.uid)), false)
						doSendMagicEffect(getPlayerPosition(getPlayers.uid), CONST_ME_TELEPORT)
					end
				end
			end
		end
	end
end
function spawnZombie()
	if getGlobalStorageValue(config.playerCount) >= 2 then
		pos = {x = math.random(config.fromPosition.x, config.toPosition.x), y = math.random(config.fromPosition.y, config.toPosition.y), z = math.random(config.fromPosition.z, config.toPosition.z)}
		doSummonCreature(config.zombieName, pos)
		doSendMagicEffect(pos, CONST_ME_MORTAREA)
		setGlobalStorageValue(config.zombieCount, getGlobalStorageValue(config.zombieCount)+1)
		doBroadCastZombie(MESSAGE_STATUS_CONSOLE_RED, "A zombie has spawned! There is currently " .. getGlobalStorageValue(config.zombieCount) .. " zombies in the zombie event!")
		addEvent(spawnZombie, config.timeBetweenSpawns * 1000)
	end
end

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Postado
  • Autor
11 minutos atrás, Vodkart disse:

local config = {
	playerCount = 2001, -- Global storage for counting the players left/entered in the event
	zombieCount = 2002, -- Global storage for counting the zombies in the event
	teleportActionId = 2008, -- Action id of the teleport needed for the movement script
	teleportPosition = {x = 1004, y = 1003, z = 7, stackpos = 1}, -- Where the teleport will be created
	teleportToPosition = {x = 1096, y = 207, z = 7}, -- Where the teleport will take you
	teleportId = 1387, -- Id of the teleport
	timeToStartEvent = 1, -- Minutes, after these minutes the teleport will be removed and the event will be declared started
	timeBetweenSpawns = 1, -- Seconds between each spawn of zombie
	zombieName = "event zombie", -- Name of the zombie that should be summoned
	playersNeededToStartEvent = 2, -- Players needed before the zombies can spawn.
	fromPosition = {x = 1081, y = 188, z = 7}, -- top left cornor of the playground
	toPosition = {x = 1111, y = 207, z = 7}, -- bottom right cornor of the playground
}
function onTime()
	local tp = doCreateTeleport(config.teleportId, config.teleportToPosition, config.teleportPosition)
	doItemSetAttribute(tp, "aid", config.teleportActionId)
	doBroadcastMessage("Zombie event sera iniciado em " .. config.timeToStartEvent .. " minutos! O teleport foi removido para o evento comecar!", MESSAGE_STATUS_WARNING)
	setGlobalStorageValue(config.playerCount, 0)
	setGlobalStorageValue(config.zombieCount, 0)
	addEvent(startEvent, config.timeToStartEvent * 1000 * 60)
	print(getGlobalStorageValue(2001))
end

function doBroadCastZombie(type, msg)
	for _, cid in pairs(getPlayersOnline()) do
		if isInRange(getCreaturePosition(cid), config.fromPosition, config.toPosition) then
			doPlayerSendTextMessage(cid, type, msg)
		end
	end
end

function startEvent()
	local get = getThingfromPos(config.teleportPosition)
	if get.itemid == config.teleportId then
		doRemoveItem(get.uid, 1)
	end
	
	local fromp, top = config.fromPosition, config.toPosition
	if getGlobalStorageValue(config.playerCount) >= config.playersNeededToStartEvent then
		addEvent(spawnZombie, config.timeBetweenSpawns * 1000)
		doBroadcastMessage("Boa sorte no evento todos os players que entraram no evento de zumbis! O teleport fechou!", MESSAGE_STATUS_WARNING)
		
		for x = fromp.x, top.x do
			for y = fromp.y, top.y do
				for z = fromp.z, top.z do
					areapos = {x = x, y = y, z = z, stackpos = 253}
					getPlayers = getThingfromPos(areapos)
					if isPlayer(getPlayers.uid) then
						doPlayerSendTextMessage(getPlayers.uid, MESSAGE_EVENT_ADVANCE, "Primeiro zumbi irá nascer em " .. config.timeBetweenSpawns .. " segundos! Boa sorte!")
					end
				end
			end
		end
	else
		doBroadcastMessage("O evento Zombie não pode iniciar devido a pouca quantidade de jogadores participantes.\n Pelo menos " .. config.playersNeededToStartEvent .. " players é necessário!", MESSAGE_STATUS_WARNING)
		for x = fromp.x, top.x do
			for y = fromp.y, top.y do
				for z = fromp.z, top.z do
					areapos = {x = x, y = y, z = z, stackpos = 253}
					getPlayers = getThingfromPos(areapos)
					if isPlayer(getPlayers.uid) then
						doTeleportThing(getPlayers.uid, getTownTemplePosition(getPlayerTown(getPlayers.uid)), false)
						doSendMagicEffect(getPlayerPosition(getPlayers.uid), CONST_ME_TELEPORT)
					end
				end
			end
		end
	end
end
function spawnZombie()
	if getGlobalStorageValue(config.playerCount) >= 2 then
		pos = {x = math.random(config.fromPosition.x, config.toPosition.x), y = math.random(config.fromPosition.y, config.toPosition.y), z = math.random(config.fromPosition.z, config.toPosition.z)}
		doSummonCreature(config.zombieName, pos)
		doSendMagicEffect(pos, CONST_ME_MORTAREA)
		setGlobalStorageValue(config.zombieCount, getGlobalStorageValue(config.zombieCount)+1)
		doBroadCastZombie(MESSAGE_STATUS_CONSOLE_RED, "A zombie has spawned! There is currently " .. getGlobalStorageValue(config.zombieCount) .. " zombies in the zombie event!")
		addEvent(spawnZombie, config.timeBetweenSpawns * 1000)
	end
end

 

Funcionou 100%, mas porem vc poderia mudar uma outra coisa pra mim ?

 

 

local config = {
    playerCount = 2001, -- Global storage for counting the players left/entered in the event
    
    goblet = 5805, -- id of the gold goblet you'll get when finishing the event.
    rewards = {2493, 6132, 2160}, -- You will get this +  a gold goblet with your name on.
    --        {moneyId, count, using? 1 for using moneyReward, 0 for not using.}
    moneyReward = {2160, 20, 1}, -- second collumn(count) 0 if you don't want money to be used. or a stackable item you want more than 1 of.
    
    -- Should be same as in the globalevent!
    -- The zombies will spawn randomly inside this area
    fromPosition = {x = 1075, y = 186, z = 7}, -- top left cornor of the playground
    toPosition = {x = 1112, y = 211, z = 7}, -- bottom right cornor of the playground
    }

function onStatsChange(cid, attacker, type, combat, value)
    if isPlayer(cid) and isMonster(attacker) then
        if isInArea(getPlayerPosition(cid), config.fromPosition, config.toPosition) then
            if getGlobalStorageValue(config.playerCount) >= 2 then
                doBroadcastMessage(getPlayerName(cid) .. " have been eated by Zombies!", MESSAGE_STATUS_CONSOLE_RED)
                local corpse = doCreateItem(3058, 1, getPlayerPosition(cid))
                doItemSetAttribute(corpse, "description", "You recognize " .. getCreatureName(cid) .. ". Ele foi morto por "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".")
                doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
                doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
                doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
                setGlobalStorageValue(config.playerCount, getGlobalStorageValue(config.playerCount)-1)
            elseif getGlobalStorageValue(config.playerCount) == 1 then
                if isInArea(getPlayerPosition(cid), config.fromPosition, config.toPosition) then
                    doBroadcastMessage(getPlayerName(cid) .. " venceu o evento Zombie! Parabéns!", MESSAGE_STATUS_WARNING)
                    local goblet = doPlayerAddItem(cid, config.goblet, 1)
                    doItemSetAttribute(goblet, "description", "O player " .. getPlayerName(cid) .. " ganhou o evento zombie event.")
                    local corpse = doCreateItem(3058, 1, getPlayerPosition(cid))
                    doItemSetAttribute(corpse, "description", "você reconhece " .. getCreatureName(cid) .. ". Ele foi morto por "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".")
                    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
                    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
                    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
                    for _,items in ipairs(config.rewards) do
                        doPlayerAddItem(cid, items, 1)
                    end
                    if config.moneyReward[3] == 1 then
                        doPlayerAddItem(cid, config.moneyReward[1], config.moneyReward[2])
                    end
                end
                        
                for x = config.fromPosition.x, config.toPosition.x do
                    for y = config.fromPosition.y, config.toPosition.y do
                        for z = config.fromPosition.z, config.toPosition.z do
                            areapos = {x = x, y = y, z = z, stackpos = 253}
                            getMonsters = getThingfromPos(areapos)
                            if isMonster(getMonsters.uid) then
                                doRemoveCreature(getMonsters.uid)
                            end
                        end
                    end
                end
            end
            return false
        end
    end
return true
end

 

 

nesse script mudar o \/ na foto abaixo quero que só quem está dentro do evento veja quem morreu , agora o ganhador o servidor todo pode ver.

 

Vou agradece muito cara.

Sem título.png

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 520k

Informação Importante

Confirmação de Termo