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

Requesting this script if its possible!

grogan

New Member
Joined
Dec 6, 2007
Messages
133
Reaction score
0
Hey Im requesting this script, Im not sure if its possible or not but anyway I want it so once you have all addons you can enter a room, or get a storage value.. If this is possible can someone share thanks.
 
Yeah, it's possible. Here's the lua function. Would you like me to write the whole script?
Lua:
        if getPlayerStorageValue(cid,xxxxx) == 1 and getPlayerStorageValue(cid,xxxxx) == 1 and getPlayerStorageValue(cid,xxxxx) == 1 and getPlayerStorageValue(cid,xxxxx) == 1 and getPlayerStorageValue(cid,xxxxx) == 1 and getPlayerStorageValue(cid,xxxxx) == 1 and getPlayerStorageValue(cid,xxxxx) == 1 then
doPlayerSendTextMessage(cid,25,'You may enter!')
 
By "enter a room" do you want to be 'teleported' to a position(insde that room), or teleported to the other side of a door, or the door to simply open?
 
Umm just door to open but can you make it so It says "You need all addons to have access to this room" when you try use the door thanks. Or whatever is easiest for you :p
 
Lua:
local outfits = {
	{looktype},
	{looktype},
	{looktype},
	{looktype},
	{looktype}
}
 
local function enter(cid, item, toPosition)
	doTransformItem(item.uid, item.itemid + 1)
	doTeleportThing(cid, toPosition)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	for i = 1, #outfits do
		if(item.actionid == xxxx) then
			if(not canPlayerWearOutfit(cid, i, 1 and 2) then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This door seems to be sealed against unwanted intruders.")
			else
				enter(cid, item, toPosition)
			end
			
			break
		end
	end
 
	return true
end
 
Last edited:
Lua:
local outfits = {
	{looktype},
	{looktype},
	{looktype},
	{looktype},
	{looktype}
}

local function enter(cid, item, toPosition)
	doTransformItem(item.uid, item.itemid + 1)
	doTeleportThing(cid, toPosition)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	for i = 1, #outfits do
		if(item.actionid == xxxx) then
			if(not canPlayerWearOutfit(cid, i, 1 and 2) then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This door seems to be sealed against unwanted intruders.")
			end

			enter(cid, item, toPosition)
		end
	end
	
	return true
end

Keep Failing Mate. Fixed jdb thing;

Lua:
local outfits = {looktype,looktype,looktype,looktype,looktype}
 
local function enter(cid, item, toPosition)
	doTransformItem(item.uid, item.itemid + 1)
	doTeleportThing(cid, toPosition)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
local canEnter = true;
	for i = 1, #outfits do
			if(not canPlayerWearOutfit(cid, i, 3) then
				canEnter = false;
break;
			end
 
			
	end
 if(canEnter)then
enter(cid, item, toPosition);
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This door seems to be sealed against unwanted intruders.")

end
	return true
end

Writting in quick reply window.
 
I used a script like this for Inquisition on my server, it worked fine.

But okay, I keep failing. Don't see how that's possible, since this is the first script I have written since mid November.
 
looping through outfits, and if player don't have one say msg. (so 20 msgs if player don't have 20 outfits) otherwise 20x doorEnter (or, mixed depending on outfits a player has) = 20x item(door) change (+1); so door id would be fucked up after one use. Anyway my script could be optimized, to works without 'canEnter' variable ^^

Edit:
Lua:
local outfits = {
	{looktype},
	{looktype},
	{looktype},
	{looktype},
	{looktype}
}
 
local function enter(cid, item, toPosition)
	doTransformItem(item.uid, item.itemid + 1)
	doTeleportThing(cid, toPosition)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	for i = 1, #outfits do
		if(item.actionid == xxxx) then
			if(not canPlayerWearOutfit(cid, i, 1 and 2) then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This door seems to be sealed against unwanted intruders.")
			else
				enter(cid, item, toPosition)
			end
			
			break -- <<<
		end
	end
 
	return true
end

Even after adding fast one 'break' it still fails 'cuz it'll stop after first iteration. This thing about keeping failing was a SARCASM ^^ dont take it seriously.

Edit 2.
Futhermore both our scripts sux, since when player use a doors which're opened id would be incrased anyway. Correct version( at all):

Lua:
local outfits = {looktype,looktype,looktype,looktype,looktype}
local ThisDoorItemId = 0;

local function enter(cid, item, toPosition)
	if(item.itemid == ThisDoorItemId or ThisDoorItemId == 0) then
		doTransformItem(item.uid, item.itemid + 1)
	end
	doTeleportThing(cid, toPosition)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	for i = 1, #outfits do
		if(not canPlayerWearOutfit(cid, outfits [i], 3) then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This door seems to be sealed against unwanted intruders.")
			return true;
		end
	end
	if(ThisDoorItemId == 0)then
		ThisDoorItemId = item.itemid; --Reloading actions could screw this up.
	end
	enter(cid, item, toPosition);
	return true
end

Edit 3. Whoah! found even one more Fail, JDB ;>

local outfits = {
{looktype},
{looktype},
{looktype},
{looktype},
{looktype}
}

[...]
if(not canPlayerWearOutfit(cid,i, 1 and 2) then
end

Each element of outfits array is another array so u can't do it in the way u did above, what means it couldn't work for u before (everybody's lying!).
to get looktype from this array u should do like:
if(not canPlayerWearOutfit(cid,i[1], 1 and 2) then
end

^^

Edit the next one. with one more failure by JDB

for i = 1, #outfits do
if(item.actionid == xxxx) then
if(not canPlayerWearOutfit(cid, i, 1 and 2) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This door seems to be sealed against unwanted intruders.")
else
enter(cid, item, toPosition)
end

break -- <<<
end
end

"i" is here an integer not an array member so u have to add pointer to i-element in array (and remember that i've written above about each array member is also array) by
for i = 1, #outfits do
if(item.actionid == xxxx) then
if(not canPlayerWearOutfit(cid, outfits[1], 1 and 2) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This door seems to be sealed against unwanted intruders.")
else
enter(cid, item, toPosition)
end

break -- <<<
end
end


//QuaS
 
Last edited:
Getting an error on the scripts same error

[Error - LuaScriptInterface::loadfile] data/actions/other/addon.lua:13: '>' expected near 'then'
 
Back
Top