• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Doors when have items can pass

Sopelek

New Member
Joined
Jan 4, 2009
Messages
46
Reaction score
0
Script works when player have Waterpipe, lute, flute in backpack (Ofcourse) You can change this items, In my script when player have all items, and he use doors he get storage id 29071 (In my ots it's Brotherhood outfit) And next time when he use doors he can be teleport after doors, without items.
Tested on TFS 0.3.5 Crying Damson works 100%
It's my first script than please for normal opinions​
Create in actions/scripts file NAME.lua
Lua:
  local storage = 29071
  local teleportpos = {x=1000, y=1000, z=7, stackpos=1}
  local waterpipe = 2099
  local lute = 2072
  local flute = 2070
function onUse(cid, item, frompos, item2, topos)
    if item.uid == 7878 then
      if (getPlayerStorageValue(cid, storage) == -1) then
       if (getPlayerItemCount(cid,waterpipe) >= 1) then
	   if (getPlayerItemCount(cid,lute) >= 1) then
	   if (getPlayerItemCount(cid,flute) >= 1) then
         doPlayerRemoveItem(cid,2099,1)
		 doPlayerRemoveItem(cid,2072,1)
		 doPlayerRemoveItem(cid,2070,1)
             setPlayerStorageValue(cid, storage, 1)
              doPlayerSendTextMessage(cid, 21, "You've got new outfit, Congratulations.")
			  end
			  end
			  elseif (getPlayerStorageValue(cid, storage) == -1) then
			  doPlayerSendTextMessage(cid, 21, "You need Water Pipe, Lute and Flute to enter here.")
			  end
        else 
		if (getPlayerStorageValue(cid, storage) == 1) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have this outfit, but you're welcome on music temple.")
            doTeleportThing(cid, teleportpos)
	   end
	  end
     end
    return TRUE
end
Add to Action
Code:
 <action uniqueid="7878" script="[COLOR="Red"]NAME[/COLOR].lua" />
And if u want have any outfit like me in this quest just add in outfits.xml for example to Brotherhood outfit
change :
Code:
	<outfit id="19" premium="yes" default="0">
		<list gender="0" lookType="279" name="Brotherhood"/>
		<list gender="1" lookType="278" name="Brotherhood"/>
	</outfit>
to
Code:
	<outfit id="19" premium="yes" default="0" quest="29071">
		<list gender="0" lookType="279" name="Brotherhood"/>
		<list gender="1" lookType="278" name="Brotherhood"/>
	</outfit>

//Sorry for my English, it isn't perfect, but i'm trying.
 
That is probably one of the most un-organized scripts I have seen.
 
Not bad at all for a first script :thumbup:

Maybe it could help a bit to tag it properly so it looks more like this:

Lua:
local storage = 29071
local teleportpos = {x=1000, y=1000, z=7, stackpos=1}

local waterpipe = 2099
local lute = 2072
local flute = 2070

function onUse(cid, item, frompos, item2, topos)
	if item.uid == 7878 then
		if (getPlayerStorageValue(cid, storage) == -1) then
			if (getPlayerItemCount(cid,waterpipe) >= 1) then
				if (getPlayerItemCount(cid,lute) >= 1) then
					if (getPlayerItemCount(cid,flute) >= 1) then
						doPlayerRemoveItem(cid,2099,1)
						doPlayerRemoveItem(cid,2072,1)
						doPlayerRemoveItem(cid,2070,1)
						setPlayerStorageValue(cid, storage, 1)
						doPlayerSendTextMessage(cid, 21, "You've got new outfit, Congratulations.")
					end
				end
			elseif (getPlayerStorageValue(cid, storage) == -1) then
				doPlayerSendTextMessage(cid, 21, "You need Water Pipe, Lute and Flute to enter here.")
			end
		else
			if (getPlayerStorageValue(cid, storage) == 1) then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have this outfit, but you're welcome on music temple.")
				doTeleportThing(cid, teleportpos)
			end
		end
	end
	return TRUE
end

At that way it is a bit more organized. Maybe use some arrays to shorten it a bit aswell.

Keep it up! ;)
 
Lua:
local config = {
	storage = 29071,
	teleportpos = {x=1000, y=1000, z=7, stackpos=1},
	items = {2099,2072,2070},
	deniedmsg = "You need a Water Pipe, Lute and Flute to enter here.",
	acceptmsg = "You have gotten a new outfit, Congratulations."
}

function onUse(cid, item, frompos, item2, topos)
        if item.uid == 7878 then
                if (getPlayerStorageValue(cid, config.storage) == -1) then
                    if (getPlayerItemCount(cid,config.items) >= 1) then
			setPlayerStorageValue(cid, config.storage, 1)
			doPlayerSendTextMessage(cid, 21, config.acceptmsg)
			for _, id in ipairs(config.items) do
                            doPlayerRemoveItem(cid, id, 1)
                        end
		    else
		        doPlayerSendTextMessage(cid, 21, config.deniedmsg)
	            end
		elseif (getPlayerStorageValue(cid, storage) == 1) then
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have this outfit, but you're welcome on music temple.")
                    doTeleportThing(cid, teleportpos)
		end
        end
return TRUE
end

EDIT: line 17 may be wrong, wasn't sure if I could use that function with tables like that.
 
Back
Top