• 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!

GlobalEvent Last Man Standing Event

bodycarcoo11

Mapper
Joined
Apr 26, 2011
Messages
213
Reaction score
9
Location
USA
So here's the rules. You need to reconfigure your config, then config.minPlayers players must stand in area of event and they'll be teleported to the battle arena. The last one that survives wins the prize (configurable). Enjoy.
/globalevents/scripts/arena.lua
Lua Code:
Code:
local config = {
	temporaryArea = {
		{x = 296, y = 298, z = 7}, -- northwest corner of area where players must stand in order to join the event
		{x = 296, y = 297, z = 7} -- south east corner
	},
	arenaArea = {
		{x = 139, y = 138, z = 6}, -- nw corner of arena
		{x =137 , y = 140, z = 6}, -- se corner of arena
		{x = 138, y = 140, z = 6} -- center of arena
	},
	minPlayers = 2, -- in players required to start the battle
	prize = {2157, 5467} -- rewards
}
 
function onThink(interval, lastExecution, thinkInterval)
	local players, arenaPlayers = {}, {}
	for x = (config.temporaryArea)[1].x, (config.temporaryArea)[2].x do
		for y = (config.temporaryArea)[1].y, (config.temporaryArea)[2].y do
			for z = (config.temporaryArea)[1].z, (config.temporaryArea)[2].z do
				if(isPlayer(getTopCreature({x = x, y = y, z = z}).uid)) then
					table.insert(players, getTopCreature({x = x, y = y, z = z}).uid)
				end
			end
		end
	end
	for x = (config.arenaArea)[1].x, (config.arenaArea)[2].x do
		for y = (config.arenaArea)[1].y, (config.arenaArea)[2].y do
			for z = (config.arenaArea)[1].z, (config.arenaArea)[2].z do
				if(isPlayer(getTopCreature({x = x, y = y, z = z}).uid)) then
					table.insert(arenaPlayers, getTopCreature({x = x, y = y, z = z}).uid)
				end
			end
		end
	end
	if(table.maxn(arenaPlayers) == 1) then
		doTeleportThing(arenaPlayers[1], getPlayerMasterPos(arenaPlayers[1]))
		doSendMagicEffect(getPlayerMasterPos(arenaPlayers[1]), CONST_ME_TELEPORT)
		doPlayerSendTextMessage(arenaPlayers[1], MESSAGE_STATUS_CONSOLE_BLUE, "You win a battle and recived your reward.")
		doPlayerAddItem(arenaPlayers[1], (config.prize)[math.random(1, table.maxn(config.prize))], 1)
	elseif(table.maxn(arenaPlayers) < 1) then
		if(table.maxn(players) >= config.minPlayers) then
			for i = 1, config.minPlayers do
				doTeleportThing(players[i], (config.arenaArea)[3])
				doSendMagicEffect((config.arenaArea)[3], CONST_ME_TELEPORT)
				doPlayerSendTextMessage(players[i], MESSAGE_STATUS_WARNING, "The battle begins. Survive for glory!")
			end
		end
	end
	return true
end
/globalevents/globalevents.xml
XML Code:
Code:
<globalevent name="arena" interval="10" event="script" value="arena.lua"/>
And This IS The Aena Of The Last Man Standing :) Enjoy
Example map:
http://speedy*****malware.localhost/FRpyc/DopeNiggah.otbm
If You Like REP++
After All Of That You Will NEeD The Script Of Talkaction
enter this in data/talkactions/talkactions/xml
XML Code:
Code:
<talkaction log="yes" words="/lms start" access="6" event="script"
value="lms on.lua"/>
And Put This In data/talkactions/scripts/lms on.lua
LUA Code:
Code:
function onSay(cid, words, param, channel)
	if(getStorage(ZE_STATUS) ~= 2) then
		local players_on_arena_count = #getLastmanstandingEventPlayers()
		if(param == 'force') then
			if(players_on_arena_count > 0) then
				setlastmanstandingEventPlayersLimit(players_on_arena_count  )
				addlastmanstandingEventBlockEnterPosition()
				doSetStorage(ZE_STATUS, 2)
				doBroadcastMessage("lastmanstanding Event started.")
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "lastmanstanding event started.")
			else
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot start lastmanstanding event. There is no players on arena.")
			end
		else
			if(param ~= '' and tonumber(param) > 0) then
				setlastmanstandingEventPlayersLimit(tonumber(param))
			end
			removelastmanstandingEventBlockEnterPosition()
			doSetStorage(ZE_STATUS, 1)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Event started.")
			doPlayerBroadcastMessage(cid, "lastmanstanding Arena Event teleport is opened. We are waiting for " .. getlastmanstandingEventPlayersLimit() - players_on_arena_count .. " players to start.")
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "lastmanstanding event is already running.")
	end
	return true
end
EnJoy
 
Last edited:
Bro its already released and please give credits to the Teckman !!

And to PhoOwned for the talkaction :)
 
Last edited:
LoL
I Made The TalkAction without help put i took the script and the talkaction i made it with my self
 
It doesnt work, when i write /lms start nothing happen :S
 
Tonks you just flam at everything i bet all your posts are about scammer's so dont talk rubbish when your probably a copy and paster your self -.-
 
Back
Top