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

Lua Adding Access doors (I made it for TFS)

Nirer

New Member
Joined
Aug 23, 2007
Messages
91
Reaction score
0
Location
Israel, How Unfortunate
First of all, I want to say this is my first scrip, so don't give me all that bullshit, its about 2 am right now so once again, DON'T GIVE ME BULLSHIT

Topics:

1) Why did I make it?
2) Information/About
3)How to add it (including pictures)
4)Cretids

---------------------

1) Why did I make it?

I made this because a Guy on a different open-tibia forum (you know the name -.-) requested it, and to finally make a first script and check my skills...


---------------------

2) Information/About:

Access doors - Doors which are meant for staff purposes only!
These doors can only be opened by an access level of 2 or higher (GameMaster and above).
Furthermore, This script is meant for true purposes and not for some leechers to post it on some Pl forum and saying they made it (when they obviously didn't). --PL dudes, sorry if i offended you xD
This script was made for TFS (The Forgotten Server) meaning it is meant for the "global.lua" of TFS, the MYSQL database of TFS and everything alse that matters, WAS NOT TESTED ON ANYOTHER DISTRO BUT TFS
This is my first script as I said so, it its pretty long (I think) compared to other Access doors scripts. I will release a new one when I will be more skilled
Note: This script was made only for 2 doors so choose carefully ;), in future scripts I will try to improve that fact...


3)How to add it? (Containing pictures)

Step one:
go in to the "data\actions\scripts\other" directory in your TFS folder.

Step two:
create a new file called: "accessdoor.lua" (must be a lua file!)
like this:
311tna1.png


Step three:
Enter that file you just made and paste this:
PHP:
function onUse(cid, item, frompos, item2, topos)

  if item.itemid == 5733 or item.itemid == 5736 then
    if (item.uid==9876 or item.uid==6789) then
            if (getPlayerGroupId(cid)>=2) then
	   	          doTransformItem(item.uid, item.itemid+1)
	                doPlayerSendTextMessage(cid, 22, "Welcome to staff area, we will be passing out peanuts in a moment ;) ENJOY YOUR STAY :)")
	       
		   end	  
	             if (getPlayerGroupId(cid)<2) then
			          doPlayerSendTextMessage(cid, 22, "You are not a GameMaster or a God, this place was not meant for you...")
					  
                 end
	       
	   end
  end   
	   
   
    return 1


end

Save and exit the file.

Step four:
Open your Map with a Map Editor and make 2 doors, where ever you want..
IMPORTANT, door Id must be 5733 or 5736 (made them these 2 Id's because they remind of the gates to heaven -- most suitable for gamemasters :))
Give the first door a unique ID of "9876" -- to do this, just right click the door and press properties...
This picture will explain:
w9vb5x.png


Do the same for the other door except this time, unique ID is "6789" like this:
2hg5tlh.png


Step five:
Go in to the "data\actions" directory in your TFS folder and open actions.XML with notepad or any other editing program and do this:

Under:
PHP:
<action itemid="2553" script="tools/pick.lua"/>

Pase this:
PHP:
<!-- Access Doors -->
	<action uniqueid="9876" script="other/accessdoor.lua"/>
	<action uniqueid="6789" script="other/accessdoor.lua"/>

like in this picture:
2gtdto5.png


Save file and exit.

Step six:
Go in to your "data\movements" directory in your TFS folder,
open "movements.XML" and do the following:

Under:
PHP:
<!-- (Level & quest) doors -->

Paste this:
PHP:
<movevent event="StepOut" itemid="5737" script="closingdoor.lua"/>
	<movevent event="StepOut" itemid="5734" script="closingdoor.lua"/>

Like in this picture:
2l9lc1.png


Well you are done for now :)... That was the hard part, now lets go see how it looks:

This is non-GM mode:
50gnti.jpg


This is GM mode:
2moqsls.png




4)Credits:

First of all, Credits to the best teacher in the world "Nahruto"!
He taught me everything I know, all though we are not even half way through, Thank you Nahruto for teaching me :) You are the greatest teacher ever!

Credits to me for making the script and everything and of course for making this tutorial...


Bonus! (lol)

Sorry to:
Guys who made TFS, I know this offended your respect because it's not "worty" to put in TFS, sorry for offending..
Sorry to any other people I've offended by this tutorial or by anything I did on the way...

Bugs: Please report the bugs here, or send me a private msg..
you can also report bugs to my emal/MSN:
[email protected]

-- Thank you :) --
 
Last edited:
First day is ok :p hope soon you will be better with what ill teach you.
 
nice script for first and yes i agree that Nahruto is the best teacher he is more than the best even.
 
Wops, you forgot to check the door id.


PHP:
function onUse(cid, item, frompos, item2, topos)
if item.itemid == 5733 or item.itemid == 5736 then
    if (item.uid==9876 or item.uid==6789) then
        if (getPlayerGroupId(cid)>=2) then
            doTransformItem(item.uid, item.itemid+1)
            doPlayerSendTextMessage(cid, 22, "Welcome to staff area, we will be passing out peanuts in a moment ;) ENJOY YOUR STAY :)")
        elseif (getPlayerGroupId(cid)<2) then
            doPlayerSendTextMessage(cid, 22, "You are not a GameMaster or a God, this place was not meant for you...")
        end
    end
end
return 1
end




 
@master-m
This serves more than one purpose. Can be used simply with players with higher access to allow different areas (donation?). A stupid idea for it but, still a possibility just not the best one.
 
nice, but when i click on a door with GOD / GM / PLAYER i will kicked from tibia after login the door is open by GM / GOD and by player Closed, why i get a crash?
 
Back
Top