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

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:
this what u need?
Code:
local players = {
	{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 stoneID, stonePosition = 12345, {x = 100, y = 200, z = 7}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local playersList = {}
	if item.itemid == 1945 then
		return doTransformItem(item.uid, 1946)
	end
	for _, pos in ipairs(players) do
		local creature = getTopCreature(pos).uid
		if isPlayer(creature) then
			table.insert(playersList, creature)
		end
	end
	if #playersList < 6 then
		return doPlayerSendTextMessage(#players > 0 and players[1] or cid, "You need atleast 6 players to remove the stone.")
	elseif #players == 6 then
		local success
		local stone = getTileItemById(stonePos, stoneID).uid
		if stone > 0 then
			for _, pid in ipairs(playersList) do
				if getPlayerItemCount(pid, 2160) >= 50 and getPlayerLevel(pid) >= 100 then
					doPlayerRemoveItem(pid, 2160, 50)
					success = true
				else
					return doPlayerSendTextMessage(pid, 27, "You dont have enough " .. (getPlayerItemCount(pid, 2160) < 50 and "money" or "level") .. ".")
				end
			end
			if success then
				doRemoveItem(stone)
			end
		end
	end
	return doTransformItem(item.uid, 1945)
end
 
Last edited:
ok this works and tested on tfs 0.3.5+ :
in action.xml place that:
Code:
<action actionid="XXXX" event="script" value="other/XXXX.lua"/>
In actionid that is needed to put on the lever,and the other XXXX is for lua name
go make new lua in action-->other-->
Lua:
local config = {
   
	leverid = 1304,    -- the lever id
	money = 10,     --money needed for using switch
	level = 8,     --lever for using switch
        entry =    ---put the 6 position player will step on here
	{
		{x = 988, y = 1018, z = 7},
		{x = 988, y = 1019, z = 7},
		{x = 988, y = 1018, z = 7},
		{x = 988, y = 1019, z = 7},
		{x = 988, y = 1018, z = 7},
		{x = 988, y = 1019, z = 7}
         }
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
 local stonepos = getThingFromPos({x = 990, y = 1021, z = 7, stackpos = 1})     --- place of stone
local players = {}
        for _, position in ipairs(config.entry) do
		local pid = getTopCreature(position).uid
		if(pid == 0 or not isPlayer(pid)) then
			doPlayerSendCancel(cid, "6 players should stand on tiels")
			return true
		end
		if (getPlayerLevel(pid) < config.level) then
		   doPlayerSendCancel(cid, "All team should be lvl "..level..".")
		   return true
		   end
		if (getPlayerMoney(pid) < config.money) then
		   doPlayerSendCancel(cid, "All of you must have "..config.money.." gp.")
		   return true
		   end

		table.insert(players, pid)
	end

	   if item.itemid == 1945 then
	    if (stonepos.uid ~= 0 and stonepos.itemid == config.leverid) then
		   doRemoveItem(stonepos.uid, 1)
		   doCreatureSay(cid,"Stone was moved.",TALKTYPE_ORANGE_1)
	       doTransformItem(item.uid, 1946)
		   for i, pid in ipairs(players) do
	          doPlayerRemoveMoney(pid,config.money)
		   end

	   else
		   doPlayerSendCancel(cid,"Stone already moved")
	    end
	  elseif item.itemid == 1946 then
	    	    if (stonepos.uid ~= 0 and stonepos.itemid == config.leverid) then
		   doRemoveItem(stonepos.uid, 1)
		   doCreatureSay(cid,"Stone was moved.",TALKTYPE_ORANGE_1)
	       doTransformItem(item.uid, 1945)
		   for i, pid in ipairs(players) do
	          doPlayerRemoveMoney(pid,config.money)
		   end

	   else
		   doPlayerSendCancel(cid,"Stone already moved")
	    end
      end
	  return true
end
 
Last edited:
this what u need?
Code:
local players = {
    {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 stoneID, stonePosition = 12345, {x = 100, y = 200, z = 7}

[COLOR=Red]local playersList = {}[/COLOR]
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.itemid == 1945 then
        return doTransformItem(item.uid, 1946)
    end
    for _, pos in ipairs(players) do
        local creature = getTopCreature(pos).uid
        if isPlayer(creature) then
            table.insert(playersList, creature)
        end
    end
    if #playersList < 6 then
        return doPlayerSendTextMessage(#players > 0 and players[1] or cid, "You need atleast 6 players to remove the stone.")
    elseif #players == 6 then
        local success
        local stone = getTileItemById(stonePos, stoneID).uid
        if stone > 0 then
            for _, pid in ipairs(playersList) do
                if getPlayerItemCount(pid, 2160) >= 50 then
                    [COLOR=Red]doPlayerRemoveItem(pid, 2160, 50)[/COLOR]
                    success = true
                else
                    return doPlayerSendTextMessage(pid, 27, "You dont have enough money.")
                end
                if getPlayerLevel(pid) < 100 then
                    return doPlayerSendTextMessage(pid, 27, "You dont have enough level.")
                end
            end
            if success then
                doRemoveItem(stone)
            end
        end
    end
    return doTransformItem(item.uid, 1945)
end

1- should be inside the function, else it will keep growing and growing in each use.
2- the remove part should be after you check every player, else if player 6 does not have the items, you will fuck 5 players removing their items.
 
Back
Top