Still looking for player tracking bot

Posts 1–12 of 12 · Page 1 of 1
Still looking for player tracking bot
Still on the hunt for a working player tracking bot, plx help
If you are using version 6.9.0 or higher, you can use the built in player tracker component to make a very concise notifier plugin

Code:
import { NrPlugin, PluginManager, Log } from '../core/plugin-module';
import { PlayerTracker } from './player-tracker';
import { IPlayerData } from '../models/playerdata';

/*
 * The // here is to avoid tagging NRP. Remove it before compiling this plugin.
 */
@//NrPlugin({ name: 'Player Notifier', author: 'Killer Be Killed' })
class PlayerNotifier {
    names = [
        'Eendi',
        'Oshyu',
        'Saylt'
    ];
    constructor() {
        PluginManager.afterInit(() => {
            const tracker = PluginManager.getInstanceOf(PlayerTracker);
            tracker.trackAllPlayers();
            tracker.on('enter', (player: IPlayerData) => {
                if (this.names.indexOf(player.name) > -1) {
                    Log('Notifier', `${player.name} entered ${player.server}`);
                }
            });
        });
    }
}
This will work just fine, but you may want to move the 'names' array to an external config file to make it easier to change.
Quote Originally Posted by Killer Be Killed View Post
If you are using version 6.9.0 or higher, you can use the built in player tracker component to make a very concise notifier plugin

Code:
import { NrPlugin, PluginManager, Log } from '../core/plugin-module';
import { PlayerTracker } from './player-tracker';
import { IPlayerData } from '../models/playerdata';

/*
 * The // here is to avoid tagging NRP. Remove it before compiling this plugin.
 */
@//NrPlugin({ name: 'Player Notifier', author: 'Killer Be Killed' })
class PlayerNotifier {
    names = [
        'Eendi',
        'Oshyu',
        'Saylt'
    ];
    constructor() {
        PluginManager.afterInit(() => {
            const tracker = PluginManager.getInstanceOf(PlayerTracker);
            tracker.trackAllPlayers();
            tracker.on('enter', (player: IPlayerData) => {
                if (this.names.indexOf(player.name) > -1) {
                    Log('Notifier', `${player.name} entered ${player.server}`);
                }
            });
        });
    }
}
This will work just fine, but you may want to move the 'names' array to an external config file to make it easier to change.
Ok, I'm having trouble with nrelay right now (maybe you could help https://www.mpgh.net/forum/showthrea...6#post13549166) but when I start nrelay Player Notifier doesn't load alongside tcrane's Hello Plugin and Player Tracker. I used your exact code and changed it my main account so I could test it. I have it as player-notifier.ts in nrelay/src/plugins. What am I doing wrong?

I really appreciate your help. Thank you
but wher do i put the script plzzzzzzzzzzzz

- - - Updated - - -

but wher did u put it plz
Make a new file src/plugins/player-notifier.ts and paste code in.
Need help
where to put that code?
Quote Originally Posted by oiwjhlf View Post
where to put that code?
My guess is the plugin folder.
HELP
where to put script?
Solved the problem, Killer Be Killed helped me out. Mods can delete now i guess
It would be helpful if someone could create a tutorial as im also very confused on this
when we're all bad at coding or tech stuff.
/Closed; resolved.
Posts 1–12 of 12 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us