Quote:
Originally Posted by Imperialistic
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:
if (player.guild == "GUILD_NAME")
|
Okay, thanks.
Quote:
Originally Posted by fowlplay4
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:
//#CLIENTSIDE
function onCreated() {
// Define guild that can use door
if (!this.guildaccess) this.guildaccess = "Staff";
// Assign door image
this.image = "door.png";
// Give door shape (prevents transparent image cheat)
this.setshape(1, 32, 32);
}
function onPlayerTouchsMe() {
// Check if player's guild can use door
if (player.guild == this.guildaccess) {
// Player is allowed to enter
openDoor();
} else {
// Player is denied access
accessDenied();
}
}
function openDoor() {
// Hide Door
hide();
// Wait 3 seconds
waitfor(this, "WaitEvent", 3);
// Un-hide Door
show();
}
function accessDenied() {
// Display access denied error
player.chat = "Access denied!";
}
That would then be placed in a class called door_guild or so, and be used in a level script like so:
PHP Code:
//#CLIENTSIDE
function onCreated() {
// Define guild who can access it
this.guildaccess = "Guild Name";
// Inherit Guild Door Class
this.join("door_guild");
}
|
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!
