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

Lever Teleport 3 players with storage

merfus

Member
Joined
Dec 27, 2011
Messages
214
Reaction score
5
Location
Poland
Hello guys, can anyone do for me script?.
How it should work.

Players must stand on 3 Pos, after that 1 player must pull lever, and they 3 players get TP to new Pos.
BUT Players can be teleported only if ALL 3 players get storage example:
Lua:
if getPlayerStorageValue(cid, 2100) == 5 then

It's something like annihilator teleport? When 4 players get teleported, but here i need to teleport 3 players and ALL must have assigned proper storage.

Can anyone help me?
You can do randomize pos etc. i can change it by myself ;p
 
This should maybe work. Haven't tested.
Lua:
 local room = { -- room with dragons
			fromX = 1200,
			fromY = 1030,
			fromZ = 7,
 
			toX = 1240,
			toY = 1050,
			toZ = 6
			}
 
	local monster_pos = {
				[1] = {pos = {1206, 1039, 6}, monster = "Dragon"},		
				[2] = {pos = {1208, 1039, 6}, monster = "Dragon"},		
				[3] = {pos = {1210, 1039, 6}, monster = "Dragon"},		
				[4] = {pos = {1206, 1045, 6}, monster = "Dragon"},		
				[5] = {pos = {1208, 1045, 6}, monster = "Dragon"},	
				[6] = {pos = {1210, 1045, 6}, monster = "Dragon"},
				[7] = {pos = {1210, 1042, 6}, monster = "Dragon Lord"}
			}
 
	local players_pos = {
				{x = 1207, y =1043, z = 5, stackpos = 253},		
				{x = 1208, y =1043, z = 5, stackpos = 253},		
				{x = 1209, y =1043, z = 5, stackpos = 253},		
				{x = 1210, y =1043, z = 5, stackpos = 253}
			}
 
	local new_player_pos = {
				{x = 1206, y =1042, z = 6},	   
				{x = 1207, y =1042, z = 6},		
				{x = 1208, y =1042, z = 6},	
				{x = 1209, y =1042, z = 6}
			}
 
	local playersOnly = "no"      
	local questLevel = 18
	local storageid = 2100
	local storage_no = "All players don't have finished the dragon slayer quest..."
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
			local all_ready, monsters, player, level = 0, 0, {}, 0
 
			if item.itemid == 1945 then				
				for i = 1, #players_pos do					
					table.insert(player, 0)				
				end
					for i = 1, #players_pos do
						player[i] = getThingfromPos(players_pos[i])
						if player[i].itemid > 0 then
							if string.lower(playersOnly) == "yes" then
								if isPlayer(player[i].uid) == TRUE then
									all_ready = all_ready+1
								else
									monsters = monsters+1
								end
							else
								all_ready = all_ready+1
							end
						end
					end
 
				if all_ready == #players_pos then
					for i = 1, #players_pos do
						player[i] = getThingfromPos(players_pos[i])
						if isPlayer(player[i].uid) == TRUE then
							if getPlayerLevel(player[i].uid) >= questLevel then
								level = level+1
							end
						else
							level = level+1
						end
					end
 
				if(getPlayerStorageValue(player[i].uid, storageid) == 1) then
					if level == #players_pos then           
						if string.lower(playersOnly) == "yes" and monsters == 0 or string.lower(playersOnly) == "no" then                       
							for _, area in pairs(monster_pos) do
								doSummonCreature(area.monster,{x=area.pos[1],y=area.pos[2],z=area.pos[3]})
							end
								for i = 1, #players_pos do                  
									doSendMagicEffect(players_pos[i], CONST_ME_POFF)
									doTeleportThing(player[i].uid, new_player_pos[i], FALSE)
									doSendMagicEffect(new_player_pos[i], CONST_ME_ENERGYAREA)
									doTransformItem(item.uid,1946)
								end
 
						else
							doPlayerSendTextMessage(cid,19,"Only players can do this quest.")
						end
					else
						doPlayerSendTextMessage(cid,19,"All Players have to be level "..questLevel.." to do this quest.")
					end
				else
					doPlayerSendTextMessage(cid,19,"You need "..table.getn(players_pos).." players to do this quest.")
				end
			else
				doPlayerSendTextMessage(cid, 19, storage_no)
			end
 
			elseif item.itemid == 1946 then
					local player_room = 0
					for x = room.fromX, room.toX do
						for y = room.fromY, room.toY do
							for z = room.fromZ, room.toZ do
								local pos = {x=x, y=y, z=z,stackpos = 253}
								local thing = getThingfromPos(pos)
								if thing.itemid > 0 then
									if isPlayer(thing.uid) == TRUE then
											player_room = player_room+1
									end
								end
							end
						end
					end
 
			if player_room >= 1 then
					doPlayerSendTextMessage(cid,19,"There is already a team in the quest room.")          
			elseif player_room == 0 then
				for x = room.fromX, room.toX do
					for y = room.fromY, room.toY do
						for z = room.fromZ, room.toZ do
						local pos = {x=x, y=y, z=z,stackpos = 253}
						local thing = getThingfromPos(pos)
						if thing.itemid > 0 then
							doRemoveCreature(thing.uid)
						end
					end
				end
			end
			doTransformItem(item.uid,1945)
		end
	end
return TRUE
end
 
@WarOfTheTitans
Please refrain from postin scripts which you don't even understand.

@OnTopic
Lua:
local playerpos = {
	player1pos = {x=xxx,y=xxx,z=zzz},
	player2pos = {x=xxx,y=xxx,z=zzz},
	player3pos = {x=xxx,y=xxx,z=zzz}
	}
	
local newpos = {
	new1pos = {x=xxx,y=xxx,z=zzz},
	new2pos = {x=xxx,y=xxx,z=zzz},
	new3pos = {x=xxx,y=xxx,z=zzz}
	}
	
local config = {
	storage = 2001,
	message = "Put your message here."
	}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	for i = 1, #playerpos do
	local player = getThingFromPos(playerpos[i]).uid
		if isPlayer(player) then
			if getPlayerStorageValue(player[i], config.storage) == 5 then
				doTeleportThing(player[i], newpos[i])
				doSendMagicEffect(newpos[i], CONST_ME_TELEPORT)
                               doPlayerSendTextMessage(player[i], 19, config.message)
			else
				doPlayerSendCancel(player[i], "Not all requirements are fullfilled.")
			end
		end
	end
return true
end

If something is off I'll correct it asap.
 
This should maybe work. Haven't tested.
Lua:
 local room = { -- room with dragons
			fromX = 1200,
			fromY = 1030,
			fromZ = 7,
 
			toX = 1240,
			toY = 1050,
			toZ = 6
			}
 
	local monster_pos = {
				[1] = {pos = {1206, 1039, 6}, monster = "Dragon"},		
				[2] = {pos = {1208, 1039, 6}, monster = "Dragon"},		
				[3] = {pos = {1210, 1039, 6}, monster = "Dragon"},		
				[4] = {pos = {1206, 1045, 6}, monster = "Dragon"},		
				[5] = {pos = {1208, 1045, 6}, monster = "Dragon"},	
				[6] = {pos = {1210, 1045, 6}, monster = "Dragon"},
				[7] = {pos = {1210, 1042, 6}, monster = "Dragon Lord"}
			}
 
	local players_pos = {
				{x = 1207, y =1043, z = 5, stackpos = 253},		
				{x = 1208, y =1043, z = 5, stackpos = 253},		
				{x = 1209, y =1043, z = 5, stackpos = 253},		
				{x = 1210, y =1043, z = 5, stackpos = 253}
			}
 
	local new_player_pos = {
				{x = 1206, y =1042, z = 6},	   
				{x = 1207, y =1042, z = 6},		
				{x = 1208, y =1042, z = 6},	
				{x = 1209, y =1042, z = 6}
			}
 
	local playersOnly = "no"      
	local questLevel = 18
	local storageid = 2100
	local storage_no = "All players don't have finished the dragon slayer quest..."
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
			local all_ready, monsters, player, level = 0, 0, {}, 0
 
			if item.itemid == 1945 then				
				for i = 1, #players_pos do					
					table.insert(player, 0)				
				end
					for i = 1, #players_pos do
						player[i] = getThingfromPos(players_pos[i])
						if player[i].itemid > 0 then
							if string.lower(playersOnly) == "yes" then
								if isPlayer(player[i].uid) == TRUE then
									all_ready = all_ready+1
								else
									monsters = monsters+1
								end
							else
								all_ready = all_ready+1
							end
						end
					end
 
				if all_ready == #players_pos then
					for i = 1, #players_pos do
						player[i] = getThingfromPos(players_pos[i])
						if isPlayer(player[i].uid) == TRUE then
							if getPlayerLevel(player[i].uid) >= questLevel then
								level = level+1
							end
						else
							level = level+1
						end
					end
 
				if(getPlayerStorageValue(player[i].uid, storageid) == 1) then
					if level == #players_pos then           
						if string.lower(playersOnly) == "yes" and monsters == 0 or string.lower(playersOnly) == "no" then                       
							for _, area in pairs(monster_pos) do
								doSummonCreature(area.monster,{x=area.pos[1],y=area.pos[2],z=area.pos[3]})
							end
								for i = 1, #players_pos do                  
									doSendMagicEffect(players_pos[i], CONST_ME_POFF)
									doTeleportThing(player[i].uid, new_player_pos[i], FALSE)
									doSendMagicEffect(new_player_pos[i], CONST_ME_ENERGYAREA)
									doTransformItem(item.uid,1946)
								end
 
						else
							doPlayerSendTextMessage(cid,19,"Only players can do this quest.")
						end
					else
						doPlayerSendTextMessage(cid,19,"All Players have to be level "..questLevel.." to do this quest.")
					end
				else
					doPlayerSendTextMessage(cid,19,"You need "..table.getn(players_pos).." players to do this quest.")
				end
			else
				doPlayerSendTextMessage(cid, 19, storage_no)
			end
 
			elseif item.itemid == 1946 then
					local player_room = 0
					for x = room.fromX, room.toX do
						for y = room.fromY, room.toY do
							for z = room.fromZ, room.toZ do
								local pos = {x=x, y=y, z=z,stackpos = 253}
								local thing = getThingfromPos(pos)
								if thing.itemid > 0 then
									if isPlayer(thing.uid) == TRUE then
											player_room = player_room+1
									end
								end
							end
						end
					end
 
			if player_room >= 1 then
					doPlayerSendTextMessage(cid,19,"There is already a team in the quest room.")          
			elseif player_room == 0 then
				for x = room.fromX, room.toX do
					for y = room.fromY, room.toY do
						for z = room.fromZ, room.toZ do
						local pos = {x=x, y=y, z=z,stackpos = 253}
						local thing = getThingfromPos(pos)
						if thing.itemid > 0 then
							doRemoveCreature(thing.uid)
						end
					end
				end
			end
			doTransformItem(item.uid,1945)
		end
	end
return TRUE
end

This script is to long, and for what this dragons? You just copy Annihilator Script!
I Need script what i tell.

Script should ONLY TP players from pos to pos (not making dragons) and all players must have storage to get teleported, if some player dont have storage they will dont get teleport and get message, Some player dont have that quest.


@OnTopic
Lua:
local playerpos = {
	player1pos = {x=xxx,y=xxx,z=zzz},
	player2pos = {x=xxx,y=xxx,z=zzz},
	player3pos = {x=xxx,y=xxx,z=zzz}
	}
	
local newpos = {
	new1pos = {x=xxx,y=xxx,z=zzz},
	new2pos = {x=xxx,y=xxx,z=zzz},
	new3pos = {x=xxx,y=xxx,z=zzz}
	}
	
local config = {
	storage = 2001,
	message = "Put your message here."
	}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	for i = 1, #playerpos do
	local player = getThingFromPos(playerpos[i]).uid
		if isPlayer(player) then
			if getPlayerStorageValue(player[i], config.storage) == 5 then
				doTeleportThing(player[i], newpos[i])
				doSendMagicEffect(newpos[i], CONST_ME_TELEPORT)
                               doPlayerSendTextMessage(player[i], 19, config.message)
			else
				doPlayerSendCancel(player[i], "Not all requirements are fullfilled.")
			end
		end
	end
return true
end

If something is off I'll correct it asap.

Thx Zyntax, i'll check it tommorow and if something will be wrong i send to you PM
 
Bump

I got bug with you're script (almost repaired via PM) Zyntax

Lua:
local playerpos = {
	player1pos = {x=xxx,y=xxx,z=zzz},
	player2pos = {x=xxx,y=xxx,z=zzz},
	player3pos = {x=xxx,y=xxx,z=zzz}
	}
 
local newpos = {
	new1pos = {x=xxx,y=xxx,z=zzz},
	new2pos = {x=xxx,y=xxx,z=zzz},
	new3pos = {x=xxx,y=xxx,z=zzz}
	}
 
local config = {
	storage = 2001,
	ids = {5,6,7}
	message = "Put your message here."
	}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local check = {}
	for i = 1, #playerpos do
	local player = getThingFromPos(playerpos[i]).uid
		if isPlayer(player) then
			if isInArray(config.ids, getPlayerStorageValue(player[i], config.storage)) then
				table.insert(check, 1)
			end
		end
	end
	if #check == #config.ids then
		for i = 1, #playerpos do
			local player = getThingFromPos(playerpos[i]).uid 
			doTeleportThing(player[i], newpos[i])
			doSendMagicEffect(newpos[i], CONST_ME_TELEPORT)
			doPlayerSendTextMessage(player[i], 19, config.message)
		end
	else
		doPlayerSendCancel(player[i], "Not all requirements are fullfilled.")
	end
return true
end

When i pull lever:

Lua:
[21/02/2012 16:54:19] [Error - Action Interface] 
[21/02/2012 16:54:19] data/actions/scripts/mission/mission10.lua:onUse
[21/02/2012 16:54:19] Description: 
[21/02/2012 16:54:19] data/actions/scripts/mission/mission10.lua:37: attempt to index global 'player' (a nil value)
[21/02/2012 16:54:19] stack traceback:
[21/02/2012 16:54:19] 	data/actions/scripts/mission/mission10.lua:37: in function <data/actions/scripts/mission/mission10.lua:19>
 
PHP:
local t = {
        storage = 2001,
	ids = {5,6,7},
	message = "Put your message here.",
	entrada = { -- player pos
		{x = 186, y = 57, z = 7},
		{x = 185, y = 57, z = 7},
                {x = 186, y = 57, z = 7}
	},
	saida = { -- player to pos
		{x = 191, y = 55, z = 6},
		{x = 190, y = 55, z = 6},
		{x = 189, y = 55, z = 6}
	}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local check = {}
	for _, k in ipairs(t.entrada) do
		local x = getTopCreature(k).uid
		if(x == 0 or not isPlayer(x) or not isInArray(t.ids, getPlayerStorageValue(x, t.storage))) then
			doPlayerSendCancel(cid, 'dont have players or no have storage.')
			return true
		end
		table.insert(check, x)
	end
	for i, tid in ipairs(check) do
		doSendMagicEffect(t.entrada[i], CONST_ME_POFF)
		doTeleportThing(tid, t.saida[i], false)
		doSendMagicEffect(t.saida[i], CONST_ME_ENERGYAREA)
                doPlayerSendTextMessage(tid, 19, t.message)
	end
	doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
	return true
end
 
Back
Top