Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Ola tenho um script que começa por tempo em interval queria modificar para ficar por time e dia escolhido!

 

<?xml version="1.0" encoding="utf-8"?>

<mod name="CTF" version="1.0" author="Doggynub" contact="otland.net" enabled="yes">

  <config name="toto"><![CDATA[


--[[ Storage Settings]]--



Owner = 1900 -- put empty storage


FLAG2_INn = 4000 -- put empty storage


FLAG_IN = 4001 -- put empty storage


TEAM1_FLAGS = 3030 -- put empty storage


TEAM2_FLAGS = 3031 -- put empty storage


Event_Start = 3032 -- put empty storage


Event_timeend = 3033 -- put empty storage


Event_Tile_Close = 3039 -- put empty storage


joined = 2023 --put empty storage


Timer = 1010 --put empty storage


--------------------------------------



--[[ Places setting ]]--



BLUE_FLAG = {x=3536,y=3537,z=7} -- Blue flag Place


RED_FLAG = {x=3536,y=3537,z=7} --red flag Place


Tp_Place = {x=1007,y=991,z=15} -- Place where the event teleport will be created.


Wait_Place = {x=3551,y=3554,z=7} -- Positions Players will  be sent when the enter event's teleport


frompos = {x=3553, y=3559, z=7} --start sqm in the waiting room(1 floor)


topos = {x=3556,y=3566,z=7} -- end sqm in the waiting room(1 floor)


Red_Position = {x=3615,y=3602,z=7} -- Red team temple pos


Blue_Position = {x=3546,y=3536,z=7} -- Blue team temple pos




---------------------------------------



--[[Event setting ]]--



Event_WaitTime = 5 -- time for the collection of player then event will start (in minutes)


Event_MaxTime = 10 --- in minutes ( this is the max time for an event to bb running )


Players_Speed = 20000 -- put the level of base speed in event ( like if you want the speed of lvl 300 then wright 300)


  Flag_Holder_Speed = 20000 -- [Old-Styled feature] speed for the player when he hold a flag better not to increase.


TEAM2_NAME = "Red" -- team 2 name


TEAM1_NAME = "Green" -- team 1 name


FLAG_SCORE = 5 -- score when team gets he wins


Teleport_On_Score = false -- this teleport all players to their team main position when some one score a flag , make false to disable.


Players_Least_Number = 2 -- this means if there is less than 2 players joined the event will be cancelled


Min_Join_Level = 100 -- min lvl for a player to join event


rewards_random = {

						[60] = { -- Rewards of 60% , if it is then it will randomly give one of the items in the items verible if there you put more than one item there

									items = {9971,9971,9971}

								},


						[30] = { -- Rewards of 30%

									items = {9971,9971,9971}

								},



						[10] = { -- Rewards of 10%

									items = {9971,9971,9971}

								}

					}



]]></config>

  <lib name="CTF-lib"><![CDATA[

function isTeamTwo(cid)

	return (isPlayer(cid) and getPlayerStorageValue(cid,5054) > -1)

end

function isTeamOne(cid)

	return (isPlayer(cid) and getPlayerStorageValue(cid,5055) > -1)

end

function resetTheTeams(cid)

	return (isPlayer(cid) and setPlayerStorageValue(cid,5054,-1) and setPlayerStorageValue(cid,5055,-1))

end

function setflagOwner(cid)

	return setPlayerStorageValue(cid,Owner,1)

end

function flagOwner(cid)

	return (isPlayer(cid) and getPlayerStorageValue(cid,Owner) > 0)

end

function releaseBF(cid)

	setGlobalStorageValue(FLAG_IN,-1)

	setPlayerStorageValue(cid,103, 0)

	setPlayerStorageValue(cid,Owner,-1)

return true

end

function releaseRF(cid)

	setGlobalStorageValue(FLAG2_INn,-1)

	setPlayerStorageValue(cid,103, 0)

	setPlayerStorageValue(cid,Owner,-1)

return true

end

function setFirstTeam(cid)

	return setPlayerStorageValue(cid,5055,1)

end

function setSecondTeam(cid)

	return setPlayerStorageValue(cid,5054,2)

end

function addToRed()

	return setGlobalStorageValue(TEAM2_FLAGS,getGlobalStorageValue(TEAM2_FLAGS)+1)

end

function addToBlue()

	return setGlobalStorageValue(TEAM1_FLAGS,getGlobalStorageValue(TEAM1_FLAGS)+1)

end

function getBlueScore()

	return getGlobalStorageValue(TEAM1_FLAGS)

end

function getRedScore()

	return getGlobalStorageValue(TEAM2_FLAGS)

end

function getTheSpeed(level)

	value = (220 +(2 *(level -1)))

	return value

end


function resetTheStorage()

	setGlobalStorageValue(Event_Start,-1)

	setGlobalStorageValue(Event_timeend,-1)

	setGlobalStorageValue(TEAM1_FLAGS,0)

	setGlobalStorageValue(FLAG2_INn,-1)

	setGlobalStorageValue(FLAG_IN,-1)

	setGlobalStorageValue(TEAM2_FLAGS,0)

return true

end

function blueStolen()

	return getGlobalStorageValue(FLAG_IN)

end

function redStolen()

	return getGlobalStorageValue(FLAG2_INn)

end

function giveReward(cid)

	local t = math.random(1,100)

	if t <= 10 then

		local rare = rewards_random[10].items[math.random(1,#rewards_random[10].items)]

		doPlayerAddItem(cid,rare,1)

		doPlayerSendTextMessage(cid,25,"Rare rate Reward : you won "..getItemNameById(rare)..".")


	elseif t > 10 and t <= 40 then

		local semi = rewards_random[30].items[math.random(1,#rewards_random[30].items)]

		doPlayerAddItem(cid,semi,1)

		doPlayerSendTextMessage(cid,25,"Semi rate Reward : you won "..getItemNameById(semi)..".")



	elseif t > 40 then

		local aver = rewards_random[60].items[math.random(1,#rewards_random[60].items)]

		doPlayerAddItem(cid,aver,1)

		doPlayerSendTextMessage(cid,25,"Averege rate Reward : you won "..getItemNameById(aver)..".")

	end

	return true

end

]]></lib>

  <event type="login" name="Tutorial Login" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')

function onLogin(cid)

	if getGlobalStorageValue(Event_Start) < 1 then

		if isTeamOne(cid) or isTeamTwo(cid) then

			resetTheTeams(cid)

		end

	end

	registerCreatureEvent(cid, "Attk")

	registerCreatureEvent(cid, "ctff")

	registerCreatureEvent(cid, "prepare")

return true

end

]]></event>

  <event type="combat" name="Attk" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')


function onCombat(cid, target)

	if isTeamOne(cid) and isTeamOne(target) then

		return false

	end

	if isTeamTwo(cid) and isTeamTwo(target) then

		return false

	end

	return true

end

]]></event>

  <event type="statschange" name="prepare" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')


local corpse_ids = {

		[0] = 3065, -- female

		[1] = 3058 -- male

}

function onStatsChange(cid, attacker, type, combat, value)

		if combat == COMBAT_HEALING then

			return true

		end

		if getCreatureHealth(cid) > value then

			return true

		end

		if getGlobalStorageValue(Event_Start) > 0 then

			if flagOwner(cid) then

				if isTeamOne(cid) then

					doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item").."[Flag Holder].")

					doTeleportThing(cid,Blue_Position,false)

					doSendMagicEffect(Blue_Position,10)

					doCreatureAddHealth(cid,getCreatureMaxHealth(cid))

					doCreatureAddMana(cid,getCreatureMaxMana(cid))

					releaseRF(cid)

							for _,cid in ipairs(getPlayersOnline()) do

								if isTeamOne(cid) or isTeamTwo(cid) then

									doPlayerSendTextMessage(cid,22,getCreatureName(cid) .. " has died with the "..TEAM2_NAME.." team flag. The flag is returned back to the "..TEAM1_NAME.." team.")

								end

							end

					return false

				elseif isTeamTwo(cid) then

					doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item").."[Flag Holder].")

					doTeleportThing(cid,Red_Position,false)

					doSendMagicEffect(Red_Position,10)

					doCreatureAddHealth(cid,getCreatureMaxHealth(cid))

					doCreatureAddMana(cid,getCreatureMaxMana(cid))

					releaseBF(cid)

							for _,cid in ipairs(getPlayersOnline()) do

								if isTeamOne(cid) or isTeamTwo(cid) then

									doPlayerSendTextMessage(cid,22,getCreatureName(cid) .. " has died with the "..TEAM1_NAME.." team flag. The flag is returned back to the "..TEAM1_NAME.." team.")

								end

							end

				return false

				end


			else

				if isTeamOne(cid) or isTeamTwo(cid) then

					doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item").."[Normal kill].")

					doTeleportThing(cid,( isTeamTwo(cid) and Red_Position or Blue_Position ),false)

					doSendMagicEffect(Red_Position,10)

					doCreatureAddHealth(cid,getCreatureMaxHealth(cid))

					doCreatureAddMana(cid,getCreatureMaxMana(cid))

					return false

				end

			end


		end

return true

end


]]></event>

  <movevent type="StepIn" actionid="6000" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')


function eventEnds()

	doBroadcastMessage('CTF-Event : The '..TEAM2_NAME..' team won and reciaved their reward.')

		for _,cid in ipairs(getPlayersOnline()) do

			if isTeamTwo(cid) then

				doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false)

				doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

				doRemoveConditions(cid,false)

				resetTheTeams(cid)

				doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

				giveReward(cid)


			elseif isTeamOne(cid) then

				doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false)

				doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

				doRemoveConditions(cid,false)

				doPlayerSendTextMessage(cid,22,'Your team have lost.')

				resetTheTeams(cid)

				doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

			end

		end

	addEvent(resetTheStorage,5)

end

function onStepIn(cid, item, position, fromPosition)

	if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then

		if isTeamTwo(cid) and redStolen() < 0 then

			if not flagOwner(cid) then

				doTeleportThing(cid, fromPosition,TRUE)

				doSendMagicEffect(getThingPos(cid),2)

				doPlayerSendTextMessage(cid, 27, "This is your team flag, you cant take it!")

			end

		elseif isTeamTwo(cid) and redStolen() > 0 and blueStolen() < 0 then

			doPlayerSendTextMessage(cid, 27, "Your team's Flag has been stolen, go get it back!")

			doTeleportThing(cid, fromPosition,TRUE)

			doSendMagicEffect(getThingPos(cid),2)

		  return true

		end

		if isTeamTwo(cid) and flagOwner(cid) and blueStolen() > 0 and redStolen() < 0 then

			if getRedScore() == FLAG_SCORE -1 then

				addEvent(eventEnds,1000)

				addToRed()

				doTeleportThing(cid, fromPosition,TRUE)

				doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid) )

				releaseBF(cid)

					for _,tid in ipairs(getPlayersOnline()) do

						if isTeamOne(tid) or isTeamTwo(tid) then

							doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " have captured the last flag and earned match win to the ".. TEAM2_NAME.." team!")

						end

					end

			else

				releaseBF(cid)

				addToRed()

				doTeleportThing(cid, fromPosition,TRUE)

				doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid) )

					for _,tid in ipairs(getPlayersOnline()) do

						if isTeamOne(tid) or isTeamTwo(tid) then

							doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " have captured the flag and earned 1 point to the ".. TEAM2_NAME.." team!")

								if Teleport_On_Score == true then

									doTeleportThing(tid,( isTeamTwo(tid) and Red_Position or Blue_Position ), false)

									doSendMagicEffect(getThingPos(tid),10)

								end

						end

					end

			end

		end

		if isTeamOne(cid) then

			if blueStolen() < 0 and redStolen() > 0 then

				if flagOwner(cid) then

					doPlayerSendTextMessage(cid, 27, "You already holding the flag!")

					doTeleportThing(cid, fromPosition,TRUE)

					doSendMagicEffect(getThingPos(cid),2)

				elseif (not flagOwner(cid)) then

					doPlayerSendTextMessage(cid, 27, "Your Team mates already stole the oponent flag, defend him!")

					doTeleportThing(cid, fromPosition,TRUE)

					doSendMagicEffect(getThingPos(cid),2)

				end

			elseif blueStolen() > 0 and redStolen() < 0 then

				doPlayerSendTextMessage(cid, 27, "Your team's flag is taken you can't capture or steel a flag!")

				doTeleportThing(cid, fromPosition,TRUE)

				doSendMagicEffect(getThingPos(cid),2)

			end

			if redStolen() < 0 and blueStolen() < 0 then

				setGlobalStorageValue(FLAG2_INn,1)

				setflagOwner(cid)

				setPlayerStorageValue(cid,103, os.time()+300)

				doTeleportThing(cid, fromPosition,TRUE)

				doChangeSpeed(cid, getTheSpeed(Flag_Holder_Speed)- getCreatureSpeed(cid) )

					for _,tid in ipairs(getPlayersOnline()) do

						if isTeamOne(tid) or isTeamTwo(tid) then

							doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " stolen the "..TEAM2_NAME.." team flag!")

						end

					end

			end

		end

	end

return true

end

]]></movevent>

  <movevent type="StepIn" actionid="3435" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)

	if getStorage(Event_Tile_Close) > 0 then

		if getPlayerLevel(cid) < Min_Join_Level then

		   doTeleportThing(cid,fromPosition,false)

			doSendMagicEffect(fromPosition,10)

			doPlayerSendTextMessage(cid,21,"Only players of level "..Min_Join_Level.." are allowed to pass.")

		else

			doTeleportThing(cid,Wait_Place,false)

			doSendMagicEffect(Wait_Place,10)

		end

	else

		doTeleportThing(cid,fromPosition,false)

		doSendMagicEffect(fromPosition,10)

		doPlayerSendTextMessage(cid,21,"Come back later, event is closed now.")

	end

return true

end


]]></movevent>

  <movevent type="StepIn" actionid="6001" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')


function eventEnded()

	if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then

		doBroadcastMessage('CTF-Event : The '.. TEAM1_NAME..' team won and reciaved their reward.')

			for _,cid in ipairs(getPlayersOnline()) do

				if isTeamOne(cid) then

					doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false)

					doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

					doRemoveConditions(cid,false)

					resetTheTeams(cid)

					doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

					giveReward(cid)

				elseif isTeamTwo(cid) then

					doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false)

					doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

					doRemoveConditions(cid,false)

					doPlayerSendTextMessage(cid,22,'Your team have lost.')

					resetTheTeams(cid)

					doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

				end

			end

	end

	addEvent(resetTheStorage,5)

end

function onStepIn(cid, item, position, fromPosition)

	if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then

		if isTeamOne(cid) and blueStolen() < 0 then

			if not flagOwner(cid) then

				doTeleportThing(cid, fromPosition,TRUE)

				doSendMagicEffect(getThingPos(cid),2)

				doPlayerSendTextMessage(cid, 27, "This is your team flag, you cant take it!")

			end

		elseif isTeamOne(cid) and blueStolen() > 0 and redStolen() < 0 then

			doPlayerSendTextMessage(cid, 27, "Your team's Flag has been stolen, go get it back!")

			doTeleportThing(cid, fromPosition,TRUE)

			doSendMagicEffect(getThingPos(cid),2)

		 return true

		end

		if isTeamOne(cid) and flagOwner(cid) and redStolen() > 0 and blueStolen() < 0 then

			if getBlueScore() == FLAG_SCORE -1 then

				addEvent(eventEnded,1000)

				addToBlue()

				doTeleportThing(cid, fromPosition,TRUE)

				doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid) )

				releaseRF(cid)

					for _,tid in ipairs(getPlayersOnline()) do

						if isTeamOne(tid) or isTeamTwo(tid) then

							doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " have captured the last flag and earned match win to the ".. TEAM1_NAME.." team!")

						end

					end

			else

				releaseRF(cid)

				addToBlue()

				doTeleportThing(cid, fromPosition,TRUE)

				doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid) )

					for _,tid in ipairs(getPlayersOnline()) do

						if isTeamOne(tid) or isTeamTwo(tid) then

							doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " have captured the flag and earned 1 point to the ".. TEAM1_NAME.." team!")

								if Teleport_On_Score == true then

									doTeleportThing(tid,( isTeamTwo(tid) and Red_Position or Blue_Position ), false)

									doSendMagicEffect(getThingPos(tid),10)

								end

						end

					end

			end

		end

		if isTeamTwo(cid) then

			if blueStolen() > 0 and redStolen() < 0 then

				if flagOwner(cid) then

					doPlayerSendTextMessage(cid, 27, "You already holding the flag!")

					doTeleportThing(cid, fromPosition,TRUE)

					doSendMagicEffect(getThingPos(cid),2)

				elseif (not flagOwner(cid)) then

					doPlayerSendTextMessage(cid, 27, "Your Team mates already stole the oponent flag, defend him!")

					doTeleportThing(cid, fromPosition,TRUE)

					doSendMagicEffect(getThingPos(cid),2)

				end

			elseif redStolen() > 0 and blueStolen() < 0 then

				doPlayerSendTextMessage(cid, 27, "Your team's flag is taken you can't capture or steel a flag!")

				doTeleportThing(cid, fromPosition,TRUE)

				doSendMagicEffect(getThingPos(cid),2)

			end

			if blueStolen() < 0 and redStolen() < 0 then

				setGlobalStorageValue(FLAG_IN,1)

				setflagOwner(cid)

				setPlayerStorageValue(cid,103, os.time()+300)

				doTeleportThing(cid, fromPosition,TRUE)

				doChangeSpeed(cid, getTheSpeed(Flag_Holder_Speed)- getCreatureSpeed(cid) )

					for _,tid in ipairs(getPlayersOnline()) do

						if isTeamOne(tid) or isTeamTwo(tid) then

							doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " stolen the "..TEAM1_NAME.." team flag!")

						end

					end

			end

		end

	end

return true

end

]]></movevent>

  <globalevent name="ctf" interval="900" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')

local players = {}

local bmale = createConditionObject(CONDITION_OUTFIT)

		setConditionParam(bmale, CONDITION_PARAM_TICKS, -1)

		addOutfitCondition(bmale, {lookType = math.random(128,134), lookHead = 115, lookBody =114, lookLegs = 81, lookFeet = 81, lookTypeEx = 0, lookAddons = 3})


	local bfemale = createConditionObject(CONDITION_OUTFIT)

		setConditionParam(bfemale, CONDITION_PARAM_TICKS, -1)

		addOutfitCondition(bfemale, {lookType = math.random(136,142), lookHead = 115, lookBody =114, lookLegs = 81, lookFeet = 81, lookTypeEx = 0, lookAddons = 3})


	local rmale = createConditionObject(CONDITION_OUTFIT)

		setConditionParam(rmale, CONDITION_PARAM_TICKS, -1)

		addOutfitCondition(rmale, {lookType = math.random(128,134), lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = 3})


	local rfemale = createConditionObject(CONDITION_OUTFIT)

		setConditionParam(rfemale, CONDITION_PARAM_TICKS, -1)

		addOutfitCondition(rfemale, {lookType = math.random(136,142),lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = 3})

	local fight = createConditionObject(CONDITION_INFIGHT)

		setConditionParam(fight, CONDITION_PARAM_TICKS, -1)

function eventEnd()

	if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then

		if getRedScore() > getBlueScore() then

			doBroadcastMessage('CTF-Event : The '.. TEAM2_NAME..' team won and recieved their reward.')

				for _,cid in ipairs(getPlayersOnline()) do

					if isTeamTwo(cid) then

						doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false)

						doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

						doRemoveConditions(cid,false)

						resetTheTeams(cid)

						doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

						giveReward(cid)

					elseif isTeamOne(cid) then

						doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false)

						doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

						doRemoveConditions(cid,false)

						doPlayerSendTextMessage(cid,22,'Your team have lost.')

						resetTheTeams(cid)

						doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

					end

				end


		elseif getRedScore() < getBlueScore() then

			doBroadcastMessage('CTF-Event : The '.. TEAM1_NAME..' team won and recieved their reward.')

				for _,cid in ipairs(getPlayersOnline()) do

					if isTeamOne(cid) then

						doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false)

						doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

						doRemoveConditions(cid,false)

						resetTheTeams(cid)

						doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

						giveReward(cid)

					elseif isTeamTwo(cid) then

						doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false)

						doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

						doRemoveConditions(cid,false)

						doPlayerSendTextMessage(cid,22,'Your team have lost.')

						resetTheTeams(cid)

						doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

					end

				end

		elseif getRedScore() == getBlueScore() then

			doBroadcastMessage('CTF-Event : The Event ended with a draw between both teams.')

				for _,cid in ipairs(getPlayersOnline()) do

					if isTeamTwo(cid) or isTeamOne(cid) then

						doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false)

						doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

						doRemoveConditions(cid,false)

						doPlayerSendTextMessage(cid,22,'It was a draw between both teams.')

						resetTheTeams(cid)

						doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

					end

				end


		end

		addEvent(resetTheStorage,1000)

	end

end


function eventStart()

	doSetStorage(Event_Tile_Close,-1)

	setGlobalStorageValue(Event_timeend,1)

	setGlobalStorageValue(Timer, os.time() + Event_MaxTime*60)

	addEvent(eventEnd,Event_MaxTime*60*1000)




			for v = frompos.x , topos.x do

				for k = frompos.y , topos.y do

					for i = 1, 200 do

						position = {x = v, y = k, z = 7, stackpos = i}

						pid = getThingfromPos(position).uid

							if(pid ~= nil and isPlayer(pid)) then

								table.insert(players, pid)

							end

					end

				end

			end

			if math.mod(#players, 2) ~= 0 then

				doTeleportThing(players[#players],getTownTemplePosition(getPlayerTown(players[#players])),false)

				doSendMagicEffect(getThingPosition(players[#players]),10)

				doPlayerSendTextMessage(players[#players], 19, "Sorry, you have been kicked from event to balance teams.")

				table.remove(players)

			end

			if #players < Players_Least_Number then

				doBroadcastMessage("CTF event was cancelled because less than "..Players_Least_Number.." players joined")

				resetTheStorage()

					if #players > 0 then

						for i = 1,#players do

							 doTeleportThing(players[i],getTownTemplePosition(getPlayerTown(players[i])),false)

							 doSendMagicEffect(getThingPos(players[i]), 10)

						end

					end

			else

					 doBroadcastMessage("CTF started")

						for i = 1, math.floor(#players/2) do

							setFirstTeam(players[i])

						end

						for i = math.floor(#players/2)+1 , #players do

							setSecondTeam(players[i])

						end

						for _,cid in ipairs(getPlayersOnline()) do

							if isTeamOne(cid) then

								if getPlayerSex(cid) == 1 then

									doAddCondition(cid, bmale)

								elseif getPlayerSex(cid) ~= 1 then

									doAddCondition(cid, bfemale)

								end

								doAddCondition(cid, fight)

								doTeleportThing(cid,Blue_Position,false)

								doSendMagicEffect(Blue_Position, 10)

								doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid))

							elseif  isTeamTwo(cid) then

								if getPlayerSex(cid) == 1 then

									doAddCondition(cid, rmale)

								elseif getPlayerSex(cid) ~= 1 then

									doAddCondition(cid, rfemale)

								end

								doAddCondition(cid, fight)

								doTeleportThing(cid,Red_Position,false)

								doSendMagicEffect(Red_Position, 10)

								doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid))

							end

						end

						players = {}


			end

end

function onThink(interval)

   if getGlobalStorageValue(Event_Start) < 0 then

		setGlobalStorageValue(Event_Start,1)

		doSetStorage(Event_Tile_Close,1)

		doBroadcastMessage("CTF event is opened and teleport is created. It will start in "..Event_WaitTime.." minutes.")

		players = {}

		if getTileItemById(Tp_Place, 1387).uid < 1 then

			doItemSetAttribute(doCreateItem(1387,1, Tp_Place), "aid", 3435)

		end


		f= Event_WaitTime - 1

			for i = 1,Event_WaitTime-1 do

				addEvent(doBroadcastMessage,i*60*1000,"CTF event is opened and teleport is created. It will start in "..f.." minutes.")

				f= f-1

			end

		addEvent(eventStart,Event_WaitTime*60*1000)

	end

return true

end

]]></globalevent>

  <event type="think" name="ctff" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')


local bl = BLUE_FLAG

local re = RED_FLAG

function onThink(interval)

	if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then

		if redStolen() < 0 then

			doSendAnimatedText(re,"FLAG!",TEXTCOLOR_DARKRED)

			doSendMagicEffect(re, CONST_ME_SOUND_RED)

		end

		if blueStolen() < 0 then

			doSendAnimatedText(bl,"FLAG!",TEXTCOLOR_GREEN)

			doSendMagicEffect(bl, CONST_ME_SOUND_GREEN)

		end

		for _, cid in ipairs(getPlayersOnline()) do

			if flagOwner(cid) then

				if isTeamOne(cid) or isTeamTwo(cid) then

					if hasCondition(cid,CONDITION_HASTE) then

						doRemoveCondition(cid,CONDITION_HASTE)

					end

				end

				pl = getThingPos(cid)

					if isTeamTwo(cid) then

						if getPlayerStorageValue(cid,103) < os.time() then

							releaseBF(cid)

								for _,cid in ipairs(getPlayersOnline()) do

									if isTeamOne(cid) or isTeamTwo(cid) then

										doPlayerSendTextMessage(cid,22,getCreatureName(cid) .. " wasted 5 minutes with FLAG."..TEAM2_NAME.." flag is again on spawn!")

									end

								end

						else

							doSendAnimatedText(pl,"FLAG!",TEXTCOLOR_GREEN)

							doSendMagicEffect(pl, CONST_ME_SOUND_GREEN)

						end

					elseif isTeamOne(cid) then

						if getPlayerStorageValue(cid,103) < os.time() then

							releaseRF(cid)

								for _,cid in ipairs(getPlayersOnline()) do

									if isTeamOne(cid) or isTeamTwo(cid) then

										doPlayerSendTextMessage(cid,22,getCreatureName(cid) .. " wasted 5 minutes with FLAG."..TEAM1_NAME.." flag is again on spawn!")

									end

								end

						else

							doSendAnimatedText(pl,"FLAG!",COLOR_RED)

							doSendMagicEffect(pl, CONST_ME_SOUND_RED)

						end

					end

			end

		end

	end

  return true

end

]]></event>

  <globalevent name="timer" interval="0.4" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')


function onThink(interval)

	for _,cid in ipairs(getPlayersOnline()) do

		if isTeamOne(cid) or isTeamTwo(cid) then

			if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then

				if getGlobalStorageValue(Timer)- os.time() >= 0 then

					doPlayerSendCancel(cid, "Time -> ".. os.date("%M:%S ",getGlobalStorageValue(Timer)- os.time()) .. "  |  ".. TEAM1_NAME.." Score : "..getBlueScore(cid).."/"..FLAG_SCORE.." captures  |  ".. TEAM2_NAME.." Score : "..getRedScore(cid).."/"..FLAG_SCORE.." captures")

				end

			end

		end

	end

return true

end

]]></globalevent>

  <globalevent name="starting" type="startup" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')

function onStartup()

	resetTheStorage()


return true

end

]]></globalevent>

</mod>

 

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 cloudrun2023
      CloudRun - Sua Melhor Escolha para Hospedagem de OTServer!
      Você está procurando a solução definitiva para hospedar seu OTServer com desempenho imbatível e segurança inigualável? Não procure mais! Apresentamos a CloudRun, sua parceira confiável em serviços de hospedagem na nuvem.
       
      Recursos Exclusivos - Proteção DDoS Avançada:
      Mantenha seu OTServer online e seguro com nossa robusta proteção DDoS, garantindo uma experiência de jogo ininterrupta para seus jogadores.
       
      Servidores Ryzen 7 Poderosos: Desfrute do poder de processamento superior dos servidores Ryzen 7 para garantir um desempenho excepcional do seu OTServer. Velocidade e estabilidade garantidas!
       
      Armazenamento NVMe de Alta Velocidade:
      Reduza o tempo de carregamento do jogo com nosso armazenamento NVMe ultrarrápido. Seus jogadores vão adorar a rapidez com que podem explorar o mundo do seu OTServer.
       
      Uplink de até 1GB:
      Oferecemos uma conexão de alta velocidade com até 1GB de largura de banda, garantindo uma experiência de jogo suave e livre de lag para todos os seus jogadores, mesmo nos momentos de pico.
       
      Suporte 24 Horas:
      Estamos sempre aqui para você! Nossa equipe de suporte está disponível 24 horas por dia, 7 dias por semana, para resolver qualquer problema ou responder a qualquer pergunta que você possa ter. Sua satisfação é a nossa prioridade.
       
      Fácil e Rápido de Começar:
      Configurar seu OTServer na CloudRun é simples e rápido. Concentre-se no desenvolvimento do seu jogo enquanto cuidamos da hospedagem.
       
      Entre em Contato Agora!
      Website: https://central.cloudrun.com.br/index.php?rp=/store/cloud-ryzen-brasil
      Email: [email protected]
      Telefone: (47) 99902-5147

      Não comprometa a qualidade da hospedagem do seu OTServer. Escolha a CloudRun e ofereça aos seus jogadores a melhor experiência de jogo possível. Visite nosso site hoje mesmo para conhecer nossos planos e começar!
       
      https://central.cloudrun.com.br/index.php?rp=/store/cloud-ryzen-brasil
       
      CloudRun - Onde a Velocidade Encontra a Confiabilidade!
       

    • Por FeeTads
      SALVE rapaziada do TK, esses dias vim pensando em novos scripts pro meu OT, e em um deles eu precisava que determinada area não contasse frag pro player que matasse outros, PORÉM eu precisava que os players que morressem nessa area ainda assim tivessem as penalidades da sua morte, procurei por ai, achei alguns scripts que apenas tiravam o SKULL e não realmente o FRAG do player.

      **script atualizado 22/10/2023** - melhorado e otimizado, levei o script pra puxar as infos por .lua / creatureScripts

      vou disponibilizar o code aqui, e o que fazer pra determinada area não contar frag.

      SOURCE OTX 2 / TFS 0.x, Funciona em TFS 1.x mudando as tags e ajeitando as sintaxes.

      vá em creatureevent.cpp

      procure por:
      else if(type == "preparedeath") _type = CREATURE_EVENT_PREPAREDEATH;
      Adiciona abaixo:
      else if(type == "nocountfrag") _type = CREATURE_EVENT_NOCOUNTFRAG;

      procure por:
      case CREATURE_EVENT_PREPAREDEATH: return "onPrepareDeath";  
      Adicione abaixo: 
      case CREATURE_EVENT_NOCOUNTFRAG: return "noCountFragArea";

      procure por:
      case CREATURE_EVENT_PREPAREDEATH: return "cid, deathList";
      Adicione abaixo:
      case CREATURE_EVENT_NOCOUNTFRAG: return "cid, target";

      agora no mesmo arquivo, vá até o final do arquivo e adicione essa função:
      uint32_t CreatureEvent::executeNoCountFragArea(Creature* creature, Creature* target) { //noCountFragArea(cid, target) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::ostringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << "local target = " << env->addThing(target) << std::endl; if(m_scriptData) scriptstream << *m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ std::ostringstream desc; desc << creature->getName(); env->setEvent(desc.str()); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); lua_pushnumber(L, env->addThing(target)); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } } else { std::clog << "[Error - CreatureEvent::noCountFragArea] Call stack overflow." << std::endl; return 0; } }

      agora vá em creatureevent.h

      procure por:
      CREATURE_EVENT_PREPAREDEATH
      adicione abaixo:
      CREATURE_EVENT_NOCOUNTFRAG

      procure por:
      uint32_t executePrepareDeath(Creature* creature, DeathList deathList);
      Adicione abaixo:
      uint32_t executeNoCountFragArea(Creature* creature, Creature* target);

      agora vá em player.cpp

      procure por:
      bool Player::onKilledCreature(Creature* target, DeathEntry& entry)
      abaixo de:
      War_t enemy; if(targetPlayer->getEnemy(this, enemy)) { if(entry.isLast()) IOGuild::getInstance()->updateWar(enemy); entry.setWar(enemy); }
      Adicione o seguinte código:
      if (targetPlayer){ CreatureEventList killEvents = getCreatureEvents(CREATURE_EVENT_NOCOUNTFRAG); for (const auto &event : killEvents) { if (!event->executeNoCountFragArea(this, target)) { return true; } } }

      //

      Feito isso, tudo completo na sua source, agora é necessário adicionar o creaturescript dentro do servidor

      vá até creaturescripts/scripts
      crie um arquivo chamado, "noCountFragInArea.lua"
      e dentro dele cole o código:
       
      --[[ script feito por feetads / TibiaKing ]]-- --[[ discord: feetads / FeeTads#0246 ]]-- -- Add positions here for which you do not want to count frags local areas = { [1] = {from = {x = 91, y = 122, z = 7}, to = {x = 98, y = 127, z = 7}}, -- from = area superior esquerda / to = area inferior direita (formando um quadrado) } local onlyKillerInArea = false -- only killer need to be in area? function noCountFragArea(cid, target) if not isCreature(cid) or not isCreature(target) then return true end local posKiller = getPlayerPosition(cid) local posTarget = getPlayerPosition(target) for i = 1, #areas do local area = areas[i] if isInArea(posKiller, area.from, area.to) then if onlyKillerInArea then return false elseif isInArea(posTarget, area.from, area.to) then return false end end end return true end
      agora em creaturescripts.xml
      <event type="nocountfrag" name="fragarea" event="script" value="noCountFragInArea.lua"/>
      agora em creaturescripts/scripts/login.lua
       procure por OU semelhante a esse:
      registerCreatureEvent(cid, "AdvanceSave")
      e abaixo adicione:
      registerCreatureEvent(cid, "fragarea")

      //


      Agora tudo certo, quando quiser adiciona uma area que não pega frag, vá até o script e apenas coloque a area, igual o demonstrado no script

      Exemplo:
      local areas = { [1] = {from = {x = 91, y = 122, z = 7}, to = {x = 98, y = 127, z = 7}}, [2] = {from = {x = 1000, y = 1000, z = 7}, to = {x = 1100, y = 1100, z = 7}}, }
      assim somente colocando a area no script e abrindo o server ou dando /reload, já funcionará a area como não pegar frag.
      Esse sistema pode ser bom pra areas de pvp ativo, onde você ainda quer que o player que morrer perca os atributos, como se fosse uma morte normal, porém não conta frag pra quem matar.
      Bom pra sistemas tipo castle 48h (guild war), onde há diversas mortes e risco de pegar red, atrapalhando a war.

      Façam bom proveito dos scripts, e deixem os créditos no script rsrs

      **Eu fiz as alterações e o simples código por isso vim disponibilizar, créditos meus**
    • Por Muvuka
      Abri canal a força creaturescript acho que funcione no creaturescript cria script creaturescript
       
      <channel id="9" name="HELP" logged="yes"/>
      <channel id="12" name="Report Bugs" logged="yes"/>
      <channel id="13" name="Loot" logged="yes"/>
      <channel id="14" name="Report Character Rules Tibia Rules" logged="yes"/>
      <channel id="15" name="Death Channel"/>
      <channel id="6548" name="DexSoft" level="1"/>
      <channel id="7" name="Reports" logged="yes"/>
       
      antes de 
              if(lastLogin > 0) then adicione isso:
                      doPlayerOpenChannel(cid, CHANNEL_HELP) doPlayerOpenChannel(cid, 1,  2, 3) = 1,2 ,3 Channels, entendeu? NÃO FUNCIONA EU QUERO UM MEIO DE ABRI SEM USA A SOURCE
       
      EU NÃO CONSEGUI ABRI EU NÃO TENHO SOURCE
       
       
    • Por bolachapancao
      Rapaziada seguinte preciso de um script que ao utilizar uma alavanca para até 4 jogadores.
      Os jogadores serão teleportados para hunt durante uma hora e depois de uma hora os jogadores serão teleportados de volta para o templo.
       
      Observação: caso o jogador morra ou saia da hunt o evento hunt é cancelado.

      Estou a base canary
      GitHub - opentibiabr/canary: Canary Server 13.x for OpenTibia community.
       
    • Por RAJADAO
      .Qual servidor ou website você utiliza como base? 
      Sabrehaven 8.0
      Qual o motivo deste tópico? 
      Ajuda com novos efeitos
       
      Olá amigos, gostaria de ajuda para introduzir os seguintes efeitos no meu servidor (usando o Sabrehaven 8.0 como base), adicionei algumas runas novas (avalanche, icicle, míssil sagrado, stoneshower & Thunderstorm) e alguns novos feitiços (exevo mas san, exori san, exori tera, exori frigo, exevo gran mas frigo, exevo gran mas tera, exevo tera hur, exevo frigo hur) mas nenhum dos efeitos dessas magias parece existir no servidor, alguém tem um link para um tutorial ou algo assim para que eu possa fazer isso funcionar?
      Desculpe pelo mau inglês, sou brasileiro.

      Obrigado!


      AVALANCHE RUNE id:3161 \/
      (COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)

      STONESHOWER RUNE id:3175 \/
      (COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_STONES)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH)

      THUNDERSTORM RUNE id:3202 \/
      (COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_E NERGYHIT)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL)

      ICICLE RUNE id:3158 \/
      COMBAT_ICEDAMAGE
      CONST_ME_ICEAREA
      CONST_ANI_ICE

      SANTO MÍSSIL RUNA id:3182 \/
      (COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)

      CONST_ME_PLANTATTACK (exevo gran mas tera)
      CONST_ME_ICETORNADO (exevo gran mas frigo)
      CONST_ME_SMALLPLANTS (exevo tera hur)
      CONST_ME_ICEAREA (exevo frigo hur)
      CONST_ME_ICEATTACK (exori frigo)
      CONST_ME_CARNIPHILA (exori tera)

      EXORI SAN \/
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY)
      CONST_ME_HOLYDAM IDADE

      EXEVO MAS SAN \/
      CONST_ME_HOLYAREA
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo