Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Galera tenho um evento de paintball mas nao consigio colocalo para iniciar sozinho tipo global events pq ele fica na pasta mods
queria um script que em tal hora ou em tal horas do dia tipo 12:00, 00:00 ele inicia-se sozinho nele tenho q dar o comando !pb start com o gm pra poder iniciar se alguem souber como faz da um alo ai.

 

<?xml version="1.0" encoding="UTF-8"?>
	<mod name="Paintball event" version="1.0" author="Bogart" contact="otland.net" enabled="yes">
		<description>
			
		</description>
		<config name="config"><![CDATA[
		t = {
			main = {
				tfs_version = "0.3", --0.3 or 0.4
				positions = {
					paintball_spawn_area = {
						top_left = {x = 1215, y = 1004, z = 7}, --Top left pos of spawning area
						bottom_right = {x = 1231, y = 1020, z = 7}--bottom right pos of spawning area
					},
					waiting_room_area = {
						top_left = {x = 1222, y = 1009, z = 6}, --Top left pos of the waiting room
						bottom_right = {x = 1229, y = 1016, z = 6}--bottom right pos of the waiting room
					},
					tp_to_paintball = {x = 973, y = 930, z = 7}, --pos where the tp will be created
					event_ending_pos = {x = 973, y = 932, z = 6} --pos players will be sent after event ending
				},
				storages = {
					exhaust = 2455,
					is_in_event = 2460,
					score = 2465
				},
				misc = {
					status = 'on'
				},
				messages = {
					event_started = "Paintball foi iniciado! va para o templo e entre no portal para participar!",--Message that will be broadcasted after the event has started
					event_ended = "Paintball acabou!" --same but when event ends
				},
				event_config = {
					event_duration = 1, --minutes, 0 if it's an always-open event
					infinite_ammo = true,
					winner_gets_item = true,
					prize_item_id = 7732,
					decrease_score_on_death = true,
					points_per_kill = 1,
					randomize_player_start_pos = true,
					ammo_per_point = 100,
					reset_bullets_on_death = true,
					min_bullets_on_spawn = 100,
					start_automatically = false,
					use_waiting_room = true,
					waiting_time = 1 --minutes
				}
			},
			onShoot = {
				storages = {
					ammo = 2400
				},
				misc = {
					walls_id = {9371,9372,9377,9399,9373,9370,9376,9370},
					bullets_exhaust = 500, --in ms
					bullet_speed = 150
				},
				vars = {
					shootdir = 0
				}
			}
		}
		]]></config>
		<movevent type="StepIn" actionid ="2880" event="script"><![CDATA[
		domodlib('config')
		function onStepIn(cid, item, pos)
			local t_l = t.main.positions.paintball_spawn_area.top_left
			local b_r = t.main.positions.paintball_spawn_area.bottom_right
			doTeleportThing(cid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)})
			doPlayerSetStorageValue(cid, t.main.storages.is_in_event,1)
			doPlayerSetStorageValue(cid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn)
			doPlayerSetStorageValue(cid, t.main.storages.score, 0)
			doPlayerSendTextMessage(cid,27,"Bem Vindo ao evento Paintball, -> Comandos:\n!pb tiro -> Comando para atirar.\n!pb placar -> Mostra o Placar atual dos jogadores.")
		end
		]]></movevent>
		<globalevent name="StartPaintBall" interval="3600" event="script"><![CDATA[
		domodlib('config')
		function onThink(interval, lastExecution, thinkInterval)
			if t.main.event_config.start_automatically then
				doBroadcastMessage(t.main.messages.event_started, MESSAGE_STATUS_WARNING)
				if t.main.event_config.use_waiting_room then
					addEvent(moveToEvent, t.main.event_config.waiting_time*1000*60) 
					doCreateTeleport(1387,t.main.positions.waiting_room_area.top_left, t.main.positions.tp_to_paintball)
				else
					if t.main.tfs_version == "0.3" then 
						doItemSetAttribute(doCreateItem(1387, t.main.positions.tp_to_paintball), "aid", 2880)
					else
						doSetItemActionId(doCreateItem(1387, t.main.positions.tp_to_paintball),2880)
					end
					if(t.main.event_config.event_duration > 0) then
						addEvent(endPaintball, t.main.event_config.event_duration*1000*60)
					end
				end
			end
		return true
		end
		
		function endPaintball()
			local score = {}
			if not t.main.event_config.use_waiting_room then 
				doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
			end
			for _, pid in ipairs(getPlayersOnline()) do
				if getPlayerStorageValue(pid, t.main.storages.is_in_event) > 0 then
					table.insert(score, {getCreatureName(pid), getPlayerStorageValue(pid, t.main.storages.score)})
					doPlayerSetStorageValue(pid, t.main.storages.is_in_event, 0)
					doPlayerSetStorageValue(pid, t.main.storages.score, 0)
					doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, 0)
					doTeleportThing(pid, t.main.positions.event_ending_pos)
				end
			end
			table.sort(score, function(a, b) return a[2] > b[2] end)
			if table.getn(score) > 0 then
				if t.main.event_config.winner_gets_item then
					for _, pid in ipairs(getPlayersOnline()) do
						if getCreatureName(pid) == score[1][1] then
							doPlayerAddItem(pid, t.main.event_config.prize_item_id)
							break
						end
					end
				end
				doBroadcastMessage("Evento Paintball acabou, "..score[1][1].." ganhou o evento com "..score[1][2].." pontos", MESSAGE_STATUS_WARNING)
			end
		end
		local t_l = t.main.positions.paintball_spawn_area.top_left
		local b_r = t.main.positions.paintball_spawn_area.bottom_right
		function moveToEvent()
			for _, pid in ipairs(getPlayersOnline()) do 
				if isInRange(getCreaturePosition(pid), t.main.positions.waiting_room_area.top_left, t.main.positions.waiting_room_area.bottom_right) then
					doTeleportThing(pid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)})
					doPlayerSetStorageValue(pid, t.main.storages.is_in_event,1)
					doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn)
					doPlayerSetStorageValue(pid, t.main.storages.score, 0)
					doPlayerSendTextMessage(pid,27,"Bem Vindo ao evento Paintball, -> Comandos:\n!pb tiro -> Comando para atirar.\n!pb placar -> Mostra o Placar atual dos jogadores.")
				end
			end
			doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
			addEvent(endPaintball, t.main.event_config.event_duration*1000*60)
		end
		]]></globalevent> 
		<talkaction words="!pb" event="script"><![CDATA[
		domodlib('config')
		function onSay(cid, words, param, channel)
			local k = string.explode(param, ",")
			if(k[1] ~= nil) then 
				if(string.upper(k[1]) == 'END') and getPlayerGroupId(cid) >= 3 then
					endPaintball()
				end
				if(string.upper(k[1]) == 'START') and getPlayerGroupId(cid) >= 3 then
					doBroadcastMessage(t.main.messages.event_started, MESSAGE_STATUS_WARNING)
					if t.main.event_config.use_waiting_room then
						addEvent(moveToEvent, t.main.event_config.waiting_time*1000*60) 
						doCreateTeleport(1387,t.main.positions.waiting_room_area.top_left, t.main.positions.tp_to_paintball)
					else
						if t.main.tfs_version == "0.3" then 
							doItemSetAttribute(doCreateItem(1387, t.main.positions.tp_to_paintball), "aid", 2880)
						else
							doSetItemActionId(doCreateItem(1387, t.main.positions.tp_to_paintball),2880)
						end
						if(t.main.event_config.event_duration > 0) then
							addEvent(endPaintball, t.main.event_config.event_duration*1000*60)
						end
					end
				end
				if(string.upper(k[1]) == 'PLACAR') then
				local score = {}
				local output =  "Voce Tem " .. getPlayerStorageValue(cid, t.main.storages.score) .. " pontos.\nVoce tem "..getPlayerStorageValue(cid, t.onShoot.storages.ammo).." munição.\n------------------\nAtual pontuaçao do evento Paintball é:\n"
					for _, pid in ipairs(getPlayersOnline()) do
						if getPlayerStorageValue(pid, t.main.storages.is_in_event) then
							table.insert(score, {getCreatureName(pid), getPlayerStorageValue(pid, t.main.storages.score)})
						end
					end
				local lx = table.getn(score)
				if(lx > 3) then lx = 3 end 
					table.sort(score, function(a, b) return a[2] > b[2] end)
					for k = 1,lx do
						output = output .. k..". "..score[k][1] .." [".. score[k][2] .."].\n"
					end
				doPlayerPopupFYI(cid, output) 
				end
				if (string.upper(k[1]) == 'MUNIÇÂO') then
					if(t.main.event_config.infinite_ammo) then 
						doPlayerSendTextMessage(cid, 27, "Munições infinitas.")
					else
						if getPlayerStorageValue(cid, t.main.storages.score) > 0 then
							doPlayerSetStorageValue(cid, t.main.storages.score, getPlayerStorageValue(cid, t.main.storages.score)-1)
							doPlayerSetStorageValue(cid, t.onShoot.storages.ammo, getPlayerStorageValue(cid,t.onShoot.storages.ammo)+t.main.event_config.ammo_per_point)
							doPlayerSendTextMessage(cid, 27, "You have received " .. t.main.event_config.ammo_per_point .. " bullets and you have lost 1 score point.")
							doSendMagicEffect(getCreaturePosition(cid),4)
						else
							doPlayerSendTextMessage(cid, 27, "Você não tem pontos suficientes para comprar munição, você precisa ".. 1-(getPlayerStorageValue(cid, t.main.storages.score)).. " mais.")			
						end
					end
				end
				if (string.upper(k[1]) == 'TIRO') then
					if(getPlayerStorageValue(cid, t.main.storages.is_in_event) == 1) then
						if getPlayerStorageValue(cid, t.main.storages.exhaust) <= 1 then
							if(getPlayerStorageValue(cid, t.onShoot.storages.ammo) > 0) then
								if t.main.misc.status == 'on' then
									if(t.main.event_config.infinite_ammo == false) then
										doPlayerSetStorageValue(cid, t.onShoot.storages.ammo, getPlayerStorageValue(cid, t.onShoot.storages.ammo)-1)
									end
									doPlayerSetStorageValue(cid, t.main.storages.exhaust, 2)
									lineAnimation(getPlayerLookDirection(cid),getCreaturePosition(cid),12,cid,1,0,1,0,0,0,1,0)
									addEvent(doPlayerSetStorageValue,t.onShoot.misc.bullets_exhaust, cid, t.main.storages.exhaust,1)
								end
							else
								doPlayerSendCancel(cid, "Você está fora de munição, troca de munição por pontos com munição tiro ou ser morto por uma recarga")
								doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)	
							end
						else
							doPlayerSendCancel(cid, "A arma está em recarga")
							doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
						end
					else
						doPlayerSendCancel(cid, "Você precisa estar no evento.")
						doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
					end
				end
			end
		return true
		end


		function lineAnimation(lookDir,playerPos,effect,cid,fvar,fpos,ffound,fposV,fcheck,fvcid,floopCounter,fvpid, name)
		local var = fvar
		local pos = fpos
		local found = ffound
		local posV = fposV
		local check = fcheck
		local vcid = fvcid
		local loopCounter = floopCounter
		local vpid = fvpid
		local storage = t.main.storages.exhaust
			if var < 2 then
				vcid = cid
			end
			pos = playerPos
			if not isInWallArray(convert(lookDir,pos)) then--isInWallArray({x=convert(lookDir,pos).x, y=convert(lookDir,pos).y,z=convert(lookDir,pos).z}) then --isInArray(t.onShoot.misc.walls_id, getThingfromPos({x=convert(lookDir,pos).x, y=convert(lookDir,pos).y,z=convert(lookDir,pos).z, stackpos=0}).itemid) then
				doSendDistanceShoot(pos, convert(lookDir,pos),effect)
				pos = convert(lookDir,pos)
				var=var+1
				posV = convertV(lookDir,playerPos)
				for _, pid in ipairs(getPlayersOnline()) do
					if (getCreaturePosition(pid).x == pos.x and getCreaturePosition(pid).y == pos.y and getCreaturePosition(pid).z == pos.z) then
						--if loopCounter > 2 then
						vpid = pid
						--end
						if (vpid ~= vcid) then
							if var > 2 then
								if (getCreaturePosition(pid).x == posV.x and getCreaturePosition(pid).y == posV.y and getCreaturePosition(pid).z == posV.z) then
									killPlayer(pid,pos,getCreatureName(vcid))
									if (lookDir == 0) or (lookDir == 2) then 
										var = 6
									else
										var = 8
									end
								end
							end
							killPlayer(pid,pos,vcid)
							if (lookDir == 0) or (lookDir == 2) then
								var = 6
							else
								var = 8
							end
						end
					end
					loopCounter = loopCounter +1
				end	
				if (lookDir == 0) or (lookDir == 2) then
					if var ~= 6 then
						addEvent(lineAnimation, t.onShoot.misc.bullet_speed, lookDir,pos,effect,nil,var,pos,found,posV,check,vcid,loopCounter,vpid)
					else
						var = 1
					end
				else
					if var ~= 8 then
						addEvent(lineAnimation,  t.onShoot.misc.bullet_speed, lookDir,pos,effect,nil,var,pos,found,posV,check,vcid,loopCounter,vpid)
					else
						var = 1
					end
				end
			else
				doSendMagicEffect(convert(lookDir,pos),2)
				var = 1
			end
		end

		local ret = {}
		function convert(lookDir,pos)
		local positions = {
			[0] = {x = pos.x, y = pos.y-1, z = pos.z},
			[1] = {x = pos.x+1, y = pos.y, z = pos.z},
			[2] = {x = pos.x, y = pos.y+1, z = pos.z},
			[3] = {x = pos.x-1, y = pos.y, z = pos.z}
			}
			ret = positions[lookDir]
		return ret
		end


		local ret = {}
		function convertV(lookDir,pos)
		local positions = {
			[0] = {x = pos.x, y = pos.y+1, z = pos.z},
			[1] = {x = pos.x-1, y = pos.y, z = pos.z},
			[2] = {x = pos.x, y = pos.y-1, z = pos.z},
			[3] = {x = pos.x+1, y = pos.y, z = pos.z}
			}
			ret = positions[lookDir]
		return ret
		end
				
		function killPlayer(cid,pos, killer)
			local t_l = t.main.positions.paintball_spawn_area.top_left
			local b_r = t.main.positions.paintball_spawn_area.bottom_right
			doTeleportThing(cid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)})
			doSendMagicEffect(pos,2)
			doPlayerSendTextMessage(cid, 27, "Voce foi morto por "..getCreatureName(killer)..".")
			doPlayerSetStorageValue(killer, t.main.storages.score, getPlayerStorageValue(killer, t.main.storages.score)+t.main.event_config.points_per_kill)
			doPlayerSendTextMessage(killer, 27, "Você matou "..getCreatureName(cid)..".")
			doBroadcastMessage("[Event] Paintball: "..getCreatureName(killer).." matou "..getCreatureName(cid)..".", MESSAGE_STATUS_WARNING)
			if t.main.event_config.decrease_score_on_death then
				doPlayerSetStorageValue(cid, t.main.storages.score, getPlayerStorageValue(cid, t.main.storages.score)-1)
			end
			if t.main.event_config.reset_bullets_on_death then
				doPlayerSetStorageValue(cid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn)
			end
		end
						
		function isInWallArray(pos)
			for k = 0, table.getn(t.onShoot.misc.walls_id) do
				if getTileItemById(pos, t.onShoot.misc.walls_id[k]).itemid == t.onShoot.misc.walls_id[k] then --this doesn't even make sense but tried other ways and it gave errors, so meh 2lazy2search 
					return true	
				end
			end
			return false
		end
		function endPaintball()
			local score = {}
			if not t.main.event_config.use_waiting_room then 
				doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
			end
			for _, pid in ipairs(getPlayersOnline()) do
				if getPlayerStorageValue(pid, t.main.storages.is_in_event) > 0 then
					table.insert(score, {getCreatureName(pid), getPlayerStorageValue(pid, t.main.storages.score)})
					doPlayerSetStorageValue(pid, t.main.storages.is_in_event, 0)
					doPlayerSetStorageValue(pid, t.main.storages.score, 0)
					doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, 0)
					doTeleportThing(pid, t.main.positions.event_ending_pos)
				end
			end
			table.sort(score, function(a, b) return a[2] > b[2] end)
			if table.getn(score) > 0 then
				if t.main.event_config.winner_gets_item then
					for _, pid in ipairs(getPlayersOnline()) do
						if getCreatureName(pid) == score[1][1] then
							doPlayerAddItem(pid, t.main.event_config.prize_item_id)
							break
						end
					end
				end
			doBroadcastMessage("Evento Painball acabou, "..score[1][1].." ganhou o evento com "..score[1][2].." pontos", MESSAGE_STATUS_WARNING)
			end
		end
		local t_l = t.main.positions.paintball_spawn_area.top_left
		local b_r = t.main.positions.paintball_spawn_area.bottom_right
		function moveToEvent()
			for _, pid in ipairs(getPlayersOnline()) do 
				if isInRange(getCreaturePosition(pid), t.main.positions.waiting_room_area.top_left, t.main.positions.waiting_room_area.bottom_right) then
					doTeleportThing(pid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)})
					doPlayerSetStorageValue(pid, t.main.storages.is_in_event,1)
					doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn)
					doPlayerSetStorageValue(pid, t.main.storages.score, 0)
					doPlayerSendTextMessage(pid,27,"Bem Vindo ao evento Paintball, -> Comandos:\n!pb tiro -> Comando para atirar.\n!pb placar -> Mostra o Placar atual dos jogadores.")
				end
			end
			doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
			addEvent(endPaintball, t.main.event_config.event_duration*1000*60)
		end
		]]></talkaction>
	</mod>

 

Link para o post
Compartilhar em outros sites

no proprio mod ja tem o globalevent é so da uma olhada....

troquei de onThink para onTime ou seja vai executar em determinado horario... caso queira mudar so procura o globalevent do mod ali...

coloquei 00:00

 

Spoiler

<?xml version="1.0" encoding="UTF-8"?>
	<mod name="Paintball event" version="1.0" author="Bogart" contact="otland.net" enabled="yes">
		<description>
			
		</description>
		<config name="config"><![CDATA[
		t = {
			main = {
				tfs_version = "0.3", --0.3 or 0.4
				positions = {
					paintball_spawn_area = {
						top_left = {x = 1215, y = 1004, z = 7}, --Top left pos of spawning area
						bottom_right = {x = 1231, y = 1020, z = 7}--bottom right pos of spawning area
					},
					waiting_room_area = {
						top_left = {x = 1222, y = 1009, z = 6}, --Top left pos of the waiting room
						bottom_right = {x = 1229, y = 1016, z = 6}--bottom right pos of the waiting room
					},
					tp_to_paintball = {x = 973, y = 930, z = 7}, --pos where the tp will be created
					event_ending_pos = {x = 973, y = 932, z = 6} --pos players will be sent after event ending
				},
				storages = {
					exhaust = 2455,
					is_in_event = 2460,
					score = 2465
				},
				misc = {
					status = 'on'
				},
				messages = {
					event_started = "Paintball foi iniciado! va para o templo e entre no portal para participar!",--Message that will be broadcasted after the event has started
					event_ended = "Paintball acabou!" --same but when event ends
				},
				event_config = {
					event_duration = 1, --minutes, 0 if it's an always-open event
					infinite_ammo = true,
					winner_gets_item = true,
					prize_item_id = 7732,
					decrease_score_on_death = true,
					points_per_kill = 1,
					randomize_player_start_pos = true,
					ammo_per_point = 100,
					reset_bullets_on_death = true,
					min_bullets_on_spawn = 100,
					start_automatically = false,
					use_waiting_room = true,
					waiting_time = 1 --minutes
				}
			},
			onShoot = {
				storages = {
					ammo = 2400
				},
				misc = {
					walls_id = {9371,9372,9377,9399,9373,9370,9376,9370},
					bullets_exhaust = 500, --in ms
					bullet_speed = 150
				},
				vars = {
					shootdir = 0
				}
			}
		}
		]]></config>
		<movevent type="StepIn" actionid ="2880" event="script"><![CDATA[
		domodlib('config')
		function onStepIn(cid, item, pos)
			local t_l = t.main.positions.paintball_spawn_area.top_left
			local b_r = t.main.positions.paintball_spawn_area.bottom_right
			doTeleportThing(cid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)})
			doPlayerSetStorageValue(cid, t.main.storages.is_in_event,1)
			doPlayerSetStorageValue(cid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn)
			doPlayerSetStorageValue(cid, t.main.storages.score, 0)
			doPlayerSendTextMessage(cid,27,"Bem Vindo ao evento Paintball, -> Comandos:\n!pb tiro -> Comando para atirar.\n!pb placar -> Mostra o Placar atual dos jogadores.")
		end
		]]></movevent>
		<globalevent name="StartPaintBall" time="00:00" event="script"><![CDATA[
		domodlib('config')
		function onTime(interval, lastExecution, thinkInterval)
			if t.main.event_config.start_automatically then
				doBroadcastMessage(t.main.messages.event_started, MESSAGE_STATUS_WARNING)
				if t.main.event_config.use_waiting_room then
					addEvent(moveToEvent, t.main.event_config.waiting_time*1000*60) 
					doCreateTeleport(1387,t.main.positions.waiting_room_area.top_left, t.main.positions.tp_to_paintball)
				else
					if t.main.tfs_version == "0.3" then 
						doItemSetAttribute(doCreateItem(1387, t.main.positions.tp_to_paintball), "aid", 2880)
					else
						doSetItemActionId(doCreateItem(1387, t.main.positions.tp_to_paintball),2880)
					end
					if(t.main.event_config.event_duration > 0) then
						addEvent(endPaintball, t.main.event_config.event_duration*1000*60)
					end
				end
			end
		return true
		end
		
		function endPaintball()
			local score = {}
			if not t.main.event_config.use_waiting_room then 
				doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
			end
			for _, pid in ipairs(getPlayersOnline()) do
				if getPlayerStorageValue(pid, t.main.storages.is_in_event) > 0 then
					table.insert(score, {getCreatureName(pid), getPlayerStorageValue(pid, t.main.storages.score)})
					doPlayerSetStorageValue(pid, t.main.storages.is_in_event, 0)
					doPlayerSetStorageValue(pid, t.main.storages.score, 0)
					doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, 0)
					doTeleportThing(pid, t.main.positions.event_ending_pos)
				end
			end
			table.sort(score, function(a, b) return a[2] > b[2] end)
			if table.getn(score) > 0 then
				if t.main.event_config.winner_gets_item then
					for _, pid in ipairs(getPlayersOnline()) do
						if getCreatureName(pid) == score[1][1] then
							doPlayerAddItem(pid, t.main.event_config.prize_item_id)
							break
						end
					end
				end
				doBroadcastMessage("Evento Paintball acabou, "..score[1][1].." ganhou o evento com "..score[1][2].." pontos", MESSAGE_STATUS_WARNING)
			end
		end
		local t_l = t.main.positions.paintball_spawn_area.top_left
		local b_r = t.main.positions.paintball_spawn_area.bottom_right
		function moveToEvent()
			for _, pid in ipairs(getPlayersOnline()) do 
				if isInRange(getCreaturePosition(pid), t.main.positions.waiting_room_area.top_left, t.main.positions.waiting_room_area.bottom_right) then
					doTeleportThing(pid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)})
					doPlayerSetStorageValue(pid, t.main.storages.is_in_event,1)
					doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn)
					doPlayerSetStorageValue(pid, t.main.storages.score, 0)
					doPlayerSendTextMessage(pid,27,"Bem Vindo ao evento Paintball, -> Comandos:\n!pb tiro -> Comando para atirar.\n!pb placar -> Mostra o Placar atual dos jogadores.")
				end
			end
			doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
			addEvent(endPaintball, t.main.event_config.event_duration*1000*60)
		end
		]]></globalevent> 
		<talkaction words="!pb" event="script"><![CDATA[
		domodlib('config')
		function onSay(cid, words, param, channel)
			local k = string.explode(param, ",")
			if(k[1] ~= nil) then 
				if(string.upper(k[1]) == 'END') and getPlayerGroupId(cid) >= 3 then
					endPaintball()
				end
				if(string.upper(k[1]) == 'START') and getPlayerGroupId(cid) >= 3 then
					doBroadcastMessage(t.main.messages.event_started, MESSAGE_STATUS_WARNING)
					if t.main.event_config.use_waiting_room then
						addEvent(moveToEvent, t.main.event_config.waiting_time*1000*60) 
						doCreateTeleport(1387,t.main.positions.waiting_room_area.top_left, t.main.positions.tp_to_paintball)
					else
						if t.main.tfs_version == "0.3" then 
							doItemSetAttribute(doCreateItem(1387, t.main.positions.tp_to_paintball), "aid", 2880)
						else
							doSetItemActionId(doCreateItem(1387, t.main.positions.tp_to_paintball),2880)
						end
						if(t.main.event_config.event_duration > 0) then
							addEvent(endPaintball, t.main.event_config.event_duration*1000*60)
						end
					end
				end
				if(string.upper(k[1]) == 'PLACAR') then
				local score = {}
				local output =  "Voce Tem " .. getPlayerStorageValue(cid, t.main.storages.score) .. " pontos.\nVoce tem "..getPlayerStorageValue(cid, t.onShoot.storages.ammo).." munição.\n------------------\nAtual pontuaçao do evento Paintball é:\n"
					for _, pid in ipairs(getPlayersOnline()) do
						if getPlayerStorageValue(pid, t.main.storages.is_in_event) then
							table.insert(score, {getCreatureName(pid), getPlayerStorageValue(pid, t.main.storages.score)})
						end
					end
				local lx = table.getn(score)
				if(lx > 3) then lx = 3 end 
					table.sort(score, function(a, b) return a[2] > b[2] end)
					for k = 1,lx do
						output = output .. k..". "..score[k][1] .." [".. score[k][2] .."].\n"
					end
				doPlayerPopupFYI(cid, output) 
				end
				if (string.upper(k[1]) == 'MUNIÇÂO') then
					if(t.main.event_config.infinite_ammo) then 
						doPlayerSendTextMessage(cid, 27, "Munições infinitas.")
					else
						if getPlayerStorageValue(cid, t.main.storages.score) > 0 then
							doPlayerSetStorageValue(cid, t.main.storages.score, getPlayerStorageValue(cid, t.main.storages.score)-1)
							doPlayerSetStorageValue(cid, t.onShoot.storages.ammo, getPlayerStorageValue(cid,t.onShoot.storages.ammo)+t.main.event_config.ammo_per_point)
							doPlayerSendTextMessage(cid, 27, "You have received " .. t.main.event_config.ammo_per_point .. " bullets and you have lost 1 score point.")
							doSendMagicEffect(getCreaturePosition(cid),4)
						else
							doPlayerSendTextMessage(cid, 27, "Você não tem pontos suficientes para comprar munição, você precisa ".. 1-(getPlayerStorageValue(cid, t.main.storages.score)).. " mais.")			
						end
					end
				end
				if (string.upper(k[1]) == 'TIRO') then
					if(getPlayerStorageValue(cid, t.main.storages.is_in_event) == 1) then
						if getPlayerStorageValue(cid, t.main.storages.exhaust) <= 1 then
							if(getPlayerStorageValue(cid, t.onShoot.storages.ammo) > 0) then
								if t.main.misc.status == 'on' then
									if(t.main.event_config.infinite_ammo == false) then
										doPlayerSetStorageValue(cid, t.onShoot.storages.ammo, getPlayerStorageValue(cid, t.onShoot.storages.ammo)-1)
									end
									doPlayerSetStorageValue(cid, t.main.storages.exhaust, 2)
									lineAnimation(getPlayerLookDirection(cid),getCreaturePosition(cid),12,cid,1,0,1,0,0,0,1,0)
									addEvent(doPlayerSetStorageValue,t.onShoot.misc.bullets_exhaust, cid, t.main.storages.exhaust,1)
								end
							else
								doPlayerSendCancel(cid, "Você está fora de munição, troca de munição por pontos com munição tiro ou ser morto por uma recarga")
								doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)	
							end
						else
							doPlayerSendCancel(cid, "A arma está em recarga")
							doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
						end
					else
						doPlayerSendCancel(cid, "Você precisa estar no evento.")
						doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
					end
				end
			end
		return true
		end


		function lineAnimation(lookDir,playerPos,effect,cid,fvar,fpos,ffound,fposV,fcheck,fvcid,floopCounter,fvpid, name)
		local var = fvar
		local pos = fpos
		local found = ffound
		local posV = fposV
		local check = fcheck
		local vcid = fvcid
		local loopCounter = floopCounter
		local vpid = fvpid
		local storage = t.main.storages.exhaust
			if var < 2 then
				vcid = cid
			end
			pos = playerPos
			if not isInWallArray(convert(lookDir,pos)) then--isInWallArray({x=convert(lookDir,pos).x, y=convert(lookDir,pos).y,z=convert(lookDir,pos).z}) then --isInArray(t.onShoot.misc.walls_id, getThingfromPos({x=convert(lookDir,pos).x, y=convert(lookDir,pos).y,z=convert(lookDir,pos).z, stackpos=0}).itemid) then
				doSendDistanceShoot(pos, convert(lookDir,pos),effect)
				pos = convert(lookDir,pos)
				var=var+1
				posV = convertV(lookDir,playerPos)
				for _, pid in ipairs(getPlayersOnline()) do
					if (getCreaturePosition(pid).x == pos.x and getCreaturePosition(pid).y == pos.y and getCreaturePosition(pid).z == pos.z) then
						--if loopCounter > 2 then
						vpid = pid
						--end
						if (vpid ~= vcid) then
							if var > 2 then
								if (getCreaturePosition(pid).x == posV.x and getCreaturePosition(pid).y == posV.y and getCreaturePosition(pid).z == posV.z) then
									killPlayer(pid,pos,getCreatureName(vcid))
									if (lookDir == 0) or (lookDir == 2) then 
										var = 6
									else
										var = 8
									end
								end
							end
							killPlayer(pid,pos,vcid)
							if (lookDir == 0) or (lookDir == 2) then
								var = 6
							else
								var = 8
							end
						end
					end
					loopCounter = loopCounter +1
				end	
				if (lookDir == 0) or (lookDir == 2) then
					if var ~= 6 then
						addEvent(lineAnimation, t.onShoot.misc.bullet_speed, lookDir,pos,effect,nil,var,pos,found,posV,check,vcid,loopCounter,vpid)
					else
						var = 1
					end
				else
					if var ~= 8 then
						addEvent(lineAnimation,  t.onShoot.misc.bullet_speed, lookDir,pos,effect,nil,var,pos,found,posV,check,vcid,loopCounter,vpid)
					else
						var = 1
					end
				end
			else
				doSendMagicEffect(convert(lookDir,pos),2)
				var = 1
			end
		end

		local ret = {}
		function convert(lookDir,pos)
		local positions = {
			[0] = {x = pos.x, y = pos.y-1, z = pos.z},
			[1] = {x = pos.x+1, y = pos.y, z = pos.z},
			[2] = {x = pos.x, y = pos.y+1, z = pos.z},
			[3] = {x = pos.x-1, y = pos.y, z = pos.z}
			}
			ret = positions[lookDir]
		return ret
		end


		local ret = {}
		function convertV(lookDir,pos)
		local positions = {
			[0] = {x = pos.x, y = pos.y+1, z = pos.z},
			[1] = {x = pos.x-1, y = pos.y, z = pos.z},
			[2] = {x = pos.x, y = pos.y-1, z = pos.z},
			[3] = {x = pos.x+1, y = pos.y, z = pos.z}
			}
			ret = positions[lookDir]
		return ret
		end
				
		function killPlayer(cid,pos, killer)
			local t_l = t.main.positions.paintball_spawn_area.top_left
			local b_r = t.main.positions.paintball_spawn_area.bottom_right
			doTeleportThing(cid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)})
			doSendMagicEffect(pos,2)
			doPlayerSendTextMessage(cid, 27, "Voce foi morto por "..getCreatureName(killer)..".")
			doPlayerSetStorageValue(killer, t.main.storages.score, getPlayerStorageValue(killer, t.main.storages.score)+t.main.event_config.points_per_kill)
			doPlayerSendTextMessage(killer, 27, "Você matou "..getCreatureName(cid)..".")
			doBroadcastMessage("[Event] Paintball: "..getCreatureName(killer).." matou "..getCreatureName(cid)..".", MESSAGE_STATUS_WARNING)
			if t.main.event_config.decrease_score_on_death then
				doPlayerSetStorageValue(cid, t.main.storages.score, getPlayerStorageValue(cid, t.main.storages.score)-1)
			end
			if t.main.event_config.reset_bullets_on_death then
				doPlayerSetStorageValue(cid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn)
			end
		end
						
		function isInWallArray(pos)
			for k = 0, table.getn(t.onShoot.misc.walls_id) do
				if getTileItemById(pos, t.onShoot.misc.walls_id[k]).itemid == t.onShoot.misc.walls_id[k] then --this doesn't even make sense but tried other ways and it gave errors, so meh 2lazy2search 
					return true	
				end
			end
			return false
		end
		function endPaintball()
			local score = {}
			if not t.main.event_config.use_waiting_room then 
				doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
			end
			for _, pid in ipairs(getPlayersOnline()) do
				if getPlayerStorageValue(pid, t.main.storages.is_in_event) > 0 then
					table.insert(score, {getCreatureName(pid), getPlayerStorageValue(pid, t.main.storages.score)})
					doPlayerSetStorageValue(pid, t.main.storages.is_in_event, 0)
					doPlayerSetStorageValue(pid, t.main.storages.score, 0)
					doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, 0)
					doTeleportThing(pid, t.main.positions.event_ending_pos)
				end
			end
			table.sort(score, function(a, b) return a[2] > b[2] end)
			if table.getn(score) > 0 then
				if t.main.event_config.winner_gets_item then
					for _, pid in ipairs(getPlayersOnline()) do
						if getCreatureName(pid) == score[1][1] then
							doPlayerAddItem(pid, t.main.event_config.prize_item_id)
							break
						end
					end
				end
			doBroadcastMessage("Evento Painball acabou, "..score[1][1].." ganhou o evento com "..score[1][2].." pontos", MESSAGE_STATUS_WARNING)
			end
		end
		local t_l = t.main.positions.paintball_spawn_area.top_left
		local b_r = t.main.positions.paintball_spawn_area.bottom_right
		function moveToEvent()
			for _, pid in ipairs(getPlayersOnline()) do 
				if isInRange(getCreaturePosition(pid), t.main.positions.waiting_room_area.top_left, t.main.positions.waiting_room_area.bottom_right) then
					doTeleportThing(pid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)})
					doPlayerSetStorageValue(pid, t.main.storages.is_in_event,1)
					doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn)
					doPlayerSetStorageValue(pid, t.main.storages.score, 0)
					doPlayerSendTextMessage(pid,27,"Bem Vindo ao evento Paintball, -> Comandos:\n!pb tiro -> Comando para atirar.\n!pb placar -> Mostra o Placar atual dos jogadores.")
				end
			end
			doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
			addEvent(endPaintball, t.main.event_config.event_duration*1000*60)
		end
		]]></talkaction>
	</mod>

 

 

 

Scriptszinhos:

 

Não abandone seu tópico, quando você tiver a dúvida resolvida sozinho tente ensinar aos outros como resolve-la (você pode não ser o único com o problema) e quando ela for resolvida por outra pessoa não se esqueça de marcar como melhor resposta e deixar o gostei.

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por Jaurez
      .
    • Por Cat
      Em alguns casos, o tibia 8.60 comum não abre de jeito nenhum no map editor, mesmo desmarcando check file signatures e configurando o path corretamente.
       
      Este é o client 8.60 adaptado para o Remere's Map Editor. Resolvi postar já que ele foi removido do site oficial do RME. (ficou apenas a versão para linux lá)
      Se estiver tendo problemas para abrir a versão 8.60, tente utilizar este.
                                                                                                                     
      Baixar o Tibia Client 8.60 que funciona no Remere’s Map Editor
      Essa versão do Tibia 8.60 client resolve o erro unsupported client version ou Could not locate tibia.dat and/or tibia.spr, please navigate to your tibia 8.60 installation folder.
       
      Downloads
      https://tibiaking.com/applications/core/interface/file/attachment.php?id=47333

      Scan: https://www.virustotal.com/gui/file/333e172ac49ba2028db9eb5889994509e7d2de28ebccfa428c04e86defbe15cc
       
    • Por danilo belato
      Fala Galera To Com um problema aki 
       
      quero exporta umas sprites de um server para colocar em outro 
       
      eu clico na sprites ai aparece tds a forma delas do lado de la >>
       
      ai eu clico nela e ponho a opiçao de export mais quando salvo a sprite ela n abri 
       
      aparece isso quando tento vê-la 
       
      visualização não disponível ( no formatos png e bitmap)
       
      Agora no formato idc fala que o paint n pode ler 
       
      me ajudem ae...
    • Por Vitor Bicaleto
      Galera to com o script do addon doll aqui, quando eu digito apenas "!addon" ele aparece assim: Digite novamente, algo está errado!"
      quando digito por exemplo: "!addon citizen" ele não funciona e não da nenhum erro
       
      mesma coisa acontece com o mount doll.. 
    • Por Ayron5
      Substitui uma stone no serve, deu tudo certo fora  esse  erro ajudem  Valendo  Rep+  Grato  

      Erro: data/actions/scripts/boost.lua:557: table index is nil
       [Warning - Event::loadScript] Cannot load script (data/actions/scripts/boost.lua)

      Script:
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo