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

Lua PVP Arena -- bug

Gothric

New Member
Joined
Feb 6, 2010
Messages
264
Reaction score
1
on my server i have pvp arena .. its mean 6 ppl stay on the position and it tp em on arena where they can spam ue , exori everything but they dont loss exp ;)

its all ok but i want to set up time of fight = 3 min propably

i dont know how :/ when i test my scripts it work but when i was on 6 mc on arena it doesnt tp me out :S they stay there always :S

there are my scripts
actions:
PHP:
start_pos_uid = 56001
team1_members = 3
team2_members = 3
fight_time = 3 -- 3 minutes

function onUse(cid, item, frompos, item2, topos)
	if(getGlobalStorageValue(56000) < 1) then
		players_number = 0
		for i = start_pos_uid, start_pos_uid+team1_members-1 do
			if(isPlayer(getTopCreature(getThingPos(i)).uid) == TRUE) then
				players_number = players_number + 1
			end
		end
		for i = start_pos_uid+10, start_pos_uid+10+team2_members-1 do
			if(isPlayer(getTopCreature(getThingPos(i)).uid) == TRUE) then
				players_number = players_number + 1
			end
		end
		if(players_number ~= team1_members + team2_members) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, team1_members + team2_members .. " players needed. Only " .. players_number .. " on start positions.")
			return false
		end
		setGlobalStorageValue(56000, os.time() + fight_time * 60)
		for i = start_pos_uid, start_pos_uid+team1_members-1 do
			startPos = getThingPos(i)
			spawnPos = getThingPos(i+20)
			player = getTopCreature(startPos).uid
			setPlayerStorageValue(player, 56000, i)
			setGlobalStorageValue(i, player)
			doTeleportThing(player, spawnPos, TRUE)
		end
		for i = start_pos_uid+10, start_pos_uid+10+team2_members-1 do
			startPos = getThingPos(i)
			spawnPos = getThingPos(i+20)
			player = getTopCreature(startPos).uid
			setPlayerStorageValue(player, 56000, i)
			setGlobalStorageValue(i, player)
			doTeleportThing(player, spawnPos, TRUE)
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "PvP arena in use. Please wait.")
		return false
	end
	return true
end

creaturescripts
PHP:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	storage = getPlayerStorageValue(cid, 56000)
	if(storage > 0 and getGlobalStorageValue(storage) == cid) then -- is on arena
		addEvent(doCreatureAddHealth, 100,cid, getCreatureMaxHealth(cid))
		removeConditions(cid)
		doTeleportThing(cid, {x=1066,y=1244,z=6}, TRUE)
		local newPos = getThingPos(storage+20)
		doTeleportThing(cid, newPos, TRUE)
		removeConditions(cid)
		if(storage >= 56001 and storage <= 56010) then
			setGlobalStorageValue(56042, getGlobalStorageValue(56042)+1)
		else
			setGlobalStorageValue(56041, getGlobalStorageValue(56041)+1)
		end
		return false
	end
	return true
end


globalevents
PHP:
function onThink(interval, lastExecution)
	if(getGlobalStorageValue(56000) == -1) then
		for i = 56000, 56020 do
			setGlobalStorageValue(i, 0)
		end
		setGlobalStorageValue(56041, 0)
		setGlobalStorageValue(56042, 0)
	end
	if(getGlobalStorageValue(56000) > 0 and getGlobalStorageValue(56000) < os.time()) then
		score = "Team 1 - " .. getGlobalStorageValue(56041) .. " : " .. getGlobalStorageValue(56042) .. " - Team 2"
		for i = 56001, 56020 do
			if(isPlayer(getGlobalStorageValue(i)) == TRUE) then
				doPlayerSendTextMessage(getGlobalStorageValue(i), MESSAGE_STATUS_CONSOLE_ORANGE, score)
				setPlayerStorageValue(getGlobalStorageValue(i), 56000, 0)
				doTeleportThing(getGlobalStorageValue(i), {x=1099, y=1229, z=9}, TRUE)
				removeConditions(getGlobalStorageValue(i))
			end
			setGlobalStorageValue(i, 0)
		end
		setGlobalStorageValue(56000, 0)
		setGlobalStorageValue(56041, 0)
		setGlobalStorageValue(56042, 0)
	end
	return true
end
 
Back
Top