View Single Post
  #4  
Old 03-19-2010, 01:20 AM
jkldogg jkldogg is offline
J.Rollin (killaz)
jkldogg's Avatar
Join Date: Feb 2010
Location: USA
Posts: 675
jkldogg can only hope to improve
Send a message via AIM to jkldogg Send a message via MSN to jkldogg
Wink !

Quote:
Originally Posted by Imperialistic View Post
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 View Post
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.guildaccessthis.guildaccess "Staff";
  
// Assign door image
  
this.image "door.png";
  
// Give door shape (prevents transparent image cheat)
  
this.setshape(13232);
}

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

PSN: jkldogg



The best post ever made on the graal forums.
After playing Graal Online for many years, JKL decides to make a forum account. Isn't life funny?
Reply With Quote