Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   RC Tag (https://forums.graalonline.com/forums/showthread.php?t=134270602)

MysticalDragon 02-20-2018 06:31 PM

RC Tag
 
Small thing I did on delteria to tag people and they get a PM and message on iphone player saying they have been tagged in RC.

PHP Code:

function onAllRCChat(msg) {
  for(
temp.msg.tokenize()){
    
temp.temp.t.positions("@").size();
    if(
temp.t.starts("@") && temp.== 1) {
      
temp.acct temp.t.substring(1temp.t.length());
      
temp.fromUser msg.tokenize()[0].substring(0msg.tokenize()[0].length() - 1);
      
temp.fullMessage msg.substring(temp.fromUser.length() + 2);
      if(
RCActive(temp.acct)) {
        
findRC(temp.acct).sendtorc("#ALERTFS " temp.fromUser " tagged you!");
        
findRC(temp.acct).sendPM(msg);
        
msg format("You've been mentioned on RC by %s! Message: %s",  temp.fromUser temp.fullMessage);
        
//DB_Messages.sendPM({temp.acct}, msg); // Enable for iPhone servers
      
}
    }
  }
}

public function 
findRC(acc) {
  for (
temp.pl allplayers) {
    if ((
pl.communityname == acc || pl.account == acc) && pl.level.name == null) {
      return 
pl// RC found
    
}
  }

  return 
findPlayerByCommunityName(acc); // client-RC?
}

public function 
RCActive(acc) {
  return (
findRC(acc) != null);


only tags the first @ it hits.

Usage:

HomelessWitch: @MysticalDragon ******
HomelessWitch tagged you!

fowlplay4 02-21-2018 03:12 PM

thats cool u did the alert thing


All times are GMT +2. The time now is 05:45 AM.

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