Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Comments change notification (https://forums.graalonline.com/forums/showthread.php?t=134268496)

Gunderak 07-20-2013 08:11 AM

Comments change notification
 
Basically alerts you when your comments change (when you first log on rc).
PHP Code:

public function NewRC(acc){
  
//Let NC messages send first..
  
sleep(3);
  
temp.comment this.GetComments(acc);
  if(
md5(comment) != this.(@acc)){
    
acc.sendtorc("Your comments have changed since you last logged on.");
  }
  
this.(@acc) = md5(comment);
}
function 
GetComments(ac){
  
temp.st temp.ac.substring(02);
  
temp.path format("accounts/%s/%s.txt"stac);
  
temp.file.loadstring(temp.path);
  
temp.file temp.file.tokenize("\r\n");
  
temp.comments;
  for(
temp.line temp.file){
    if(
line.starts("COMMENTS")){
      return 
line.substring(9);
    }
  }
  return 
"none";


This can be used in conjunction with Andrews playercontrol code.
http://forums.graalonline.com/forums...37&postcount=1
For an example if the npc was named Comments, in the playercontrol code after the line this.rcplayers.add(temp.pl);
PHP Code:

  Comments.NewRC(temp.pl); 

Note:
The NPCServer must have these rights in order for it to work.
NPC Code:
r accounts/*
r accounts/*/*
r accounts/*/*/*



All times are GMT +2. The time now is 08:29 AM.

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