• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Request] Whenever the lever is used, a broadcast message will appear.

mikkas70

Owner and Developer of omegaservers.org
Joined
Jan 6, 2009
Messages
42
Reaction score
8
Protocol: 8.6

As the title says, I'd like to know if there is any script that will be something like this:
1-Pull a lever that has a unique ID
2-An instant message will appear for everyone saying : "The battle has begun. Fight with honor and be the last man standing!"


If this helps, here it is my lever script:
local arenas = {
[7667] = {
fromPos ={
{x = 1005, y = 995, z = 10}, --player 1 start pos
{x = 1006, y = 995, z = 10}, --player 2 start pos
{x = 1007, y = 995, z = 10}, --player 3 start pos
{x = 1008, y = 995, z = 10}, --player 3 start pos
},
toPos = {
{x = 1008, y = 995, z = 10}, --player 1 teleport position
{x = 1009, y = 995, z = 10}, --player 2 teleport position
{x = 1010, y = 995, z = 10}, --player 3 teleport position
{x = 1011, y = 995, z = 10} --player 3 teleport position
}
}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 1946) then
doTransformItem(item.uid, 1945)
return TRUE
end

local arena = arenas[item.uid]
if(not arena) then
return FALSE
end

local players = {}
for _, pos in pairs(arena.fromPos) do
pos.stackpos = STACKPOS_TOP_CREATURE
local tmp = getThingfromPos(pos).uid
if(tmp > 0 and isCreature(tmp) == TRUE) then
table.insert(players, tmp)
end
end

if(table.maxn(players) < table.maxn(arena.fromPos)) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need more creatures for duel.")
return TRUE
end

for i, pid in pairs(players) do
doSendMagicEffect(arena.fromPos, CONST_ME_POFF)
doTeleportThing(pid, arena.toPos)
doSendMagicEffect(arena.toPos, CONST_ME_TELEPORT)
doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, "FIGHT!")
end

return TRUE
end

Thanks!
 
try this
Lua:
function onUse(cid, item, frompos, item2, topos)
if item.itemid == 1946 then
doCreatureSay(cid, "The battle has begun. Fight with honor and be the last man standing!", 1)
end
return 1
end
 
Lua:
local arenas = {
	[7667] = {
		fromPos ={
			{x = 1005, y = 995, z = 10}, --player 1 start pos
			{x = 1006, y = 995, z = 10}, --player 2 start pos
			{x = 1007, y = 995, z = 10}, --player 3 start pos
			{x = 1008, y = 995, z = 10}, --player 3 start pos
		},
		toPos = {
			{x = 1008, y = 995, z = 10}, --player 1 teleport position
			{x = 1009, y = 995, z = 10}, --player 2 teleport position
			{x = 1010, y = 995, z = 10}, --player 3 teleport position
			{x = 1011, y = 995, z = 10} --player 3 teleport position
		}
	}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 1946) then
		doTransformItem(item.uid, 1945)
	return true
end

local arena = arenas[item.uid]
	if(not arena) then
	return false
end

local players = {}
for _, pos in pairs(arena.fromPos) do
	pos.stackpos = STACKPOS_TOP_CREATURE
	local tmp = getThingfromPos(pos).uid
		if(tmp > 0 and isCreature(tmp) == TRUE) then
		table.insert(players, tmp)
	end
end

if(table.maxn(players) < table.maxn(arena.fromPos)) then
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need more creatures for duel.")
	return true
end

for i, pid in pairs(players) do
	doSendMagicEffect(arena.fromPos[i], CONST_ME_POFF)
	doTeleportThing(pid, arena.toPos[i])
	doSendMagicEffect(arena.toPos[i], CONST_ME_TELEPORT)
	doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, "FIGHT!")
end
doBroadcastMessage('The battle between '..getPlayerName(pid[1])..' - '..getPlayerName(pid[2])..' - '..getPlayerName(pid[3])..' - '..getPlayerName(pid[4])..' has begun.\nFight with honor and be the last man standing!')
return true
end

This should broadcast the player names entering the arena.
If something is off post the error please.
 
Lua:
local arenas = {
	[7667] = {
		fromPos ={
			{x = 1005, y = 995, z = 10}, --player 1 start pos
			{x = 1006, y = 995, z = 10}, --player 2 start pos
			{x = 1007, y = 995, z = 10}, --player 3 start pos
			{x = 1008, y = 995, z = 10}, --player 3 start pos
		},
		toPos = {
			{x = 1008, y = 995, z = 10}, --player 1 teleport position
			{x = 1009, y = 995, z = 10}, --player 2 teleport position
			{x = 1010, y = 995, z = 10}, --player 3 teleport position
			{x = 1011, y = 995, z = 10} --player 3 teleport position
		}
	}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 1946) then
		doTransformItem(item.uid, 1945)
	return true
end

local arena = arenas[item.uid]
	if(not arena) then
	return false
end

local players = {}
for _, pos in pairs(arena.fromPos) do
	pos.stackpos = STACKPOS_TOP_CREATURE
	local tmp = getThingfromPos(pos).uid
		if(tmp > 0 and isCreature(tmp) == TRUE) then
		table.insert(players, tmp)
	end
end

if(table.maxn(players) < table.maxn(arena.fromPos)) then
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need more creatures for duel.")
	return true
end

for i, pid in pairs(players) do
	doSendMagicEffect(arena.fromPos[i], CONST_ME_POFF)
	doTeleportThing(pid, arena.toPos[i])
	doSendMagicEffect(arena.toPos[i], CONST_ME_TELEPORT)
	doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, "FIGHT!")
end
doBroadcastMessage('The battle between '..getPlayerName(pid[1])..' - '..getPlayerName(pid[2])..' - '..getPlayerName(pid[3])..' - '..getPlayerName(pid[4])..' has begun.\nFight with honor and be the last man standing!')
return true
end

This should broadcast the player names entering the arena.
If something is off post the error please.

Script not workin' man :S
 
Posting ERRORS would make a scripters work SO FREAKING EASY!

Change the old "doBroadcastMessage" to
Lua:
doBroadcastMessage('The battle has begun.\nFight with honor and be the last man standing!')

.. and post errors if the script doesn't work properly...
 
Back
Top