View Single Post
  #4  
Old 02-02-2007, 02:18 AM
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
Here's another version of it, thats currently in use on Mythic.. it checks what staff position you are, and sets a clientr. string as it. Could be useful for showing it in your profile etc.


wNPC:

PHP Code:
function onActionServerSide()
{
  switch (
params[0]) {
    
// Automaticly scans the serveroptions for staffs and add them
    // to serverr.staff.
    
case "updatestaffs":
      for (
iparams[1]) {
        if (
i.starts("staff=")) temp.staff i;
      }
      
serverr.staff NULL;
      for (
itemp.staff.tokenize()) {
        if (
i.starts("staff=") || i.starts("(") && i.ends(")")) {
          if (
i.starts("staff=")) temp.rank i.substring(7i.length() - 8);
          else 
temp.rank i.substring(1i.length() - 2);
        }
        else if (
temp.rank != "Access"serverr.staff.add({itemp.rank});
      }
    break;
  }
}

//#CLIENTSIDE
function onCreated()
{
  if (
clientr.staffrank != NULLrequestText("clientrc"1);
}

function 
onReceiveText(texttypetextoptiontextlines) {
  switch (
texttype) {
    case 
"clientrc":
      
requestText("options""");
    break;
    
    case 
"options":
      
triggerServer("gui"name"updatestaffs"textlines.tokenize(), servername);
    break;
  }

"isstaff" class that should be joined when the player logs in, cotains a function that checks if the player is staff or not (player.IsStaff()). Works both clientsided and serversided (atleast I think it does.. pretty sure it does on ML).

PHP Code:
public function IsStaff()
{
  
clientr.isstaff false;
  
clientr.staffrank NULL;
  
temp.data isInString(this.account);
  if (
temp.data[0] == true) {
    
clientr.isstaff = { temp.data[0], temp.data[1] };
    
clientr.staffrank temp.data[1];
  } else 
clientr.staffrank "Player";
  return 
clientr.isstaff[0];
}

function 
isInString(acc)
{
  for (
0serverr.staff.size(); ++) {
    if (
serverr.staff[i][0] == acc) {
      
temp.info = { trueserverr.staff[i][1] };
      return 
temp.info;
    }
  }
  return 
false;
}

//#CLIENTSIDE
public function IsStaff()
{
  return 
isInString(this.account)[0];
}

function 
isInString(acc)
{
  for (
0serverr.staff.size(); ++) {
    if (
serverr.staff[i][0] == acc) {
      
temp.data = { trueserverr.staff[i][1] };
      return 
temp.data;
    }
  }
  return 
false;

And finally, just add this to profilevars in serveroptions:

PHP Code:
Server Relation:=clientr.staffrank 
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote