Ir para conteúdo
  • Cadastre-se

[Resolvido] [Lua Error] [string "loadBuffer"]:7: '>' expected near 'open'


Posts Recomendados

Então tá dando isso ae quando tento iniciar o evento :c num faço a minima do q seja :z Help's

Aqui a MOD:

<mod name="Regicide Event" version="1.0" author="LuckOake" contact="none" enabled="yes">

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

<config name="king_func">

kingdom = {

["Protectors"] = {

pos = {x = 32326, y = 33343, z = 7},

storage = 51322,

},

["Killers"] = {

pos = {x = 32324, y = 33288, z = 7},

storage = 51323,

}

}

area1 = {x = 32301, y = 33281, z = 7} -- Ponta de cima na esquerda da área

area2 = {x = 32350, y = 33346, z = 7} -- Ponta de baixo na direita da área

stor = 51320

tp_pos = {x = 32338, y = 32213, z = 7, stackpos = 1} -- Posição do teleport (Não altere o stackpos)

maxplayers = 20 -- Máximo de players (De preferência, coloque um número par)

wall = { -- Positions das paredes de bloqueio (Não altere o stackpos)

[1] = {x = 32324, y = 33325, z = 7, stackpos = 1},

[2] = {x = 32325, y = 33325, z = 7, stackpos = 1},

}

wallid = 1547 -- Id das walls

king = "King" -- Nome do monstro que será o King

kpos = {x = 32324, y = 33290, z = 7} -- Position que o King será criado

prizes = {

[1] = {id = 2149, count = 13},

[2] = {id = 2149, count = 12},

[3] = {id = 2149, count = 11}

}

prand = math.random(1, #prizes)

function doCreatureFollow(cid, target, playerpos, targetpos, times)

followstor = 51325

if playerdir ~= getCreatureLookDirection(cid) then

doCreatureSetLookDirection(target, getCreatureLookDirection(cid))

end

if playerpos ~= getCreaturePosition(cid) then

if playerpos.z == getCreaturePosition(cid).z then

ntpos = getCreaturePosition(cid)

local x,y,z = ntpos.x-playerpos.x,ntpos.y-playerpos.y,ntpos.z-playerpos.z

ntpos = getCreaturePosition(target)

ntpos.x, ntpos.y, ntpos.z = ntpos.x+x,ntpos.y+y,ntpos.z+z

if queryTileAddThing(target, ntpos) == RETURNVALUE_NOERROR and getCreaturePosition(cid).z == getCreaturePosition(target).z then

doMoveCreature(target, getCreatureLookDirection(cid))

end

end

end

local playerpos, targetpos = getCreaturePosition(cid), getCreaturePosition(target)

local mf = 1

local times = mf+1

if times > 0 and getPlayerStorageValue(cid, followstor) == 1 then

addEvent(doCreatureFollow, 1, cid, target, playerpos, targetpos, times)

else

local times = 0

doCreatureSetNoMove(target, false)

end

end

function doCleanMonstersFromArea(toPositionX, fromPositionX, toPositionY, fromPositionY, toPositionZ, fromPositionZ)

local monsters = {}

for x = fromPositionX, toPositionX do

for y = fromPositionY, toPositionY do

for z = fromPositionZ, toPositionZ do

local pos = {x=x,y=y,z=z, stackpos=253}

if(isMonster(getThingfromPos(pos).uid)) then

table.insert(isMonster(getThingfromPos(pos).uid) and monsters, getThingfromPos(pos).uid)

end

end

end

end

for i = 1, #monsters do

doRemoveCreature(monsters)

end

return true

end

function isMale(cid)

return getPlayerSex(cid) == 1 and true or false

end

function isFemale(cid)

return getPlayerSex(cid) == 0 and true or false

end

function getNumberType(n)

return n % 2 == 0 and "par" or "impar"

end

function selectPlayerTeam(cid)

if getNumberType(getGlobalStorageValue(stor)) == "par" then

doTeleportThing(cid, kingdom["Protectors"].pos)

setPlayerStorageValue(cid, 51321, 1)

registerCreatureEvent(cid, "KingProtect")

registerCreatureEvent(cid, "KingCast")

setGlobalStorageValue(kingdom["Protectors"].storage, getGlobalStorageValue(kingdom["Protectors"].storage)+1)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You must PROTECT the King. Kill his enemies!")

if isMale(cid) then

doSetCreatureOutfit(cid, {lookType = math.random(128,134), lookHead = 88, lookBody = 88, lookLegs = 88, lookFeet = 88}, -1)

elseif isFemale(cid) then

doSetCreatureOutfit(cid, {lookType = math.random(136,142), lookHead = 88, lookBody = 88, lookLegs = 88, lookFeet = 88}, -1)

end

elseif getNumberType(getGlobalStorageValue(stor)) == "impar" then

doTeleportThing(cid, kingdom["Killers"].pos)

setPlayerStorageValue(cid, 51321, 2)

registerCreatureEvent(cid, "KingKill")

setGlobalStorageValue(kingdom["Killers"].storage, getGlobalStorageValue(kingdom["Killers"].storage)+1)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You must KILL the King. Crush him!")

if isMale(cid) then

doSetCreatureOutfit(cid, {lookType = math.random(128,134), lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94}, -1)

elseif isFemale(cid) then

doSetCreatureOutfit(cid, {lookType = math.random(136,142), lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94}, -1)

end

end

setGlobalStorageValue(stor, getGlobalStorageValue(stor)+1)

registerCreatureEvent(cid, "KingdomLogout")

registerCreatureEvent(cid, "KingdomDeath")

end

function removeWalls()

for _, walls in ipairs(wall) do

doRemoveItem(getThingFromPos(walls).uid, 1)

end

end

function createWalls()

for _, walls in ipairs(wall) do

doCreateItem(wallid, 1, walls)

end

end

function startEvent()

doRemoveItem(getThingFromPos(tp_pos).uid, 1)

doSendMagicEffect(tp_pos, 2)

doCreateMonster(king, kpos)

broadcastMessage("Regicide Event started.")

removeWalls()

end

function resetEvent()

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

if isInArea(getCreaturePosition(pid), area1, area2) then

if getPlayerStorageValue(pid, 51325) == 1 then

setPlayerStorageValue(pid, 51325, -1)

end

setPlayerStorageValue(pid, 51321, -1)

doRemoveCondition(pid, CONDITION_OUTFIT)

doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))

setGlobalStorageValue(stor, -1)

setGlobalStorageValue(51324, -1)

setGlobalStorageValue(51326, -1)

setGlobalStorageValue(kingdom["Protectors"].storage, -1)

setGlobalStorageValue(kingdom["Killers"].storage, -1)

doCleanMonstersFromArea(area2.x, area1.x, area2.y, area1.y, area2.z, area1.z)

addEvent(doRemoveCreature, 3000, pid)

end

end

createWalls()

end

function isProtector(cid)

return getPlayerStorageValue(cid, 51321) == 1 and true or false

end

function isKiller(cid)

return getPlayerStorageValue(cid, 51321) == 2 and true or false

end

function openTeleport()

local tp = 1387

local tele = doCreateItem(tp, 1, tp_pos)

setGlobalStorageValue(kingdom["Protectors"].storage, 0)

setGlobalStorageValue(kingdom["Killers"].storage, 0)

doItemSetAttribute(tele, "aid", 15781)

doSendMagicEffect(tp_pos, 10)

setGlobalStorageValue(51320, 0)

broadcastMessage("Regicide Event is now open!")

end

</config>

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

<talkaction words="/regicide" access="5" event="buffer">

domodlib('king_func')

if not param then

doPlayerSendCancel(cid, "Incorrect params. Choose if the event will "open", "force" or "reset".") return true

elseif param == "open" then

if getGlobalStorageValue(stor) ~= -1 or getGlobalStorageValue(stor) > 0 then

doPlayerSendCancel(cid, "You can't start the event now.") return true

end

openTeleport()

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've opened the Regicide event.") return true

elseif param == "force" then

if getGlobalStorageValue(stor) == -1 or getGlobalStorageValue(51324) >= 1 then

doPlayerSendCancel(cid, "You can't force the event now.") return true

end

setGlobalStorageValue(51324, 1)

startEvent()

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've closed the Regicide event.") return true

elseif param == "reset" then

if getGlobalStorageValue(stor) == -1 or getGlobalStorageValue(51324) == -1 then

doPlayerSendCancel(cid, "You can't end the event now.") return true

end

resetEvent()

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've reseted the Regicide event.") return true

end

return true

</talkaction>

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

<movevent type="StepIn" actionid="15781" event="script">

domodlib('king_func')

function onStepIn(cid, position, fromPosition)

if getGlobalStorageValue(51320) == (maxplayers-1) then

setGlobalStorageValue(51324, 1)

startEvent()

else

broadcastMessage(""..getCreatureName(cid).." entered in the Regicide Event. There is "..(maxplayers-(getGlobalStorageValue(stor)+1)).." slots remaining.")

end

selectPlayerTeam(cid)

return true

end

</movevent>

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

<event type="logout" name="KingdomLogout" event="script">

domodlib('king_func')

function onLogout(cid)

if getPlayerStorageValue(cid, 51321) >= 1 then

doPlayerSendCancel(cid, "You can't logout when you are in this event!") return false

end

return true

end

</event>

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

<event type="preparedeath" name="KingdomDeath" event="script">

domodlib('king_func')

function onPrepareDeath(cid)

if isKiller(cid) and getGlobalStorageValue(kingdom["Killers"].storage) > 1 then

setGlobalStorageValue(kingdom["Killers"].storage, getGlobalStorageValue(kingdom["Killers"].storage)-1)

broadcastMessage(""..getCreatureName(cid).." [KILLER] died. "..getGlobalStorageValue(kingdom["Protectors"].storage).." Protectors and "..getGlobalStorageValue(kingdom["Killers"].storage).." Killers left.")

elseif isKiller(cid) and getGlobalStorageValue(kingdom["Killers"].storage) == 1 then

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

if isProtector(wid) then

if not doPlayerAddItem(wid, prizes[prand].id, prizes[prand].count) then

local parcel = doCreateItemEx(ITEM_PARCEL)

doAddContainerItem(parcel, prizes[prand].id, prizes[prand].count)

doPlayerSendMailByName(getCreatureName(wid), parcel, getPlayerTown(wid))

doPlayerSendTextMessage(wid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough cap. Your prize was sent to the depot.")

end

doPlayerSendTextMessage(wid, MESSAGE_STATUS_CONSOLE_BLUE, "You win "..prizes[prand].count.."x "..getItemNameById(prizes[prand].id)..".")

end

end

broadcastMessage("All the Killers are dead. Protectors won the Regicide Event!")

resetEvent()

elseif isProtector(cid) then

setGlobalStorageValue(kingdom["Protectors"].storage, getGlobalStorageValue(kingdom["Protectors"].storage)-1)

broadcastMessage(""..getCreatureName(cid).." [PROTECTOR] died. "..getGlobalStorageValue(kingdom["Protectors"].storage).." Protectors and "..getGlobalStorageValue(kingdom["Killers"].storage).." Killers left.")

end

setPlayerStorageValue(cid, 51321, -1)

doCreatureSetDropLoot(cid, false)

doPlayerSetLossSkill(cid, 0)

doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)

return true

end

</event>

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

<event type="target" name="KingProtect" event="script">

domodlib('king_func')

function onTarget(cid, target)

if isProtector(cid) and isMonster(target) and getPlayerStorageValue(cid, followstor) ~= 1 and getGlobalStorageValue(51326) == -1 then

local times = 1

local playerpos,playerdir,targetpos = getCreaturePosition(cid), getPlayerLookDir(cid), getCreaturePosition(target)

setPlayerStorageValue(cid, followstor, 1)

addEvent(doCreatureFollow, 1000, cid, target, playerpos, targetpos, times)

doCreatureSetNoMove(target, true)

setGlobalStorageValue(51326, 1)

doCreatureSay(cid, "King, follow me!") return false

elseif isProtector(cid) and isMonster(target) and getPlayerStorageValue(cid, followstor) == 1 then

doCreatureSetNoMove(target, false)

setPlayerStorageValue(cid, followstor, -1)

setGlobalStorageValue(51326, -1)

doCreatureSay(cid, "King, stop following me!") return false

elseif isProtector(cid) and isMonster(target) and getPlayerStorageValue(cid, followstor) ~= 1 and getGlobalStorageValue(51326) == 1 then

doPlayerSendCancel(cid, "Sorry, but the king is already following someone.") return false

end

return true

end

</event>

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

<event type="combat" name="KingCast" event="script">

domodlib('king_func')

function onCombat(cid, target)

if isPlayer(cid) and isMonster(target) then

if isProtector(cid) and string.lower(getCreatureName(target)) == string.lower(king) then

doPlayerSendCancel(cid, "You may not attack the King.") return false

end

end

if isPlayer(cid) and isPlayer(target) then

if isProtector(cid) and isProtector(target) or isKiller(cid) and isKiller(target) then

doPlayerSendCancel(cid, "You may not attack your team mates.") return false

end

end

return true

end

</event>

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

<event type="kill" name="KingKill" event="script">

domodlib('king_func')

function onKill(cid, target)

if isKiller(cid) and isMonster(target) then

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

if isKiller(tid) then

if not doPlayerAddItem(tid, prizes[prand].id, prizes[prand].count) then

local parcel = doCreateItemEx(ITEM_PARCEL)

doAddContainerItem(parcel, prizes[prand].id, prizes[prand].count)

doPlayerSendMailByName(getCreatureName(tid), parcel, getPlayerTown(tid))

doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough cap. Your prize was sent to the depot.")

end

doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_BLUE, "You win "..prizes[prand].count.."x "..getItemNameById(prizes[prand].id)..".")

end

end

broadcastMessage(""..getCreatureName(cid).." killed the King and won the battle for the Killers!")

resetEvent()

end

return true

end</event></mod>

Help's :z

          Procuro Equipe para projeto sério com remuneração, maior necessidade Programador em C\C++.

Link para o post
Compartilhar em outros sites

<mod name="Regicide Event" version="1.0" author="LuckOake" contact="none" enabled="yes">

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

<config name="king_func">

kingdom = {

		["Protectors"] = {

				pos = {x = 32326, y = 33343, z = 7},

				storage = 51322,

		},

		["Killers"] = {

				pos = {x = 32324, y = 33288, z = 7},

				storage = 51323,

		}

}


area1 = {x = 32301, y = 33281, z = 7} -- Ponta de cima na esquerda da área

area2 = {x = 32350, y = 33346, z = 7} -- Ponta de baixo na direita da área

stor = 51320

tp_pos = {x = 32338, y = 32213, z = 7, stackpos = 1} -- Posição do teleport (Não altere o stackpos)

maxplayers = 20 -- Máximo de players (De preferência, coloque um número par)

wall = { -- Positions das paredes de bloqueio (Não altere o stackpos)

		[1] = {x = 32324, y = 33325, z = 7, stackpos = 1},

		[2] = {x = 32325, y = 33325, z = 7, stackpos = 1},

		}

wallid = 1547 -- Id das walls

king = "King" -- Nome do monstro que será o King

kpos = {x = 32324, y = 33290, z = 7} -- Position que o King será criado

prizes = {

[1] = {id = 2149, count = 13},

[2] = {id = 2149, count = 12},

[3] = {id = 2149, count = 11}

}

prand = math.random(1, #prizes)


function doCreatureFollow(cid, target, playerpos, targetpos, times)

		followstor = 51325

		if playerdir ~= getCreatureLookDirection(cid) then

				doCreatureSetLookDirection(target, getCreatureLookDirection(cid))

		end


		if playerpos ~= getCreaturePosition(cid) then

				if playerpos.z == getCreaturePosition(cid).z then

				ntpos = getCreaturePosition(cid)

				local x,y,z = ntpos.x-playerpos.x,ntpos.y-playerpos.y,ntpos.z-playerpos.z

				ntpos = getCreaturePosition(target)

				ntpos.x, ntpos.y, ntpos.z = ntpos.x+x,ntpos.y+y,ntpos.z+z

						if queryTileAddThing(target, ntpos) == RETURNVALUE_NOERROR and getCreaturePosition(cid).z == getCreaturePosition(target).z then

								doMoveCreature(target, getCreatureLookDirection(cid))

						end

				end

		end

		local playerpos, targetpos = getCreaturePosition(cid), getCreaturePosition(target)

		local mf = 1

		local times = mf+1

		if times > 0 and getPlayerStorageValue(cid, followstor) == 1 then

				addEvent(doCreatureFollow, 1, cid, target, playerpos, targetpos, times)

		else

		local times = 0

				doCreatureSetNoMove(target, false)

		end

end


function doCleanMonstersFromArea(toPositionX, fromPositionX, toPositionY, fromPositionY, toPositionZ, fromPositionZ)

local monsters = {}

for x = fromPositionX, toPositionX do

		for y = fromPositionY, toPositionY do

				for z = fromPositionZ, toPositionZ do

						local pos = {x=x,y=y,z=z, stackpos=253}

						if(isMonster(getThingfromPos(pos).uid)) then

								table.insert(isMonster(getThingfromPos(pos).uid) and monsters, getThingfromPos(pos).uid)

						end

				end

		end

end

for i = 1, #monsters do

		doRemoveCreature(monsters[i])

end

return true

end


function isMale(cid)

return getPlayerSex(cid) == 1 and true or false

end


function isFemale(cid)

return getPlayerSex(cid) == 0 and true or false

end


function getNumberType(n)

return n % 2 == 0 and "par" or "impar"

end


function selectPlayerTeam(cid)

		if getNumberType(getGlobalStorageValue(stor)) == "par" then

				doTeleportThing(cid, kingdom["Protectors"].pos)

				setPlayerStorageValue(cid, 51321, 1)

				registerCreatureEvent(cid, "KingProtect")

				registerCreatureEvent(cid, "KingCast")

				setGlobalStorageValue(kingdom["Protectors"].storage, getGlobalStorageValue(kingdom["Protectors"].storage)+1)

				doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You must PROTECT the King. Kill his enemies!")

		if isMale(cid) then

				doSetCreatureOutfit(cid, {lookType = math.random(128,134), lookHead = 88, lookBody = 88, lookLegs = 88, lookFeet = 88}, -1)

		elseif isFemale(cid) then

				doSetCreatureOutfit(cid, {lookType = math.random(136,142), lookHead = 88, lookBody = 88, lookLegs = 88, lookFeet = 88}, -1)

		end

		elseif getNumberType(getGlobalStorageValue(stor)) == "impar" then

				doTeleportThing(cid, kingdom["Killers"].pos)

				setPlayerStorageValue(cid, 51321, 2)

				registerCreatureEvent(cid, "KingKill")

				setGlobalStorageValue(kingdom["Killers"].storage, getGlobalStorageValue(kingdom["Killers"].storage)+1)

				doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You must KILL the King. Crush him!")

		if isMale(cid) then

				doSetCreatureOutfit(cid, {lookType = math.random(128,134), lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94}, -1)

		elseif isFemale(cid) then

				doSetCreatureOutfit(cid, {lookType = math.random(136,142), lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94}, -1)

		end

		end

				setGlobalStorageValue(stor, getGlobalStorageValue(stor)+1)

				registerCreatureEvent(cid, "KingdomLogout")

				registerCreatureEvent(cid, "KingdomDeath")

end


function removeWalls()

		for _, walls in ipairs(wall) do

				doRemoveItem(getThingFromPos(walls).uid, 1)

		end

end


function createWalls()

		for _, walls in ipairs(wall) do

				doCreateItem(wallid, 1, walls)

		end

end


function startEvent()

		doRemoveItem(getThingFromPos(tp_pos).uid, 1)

		doSendMagicEffect(tp_pos, 2)

		doCreateMonster(king, kpos)

		broadcastMessage("Regicide Event started.")

		removeWalls()

end


function resetEvent()

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

				if isInArea(getCreaturePosition(pid), area1, area2) then

						if getPlayerStorageValue(pid, 51325) == 1 then

								setPlayerStorageValue(pid, 51325, -1)

						end

						setPlayerStorageValue(pid, 51321, -1)

						doRemoveCondition(pid, CONDITION_OUTFIT)

						doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))

						setGlobalStorageValue(stor, -1)

						setGlobalStorageValue(51324, -1)

						setGlobalStorageValue(51326, -1)

						setGlobalStorageValue(kingdom["Protectors"].storage, -1)

						setGlobalStorageValue(kingdom["Killers"].storage, -1)

						doCleanMonstersFromArea(area2.x, area1.x, area2.y, area1.y, area2.z, area1.z)

						addEvent(doRemoveCreature, 3000, pid)

				end

		end

						createWalls()

end


function isProtector(cid)

return getPlayerStorageValue(cid, 51321) == 1 and true or false

end


function isKiller(cid)

return getPlayerStorageValue(cid, 51321) == 2 and true or false

end


function openTeleport()

		local tp = 1387

		local tele = doCreateItem(tp, 1, tp_pos)

				setGlobalStorageValue(kingdom["Protectors"].storage, 0)

				setGlobalStorageValue(kingdom["Killers"].storage, 0)

				doItemSetAttribute(tele, "aid", 15781)

				doSendMagicEffect(tp_pos, 10)

				setGlobalStorageValue(51320, 0)

				broadcastMessage("Regicide Event is now open!")

end

</config>

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

<talkaction words="/regicide" access="5" event="buffer">

domodlib('king_func')

		if not param then

				doPlayerSendCancel(cid, "Incorrect params. Choose if the event will 'open', 'force' or 'reset'.") return true

		elseif param == "open" then

				if getGlobalStorageValue(stor) ~= -1 or getGlobalStorageValue(stor) > 0 then

						doPlayerSendCancel(cid, "You can't start the event now.") return true

				end

						openTeleport()

						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've opened the Regicide event.") return true

		elseif param == "force" then

				if getGlobalStorageValue(stor) == -1 or getGlobalStorageValue(51324) >= 1 then

						doPlayerSendCancel(cid, "You can't force the event now.") return true

				end

						setGlobalStorageValue(51324, 1)

						startEvent()

						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've closed the Regicide event.") return true

		elseif param == "reset" then

				if getGlobalStorageValue(stor) == -1 or getGlobalStorageValue(51324) == -1 then

						doPlayerSendCancel(cid, "You can't end the event now.") return true

				end

						resetEvent()

						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've reseted the Regicide event.") return true

		end

return true

</talkaction>

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

<movevent type="StepIn" actionid="15781" event="script">

domodlib('king_func')

function onStepIn(cid, position, fromPosition)

		if getGlobalStorageValue(51320) == (maxplayers-1) then

				setGlobalStorageValue(51324, 1)

				startEvent()

		else

				broadcastMessage(""..getCreatureName(cid).." entered in the Regicide Event. There is "..(maxplayers-(getGlobalStorageValue(stor)+1)).." slots remaining.")

		end

				selectPlayerTeam(cid)

return true

end

</movevent>

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

<event type="logout" name="KingdomLogout" event="script">  

domodlib('king_func')

function onLogout(cid)

		if getPlayerStorageValue(cid, 51321) >= 1 then

				doPlayerSendCancel(cid, "You can't logout when you are in this event!") return false

		end

return true

end

</event>

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

<event type="preparedeath" name="KingdomDeath" event="script">  

domodlib('king_func')

function onPrepareDeath(cid)

		if isKiller(cid) and getGlobalStorageValue(kingdom["Killers"].storage) > 1 then

				setGlobalStorageValue(kingdom["Killers"].storage, getGlobalStorageValue(kingdom["Killers"].storage)-1)

				broadcastMessage(""..getCreatureName(cid).." [KILLER] died. "..getGlobalStorageValue(kingdom["Protectors"].storage).." Protectors and "..getGlobalStorageValue(kingdom["Killers"].storage).." Killers left.")

		elseif isKiller(cid) and getGlobalStorageValue(kingdom["Killers"].storage) == 1 then

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

						if isProtector(wid) then

								if not doPlayerAddItem(wid, prizes[prand].id, prizes[prand].count) then

								local parcel = doCreateItemEx(ITEM_PARCEL)

										doAddContainerItem(parcel, prizes[prand].id, prizes[prand].count)

										doPlayerSendMailByName(getCreatureName(wid), parcel, getPlayerTown(wid))

										doPlayerSendTextMessage(wid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough cap. Your prize was sent to the depot.")

								end

										doPlayerSendTextMessage(wid, MESSAGE_STATUS_CONSOLE_BLUE, "You win "..prizes[prand].count.."x "..getItemNameById(prizes[prand].id)..".")

						end

				end

				broadcastMessage("All the Killers are dead. Protectors won the Regicide Event!")

				resetEvent()

		elseif isProtector(cid) then

				setGlobalStorageValue(kingdom["Protectors"].storage, getGlobalStorageValue(kingdom["Protectors"].storage)-1)

				broadcastMessage(""..getCreatureName(cid).." [PROTECTOR] died. "..getGlobalStorageValue(kingdom["Protectors"].storage).." Protectors and "..getGlobalStorageValue(kingdom["Killers"].storage).." Killers left.")

		end

				setPlayerStorageValue(cid, 51321, -1)

				doCreatureSetDropLoot(cid, false)

				doPlayerSetLossSkill(cid, 0)

				doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)

return true

end

</event>

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

<event type="target" name="KingProtect" event="script">  

domodlib('king_func')

function onTarget(cid, target)

		if isProtector(cid) and isMonster(target) and getPlayerStorageValue(cid, followstor) ~= 1 and getGlobalStorageValue(51326) == -1 then

		local times = 1

		local playerpos,playerdir,targetpos = getCreaturePosition(cid), getPlayerLookDir(cid), getCreaturePosition(target)

				setPlayerStorageValue(cid, followstor, 1)

				addEvent(doCreatureFollow, 1000, cid, target, playerpos, targetpos, times)

				doCreatureSetNoMove(target, true)

				setGlobalStorageValue(51326, 1)

				doCreatureSay(cid, "King, follow me!") return false

		elseif isProtector(cid) and isMonster(target) and getPlayerStorageValue(cid, followstor) == 1 then

				doCreatureSetNoMove(target, false)

				setPlayerStorageValue(cid, followstor, -1)

				setGlobalStorageValue(51326, -1)

				doCreatureSay(cid, "King, stop following me!") return false

		elseif isProtector(cid) and isMonster(target) and getPlayerStorageValue(cid, followstor) ~= 1 and getGlobalStorageValue(51326) == 1 then

				doPlayerSendCancel(cid, "Sorry, but the king is already following someone.") return false

		end

return true

end

</event>

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

<event type="combat" name="KingCast" event="script">  

domodlib('king_func')

function onCombat(cid, target)

		if isPlayer(cid) and isMonster(target) then

				if isProtector(cid) and string.lower(getCreatureName(target)) == string.lower(king) then

						doPlayerSendCancel(cid, "You may not attack the King.") return false

				end

		end

		if isPlayer(cid) and isPlayer(target) then

				if isProtector(cid) and isProtector(target) or isKiller(cid) and isKiller(target) then

						doPlayerSendCancel(cid, "You may not attack your team mates.") return false

				end

		end

return true

end

</event>

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

<event type="kill" name="KingKill" event="script">

domodlib('king_func')

function onKill(cid, target)

		if isKiller(cid) and isMonster(target) then

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

						if isKiller(tid) then

								if not doPlayerAddItem(tid, prizes[prand].id, prizes[prand].count) then

								local parcel = doCreateItemEx(ITEM_PARCEL)

										doAddContainerItem(parcel, prizes[prand].id, prizes[prand].count)

										doPlayerSendMailByName(getCreatureName(tid), parcel, getPlayerTown(tid))

										doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough cap. Your prize was sent to the depot.")

								end

										doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_BLUE, "You win "..prizes[prand].count.."x "..getItemNameById(prizes[prand].id)..".")

						end

				end

						broadcastMessage(""..getCreatureName(cid).." killed the King and won the battle for the Killers!")

						resetEvent()

		end

return true

end</event></mod>

Link para o post
Compartilhar em outros sites

C Quer dizer trocar isso aqui

function openTeleport()

local tp = 1387

local tele = doCreateItem(tp, 1, tp_pos)

setGlobalStorageValue(kingdom["Protectors"].storage, 0)

setGlobalStorageValue(kingdom["Killers"].storage, 0)

doItemSetAttribute(tele, "aid", 15781)

doSendMagicEffect(tp_pos, 10)

setGlobalStorageValue(51320, 0)

broadcastMessage("Regicide Event is now open!")

end

</config>

Por Esse q tu passou eh ?

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

          Procuro Equipe para projeto sério com remuneração, maior necessidade Programador em C\C++.

Link para o post
Compartilhar em outros sites

Vlw :) Funciono, não como eu esperava k mais tá susse rep+ E pode mover pra resolvidos '-'

          Procuro Equipe para projeto sério com remuneração, maior necessidade Programador em C\C++.

Link para o post
Compartilhar em outros sites
  • 5 years later...

qual o segredo pra conserta esses erros ??

 

Error - LuaInterface::loadFile] data/talkactions/scripts/removepoints.lua:2: '<name>' expected near '�'
[23:47:49.223] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/removepoints.lua)
[23:47:49.223] data/talkactions/scripts/removepoints.lua:2: '<name>' expected near '�'
[23:47:49.238] [Error - LuaInterface::loadFile] cannot open data/talkactions/scripts/systempoints.lua: No such file or directory
[23:47:49.238] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/systempoints.lua)

 

Link para o post
Compartilhar em outros sites
  • Moderador

@BilauX Me manda o script removepoints pra mim tentar resolver ele, sobre o outro script systempoints, o arquivo XML não estar encontrando o systempoints.lua. Tenta fazer assim no systempoints.

Em talkactions.xml executa essa tag nele

<talkaction words="/teste" event="script" value="systempoints.lua"/>
caso for somente para alguém com acesso usar esse comando basta adicionar o access="4" ficando assim
<talkaction log="yes" access="4" words="/teste"  event="script" value="systempoints.lua"/>

E no arquivo systempoints que já existe na sua basta talkactions/scripts renomeia para systempoints

Meu Curso sobre Programação para OTServer

Programando OTServer

 

Peça o seu script! Entre agora mesmo no grupo

Developing

 

Conteúdos:

 

Discord: Belmont#7352

Não esqueça do REP+ :)     

Link para o post
Compartilhar em outros sites

 

já resolvi já, obrigado

26 minutos atrás, Phineasz disse:

@BilauX Me manda o script removepoints pra mim tentar resolver ele, sobre o outro script systempoints, o arquivo XML não estar encontrando o systempoints.lua. Tenta fazer assim no systempoints.

Em talkactions.xml executa essa tag nele


<talkaction words="/teste" event="script" value="systempoints.lua"/>
caso for somente para alguém com acesso usar esse comando basta adicionar o access="4" ficando assim
<talkaction log="yes" access="4" words="/teste"  event="script" value="systempoints.lua"/>

E no arquivo systempoints que já existe na sua basta talkactions/scripts renomeia para systempoints

 

 

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.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo