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.t : msg.tokenize()){ temp.c = temp.t.positions("@").size(); if(temp.t.starts("@") && temp.c == 1) { temp.acct = temp.t.substring(1, temp.t.length()); temp.fromUser = msg.tokenize()[0].substring(0, msg.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!
|