• 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 anni lever

WSouls

New Member
Joined
Aug 5, 2010
Messages
51
Reaction score
1
Code:
local playerPosition =
{
	{x = 266, y = 673, z = 12, stackpos = STACKPOS_TOP_CREATURE},
	{x = 266, y = 672, z = 12, stackpos = STACKPOS_TOP_CREATURE},
	{x = 266, y = 671, z = 12, stackpos = STACKPOS_TOP_CREATURE},
	{x = 266, y = 670, z = 12, stackpos = STACKPOS_TOP_CREATURE}
}

local newPosition =
{
	{x = 189, y = 650, z = 13},
 	{x = 189, y = 651, z = 13},
	{x = 189, y = 652, z = 13},
	{x = 189, y = 653, z = 13}
}

-- Do not modify the declaration lines below.
local player = {0, 0, 0, 0}
[COLOR="red"]local passed = 0[/COLOR]

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		for i = 1, 4 do
			player[i] = getThingfromPos(playerPosition[i])
			if player[i].itemid > 0 then
				if isPlayer(player[i].uid) == TRUE then
					[COLOR="red"]if getPlayerLevel(player[i].uid) >= 100 then
						passed = passed + getPlayerStorageValue(player[i].uid, 5026)
					end
				end
			end
			if passed ~= 4 or passed ~= -4 then[/COLOR]
				doPlayerSendCancel(cid, "Sorry, not possible.")
				return TRUE
			end
		end
		for i = 1, 4 do
			doSendMagicEffect(playerPosition[i], CONST_ME_POFF)
			doTeleportThing(player[i].uid, newPosition[i], FALSE)
			doSendMagicEffect(newPosition[i], CONST_ME_ENERGYAREA)
		end
		doTransformItem(item.uid, item.itemid + 1)
	elseif item.itemid == 1946 then
		doTransformItem(item.uid, item.itemid - 1)
	end
	return TRUE
end

this is my code for anni that i tried editing. i only want the lever to work if EVERYONE on the team DIDNT complete anni OR everyone DID.
ex. 2ppl completed anni 2 ppl didnt. the lever wont work
ex. 4ppl didnt do anni the lever will work
ex. 4ppl did complete anni the lever will work

the red is were i made changes.
 
Last edited:
Lua:
local playerPosition = {
	{x = 266, y = 673, z = 12},
	{x = 266, y = 672, z = 12},
	{x = 266, y = 671, z = 12},
	{x = 266, y = 670, z = 12}
}

local newPosition = {
	{x = 189, y = 650, z = 13},
 	{x = 189, y = 651, z = 13},
	{x = 189, y = 652, z = 13},
	{x = 189, y = 653, z = 13}
}

-- Do not modify the declaration lines below.
local player = {0, 0, 0, 0}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		local passed = 0
		for i = 1, 4 do
			player[i] = getTopCreature(playerPosition[i]).uid
			if isPlayer(player[i]) and getPlayerLevel(player[i]) >= 100 then
				passed = passed + getPlayerStorageValue(player[i], 5026)
			end
		end
		if passed ~= 4 or passed ~= -4 then
			return doPlayerSendCancel(cid, "Sorry, not possible.")
		end
		for i = 1, 4 do
			doSendMagicEffect(playerPosition[i], CONST_ME_POFF)
			doTeleportThing(player[i], newPosition[i])
			doSendMagicEffect(newPosition[i], CONST_ME_ENERGYAREA)
		end
		doTransformItem(item.uid, item.itemid + 1)
	elseif item.itemid == 1946 then
		doTransformItem(item.uid, item.itemid - 1)
	end
	return true
end
 
Back
Top