![]() |
Guild Locked Door
1 Attachment(s)
My First Post in the Code Gallery! ^^
Very Simple Guild door script. Just Place it in an NPC on the GraalEditor, save it and upload it to your server. You must also use an image and upload that as well. You must have your own clientr.gangname This script is very useful for like gang locked doors or staff locked doors. So like you must be wearing the guild tag in order to enter the door, if you're not wearing the tag, you'll be warped to the else location. Forum PM me any questions you may have. Helpful Comments: NPC Code:line 2, you need your own script for a clientr.gangname or something. Here's the full code: PHP Code:
http://forums.graalonline.com/forums...1&d=1268952059 |
You don't really have to set it in the players attributes if it's just the guild name, makes you go out of the way to set clientr.squadname.
You can just simplify it: PHP Code:
|
When you do comments, you typically comment them above or beside the line of code. Listing them at the bottom (now in a post) of the script is just a bad idea especially when you get into larger scripts, there's already enough jumping back and forth when you're tracing code there's no need to make it even more tedious.
Much like when Imperialistic first posted in the code gallery he made it specific to his cause (clientr.squadName + onActionGrab) as well depending on the context/situation of the script it should be reusable on other servers without much effort. Here's what I would of considered a proper guild door. PHP Code:
PHP Code:
PHP Code:
PHP Code:
|
!
Quote:
Quote:
That looks Extremely complicated/boring to use. Mine is fun! You get warped somewhere else when it you're not in the guild. + mine is small, compact, and simple! :) |
You're not showing any willingness to learn, you should take seriously to what fowlplay4 is telling you, if you want to be warped just replace:
hide(); --> setlevel2("blah.nw", x , y); and player.chat = "Access Denied!"; --> setlevel2("blah2.nw", x, y); |
!
Quote:
I don't understand this part: PHP Code:
|
Quote:
if (!this.guildaccess) - Checks if the this.guildaccess is not 0 this.guildaccess = "Guild Name" - Sets this.guildaccess to a default value if it's not defined or equals 0. this.setshape(1, 32, 32); - My example sets the size of the npc to a blocking type (1), and to block 32 by 32 pixels (or 2 by 2 tiles since tiles are 16 pixels in width and height). Also, yes your script is relatively small, simple, quick but lacks reuse-ability and will be a pain to have to go and replace it everywhere it's used if you want to change it's behavior. P.S. Don't leave the code in PHP tags in your quotes, just makes it easier on people tbh. |
Quote:
|
hey jerret, what's wrong with sleep()?
you're all waitfor()'ish.. sure, i heard that sleep() break's loops, but for events? or is this just a personal preference? |
Personal preference I guess, also lets you wake up your scripts in future/more complex cases.
|
Quote:
PHP Code:
PHP Code:
|
Now there's a class-based guild door, as well as the warp. Thread accomplished.
|
All times are GMT +2. The time now is 10:35 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.