• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

6 players needed to pull a lever..

Joined
Jun 19, 2009
Messages
1,852
Reaction score
5
Hello!

I need a script;

you must be at least 6 players in order to pull a lever, and those 6 players needs to stand on those tiles (like anni):

20100523231929.png


and all of those players must be at least xxx lvl, also, when pulling the lever; 50 crystal coins will be removed :P

thanks!

edit: lol, forgot the most important thing

When the lever is pulled, a stone gets removed from a specific position. thanks!

edit2:

I got this script from Cykotitan but it doesn't work for some reason... no errors in console or anything.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="idk" enabled="yes">
    <action uniqueid="64317" event="script"><![CDATA[
        local playerPosition = {
          {x = 1144, y = 850, z = 5},
          {x = 1144, y = 851, z = 5},
          {x = 1144, y = 852, z = 5},
          {x = 1144, y = 853, z = 5},
          {x = 1144, y = 854, z = 5},
          {x = 1144, y = 855, z = 5}
        }
        local players = {}
        if item.itemid == 1945 then
            for _, pos in ipairs(playerPosition) do
                local c = getTopCreature(pos).uid
                if c > 0 and isPlayer(c) then table.insert(players, c) end
            end
            if #players == 6 then
                local stone, stonePos = 1304, {x = 1141, y = 856, z = 5}
                local it = getTileItemById(stonePos, stone).uid
                if it < 1 then
                    return doPlayerSendCancel(cid, "No stone to remove.")
                end
                for _, v in ipairs(players) do
                    if getPlayerItemCount(v, 155) < 100 or getPlayerLevel(v) < 150 then
                        for _, pid in ipairs(players) do
                            doPlayerSendCancel(pid, getPlayerName(v) .. (getPlayerLevel(v) >= 150 and " doesn't have enough money." or " isn't level 150."))
                        end
                        return true
                    end    
                end
                for _, v in ipairs(players) do
                    doPlayerRemoveItem(v, 155, 100)
                    doPlayerSendTextMessage(v, MESSAGE_STATUS_CONSOLE_ORANGE, "You have removed the wall, but it costed you a lot of money!")
                end
                doRemoveItem(it)
            else
                return doPlayerSendCancel(#players > 0 and players[1] or cid, "You need to be at least 6 persons to pass the wall.")
            end
        end
        return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
    ]]></action>
</mod>

thanks!
 
Last edited:
LUA:
function onUse(cid, item, frompos, item2, topos)
player1pos = {x=frompos.x+1, y=frompos.y, z=frompos.z, stackpos=253}
player1 = getThingfromPos(player1pos)

player2pos = {x=frompos.x+1, y=frompos.y-1, z=frompos.z, stackpos=253}
player2 = getThingfromPos(player2pos)

player3pos = {x=frompos.x+1, y=frompos.y-2, z=frompos.z, stackpos=253}
player3 = getThingfromPos(player3pos)

player4pos = {x=frompos.x+1, y=frompos.y-3, z=frompos.z, stackpos=253}
player4 = getThingfromPos(player4pos)
		
player5pos = {x=frompos.x+1, y=frompos.y-4, z=frompos.z, stackpos=253}
player5 = getThingfromPos(player5pos)
		
player6pos = {x=frompos.x+1, y=frompos.y-5, z=frompos.z, stackpos=253}
player6 = getThingfromPos(player6pos)


	 if (player1.itemid > 0 and player2.itemid > 0 and player3.itemid > 0 and player4.itemid > 0 and player5.itemid > 0 and player6.itemid > 0) then

  player1level = getPlayerLevel(player1.uid)
  player2level = getPlayerLevel(player2.uid)
  player3level = getPlayerLevel(player3.uid)
  player4level = getPlayerLevel(player4.uid)
  player4level = getPlayerLevel(player5.uid)
  player4level = getPlayerLevel(player6.uid)

  questlevel = 100

	if (player1level >= questlevel and player2level >= questlevel and player3level >= questlevel and player4level >= questlevel and player5level >= questlevel and player6level >= questlevel) then
		if (doPlayerRemoveMoney(player1.uid,500000) and (doPlayerRemoveMoney(player2.uid,500000) and (doPlayerRemoveMoney(player3.uid,500000) and (doPlayerRemoveMoney(player4.uid,500000) and (doPlayerRemoveMoney(player5.uid,500000) and (doPlayerRemoveMoney(player6.uid,500000)) == TRUE then
		stonepos = {x=xxxx, y=yyy, z=z, stackpos=1} -- write ur stone posiotion
		stone = getThingFromPos(stonepos)
			if stone.itemid ~= [id of your stone] then
			doRemoveItem(stone.uid, 1)
			else
			doPlayerSendCancel(cid,"Sorry, not possible.")
			end
		else
		doPlayerSendCancel(cid,"All players in your team have to have 50cc.")
		end
	else
	doPlayerSendCancel(cid,"All players have to have at least " .. questlevel .. ".")
	end
 end
end
end
end
end
end
end
Edited anihi script. Set stone position and lvl.
If want I can add code to create this stone after xx minutes :D
 
Last edited:
Code:
local t = {
	oldPosition = {
		{x = 100, y = 200, z = 7},
		{x = 100, y = 200, z = 7},
		{x = 100, y = 200, z = 7},
		{x = 100, y = 200, z = 7},
		{x = 100, y = 200, z = 7},
		{x = 100, y = 200, z = 7}
	},
	newPosition = {
		{x = 100, y = 200, z = 7},
		{x = 100, y = 200, z = 7},
		{x = 100, y = 200, z = 7},
		{x = 100, y = 200, z = 7},
		{x = 100, y = 200, z = 7},
		{x = 100, y = 200, z = 7}
	}
}
local players = {}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 or item.itemid == 1946 then
		for _, pos in ipairs(t.oldPosition) do
			local c = getTopCreature(pos).uid
			if c > 0 and isPlayer(c) then
				table.insert(players, c)
			end
		end
		if #players == 6 then
			for i, v in ipairs(players) do
				if getPlayerLevel(v) >= 100 then -- change to whatever you want
					doSendMagicEffect(t.oldPosition[i], CONST_ME_POFF)
					doTeleportThing(v, t.newPosition[i], true)
					doSendMagicEffect(t.newPosition[i], CONST_ME_TELEPORT)
				else
					doPlayerSendCancel(v, "You dont have enough level.")
					break
				end
			end
		else
			return doPlayerSendCancel(#players > 0 and players[1] or cid, "You need atleast 6 players to enter.")
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
Last edited:
Code:
local playerPosition = {
	{x = 100, y = 200, z = 7},
	{x = 100, y = 200, z = 7},
	{x = 100, y = 200, z = 7},
	{x = 100, y = 200, z = 7},
	{x = 100, y = 200, z = 7},
	{x = 100, y = 200, z = 7}
}
local players = {}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 or item.itemid == 1946 then
		for _, pos in ipairs(playerPosition) do
			local c = getTopCreature(pos).uid
			if c > 0 and isPlayer(c) then table.insert(players, c) end
		end
		if #players == 6 then
			local stone, stonePos = 1000, {x = 100, y = 200, z = 7}
			local it = getTileItemById(stonePos, stone).uid
			if it > 0 then
				doRemoveItem(it)
			else
				return doPlayerSendCancel(#players > 0 and players[1] or cid, "No stone to remove.")
			end
		else
			return doPlayerSendCancel(#players > 0 and players[1] or cid, "You need atleast 6 players to remove the stone.")
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
@Existence
2 things xD

you don't have to write if c>0 or it>0. It look kinda newbish

Write instead
LUA:
if (it) then

or

if (c and isPlayer(c)) then

As far as i think getTopCreature(pos)/getTileItemById returns '0' (false) if thing doesn't exist there.

And you should add also removing money, but wait. first Check if everybody has it, and later (if everybody do) remove it. (Wesoly screw it up, cuz it is taking money immendially instead looking if everybody has it).
 
with getTileItemById you must make a check if its their either way you use doTileQueryAdd or queryTileAdd.. or it will raise an error
 
Back
Top