Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-04-2006, 05:42 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Staff Only check

This function checks if your account is listed in the "staff=" section of the server options, if so it returns "true" and if you're not it returns "false".

Example:

The NPC containing the function(s) is named "System/Functions", and the current NPC want to make a IsStaff() check.

PHP Code:
if (("System/Functions").IsStaff() == true) {
  
// Proceed with script


The code can be found here: http://www.graal.net/snippet/detail....snippet&id=116


Hopefully you find it usefull, enjoy.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #2  
Old 08-04-2006, 07:01 PM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
A smooth way to check for access. Though what about something like: HasAccess("Staff/Boots")
Reply With Quote
  #3  
Old 08-05-2006, 03:56 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by DrakilorP2P
A smooth way to check for access. Though what about something like: HasAccess("Staff/Boots")
HasAccess()? Dont you mean hasRight(str, str)?
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #4  
Old 08-06-2006, 12:53 PM
contiga contiga is offline
Graal2001 Administration
contiga's Avatar
Join Date: Jul 2004
Location: Netherlands
Posts: 419
contiga is an unknown quantity at this point
Send a message via ICQ to contiga Send a message via AIM to contiga Send a message via MSN to contiga Send a message via Yahoo to contiga
Nice Ziro! Like this players still have access to the server, but you can limit their actions, without having another flag (in Control-NPC for example) to update each time you hire / fire a person.
__________________
AIM: Contiga122
MSN: [email protected]
Status:
Quote:
Originally Posted by unixmad View Post
I am also awake 3AM to help correct problems.
Quote:
Originally Posted by Bomy Island RC people
Daniel: HoudiniMan is a bad guy =p
*Bell: rofl. I first read that as houdini is a bad man. like the little kid that wants his mommy to keep her away from that boogie man
Daniel: xD
*Rufus: I wouldn't want my kids around him.
Reply With Quote
  #5  
Old 08-06-2006, 03:42 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by contiga
Nice Ziro! Like this players still have access to the server, but you can limit their actions, without having another flag (in Control-NPC for example) to update each time you hire / fire a person.
Yeah, I thought something like this would be usefull.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #6  
Old 08-06-2006, 05:38 PM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Quote:
Originally Posted by xXziroXx
HasAccess()? Dont you mean hasRight(str, str)?
I was talking in terms of a manually declared function.
Reply With Quote
  #7  
Old 09-09-2006, 11:31 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Mods: Mind moving this to the Code Gallery?
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #8  
Old 09-13-2006, 01:53 PM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
link doesnt work for me =(
Reply With Quote
  #9  
Old 09-13-2006, 04:29 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by projectigi
link doesnt work for me =(
It should do. Graal.NET was down a few days though, so try again.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #10  
Old 09-13-2006, 11:33 PM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
yeah works now
Reply With Quote
  #11  
Old 09-14-2006, 08:21 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
I hate using serverr flags for anything. I'd use a DBNPC called StaffRights and use functions like this:

PHP Code:
public function checkrights(ply,right)
{
  
temp.check this.(ply@"_rights").index(right);
  if (
temp.check >= 0) return true;
  else return 
false;
}

public function 
addrights(ply,right)
{
  if (
this.(ply@"_rights").index(right) < 0)
  {
    
this.(ply@"_rights").add(right);
    return 
true;
  }
  else return 
false;
}

public function 
removerights(ply,right)
{
  if (
this.(ply@"_rights").index(right) >= 0)
  {
    
this.(ply@"_rights").remove(right);
    return 
true;
  }
  else return 
false;

This could be used in many other things as well. Thus i'd use StaffRights.addrights("Twinny","MonkeyPowers!");
Reply With Quote
  #12  
Old 09-14-2006, 02:43 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Twinny
I hate using serverr flags for anything. I'd use a DBNPC called StaffRights and use functions like this:

PHP Code:
public function checkrights(ply,right)
{
  
temp.check this.(ply@"_rights").index(right);
  if (
temp.check >= 0) return true;
  else return 
false;
}

public function 
addrights(ply,right)
{
  if (
this.(ply@"_rights").index(right) < 0)
  {
    
this.(ply@"_rights").add(right);
    return 
true;
  }
  else return 
false;
}

public function 
removerights(ply,right)
{
  if (
this.(ply@"_rights").index(right) >= 0)
  {
    
this.(ply@"_rights").remove(right);
    return 
true;
  }
  else return 
false;

This could be used in many other things as well. Thus i'd use StaffRights.addrights("Twinny","MonkeyPowers!");
Server strings are used when theres too little data to having to 'waste' a DB for it. I mean, come on - an entire database for one string?
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #13  
Old 09-15-2006, 07:48 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
I use serverr strings if everbody will be checking them alot. Otherwise i use other methods. Also - that script i wrote for a DB can easily be converted into other similar things.
Reply With Quote
  #14  
Old 09-15-2006, 01:23 PM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
Quote:
Originally Posted by xXziroXx
Server strings are used when theres too little data to having to 'waste' a DB for it. I mean, come on - an entire database for one string?
I think you forgot its limited only 255 characters and probally wouldnt fit much.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:06 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.