Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Staff Only check (https://forums.graalonline.com/forums/showthread.php?t=67868)

xXziroXx 08-04-2006 05:42 PM

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.

DrakilorP2P 08-04-2006 07:01 PM

A smooth way to check for access. Though what about something like: HasAccess("Staff/Boots")

xXziroXx 08-05-2006 03:56 PM

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)?

contiga 08-06-2006 12:53 PM

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.

xXziroXx 08-06-2006 03:42 PM

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.

DrakilorP2P 08-06-2006 05:38 PM

Quote:

Originally Posted by xXziroXx
HasAccess()? Dont you mean hasRight(str, str)?

I was talking in terms of a manually declared function.

xXziroXx 09-09-2006 11:31 PM

Mods: Mind moving this to the Code Gallery?

projectigi 09-13-2006 01:53 PM

link doesnt work for me =(

xXziroXx 09-13-2006 04:29 PM

Quote:

Originally Posted by projectigi
link doesnt work for me =(

It should do. Graal.NET was down a few days though, so try again.

projectigi 09-13-2006 11:33 PM

yeah works now

Twinny 09-14-2006 08:21 AM

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!");

xXziroXx 09-14-2006 02:43 PM

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?

Twinny 09-15-2006 07:48 AM

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.

KuJi 09-15-2006 01:23 PM

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.


All times are GMT +2. The time now is 03:09 AM.

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