• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

Script won't load

Kamikaze

Well-Known Member
Contributor
It sends only the message for the first join (even if the total connections are > 1) and then it doesn't do nothing more.
JavaScript:
registerPlugin({
    name: 'Advanced ChaosGaming Welcome',
    version: '1.0',
    description: 'Gestisce i messaggi di join.',
    author: 'Aerora <[email protected]>',
    vars: [{
        name: 'primoMessaggio',
        title: 'Messaggio da inviare. (%u = nome utente)',
        type: 'string'
    }, {
        name: 'secondoMessaggio',
        title: 'Messaggio quando entra la seconda volta. (%u = nome utente)',
        type: 'string'
    }, {
        name: 'tipoMessaggio',
        title: 'Modalità di messaggio.',
        type: 'select',
        options: [
            'Chat privata', //0
            'Poke' //1
        ]
    }]
}, function(sinusbot, config) {
    var event = require('event');
    event.on('clientMove', function(ev) {
        var messaggyno = config.primoMessaggio;
        var messaggyno2 = config.secondoMessaggio;
        messaggyno = messaggyno.replace(/%u/g, ev.client.name());
        messaggyno2 = messaggyno2.replace(/%u/g, ev.client.name());
        if(ev.toChannel.id() == 1) { // replace 1 with channel id of default channel
            if(ev.client.getTotalConnections() == 1) {
                if(config.tipoMessaggio == 0) {
                    ev.client.chat(messaggyno);
                } else {
                    ev.client.poke(messaggyno2);
                }
                ev.client.addToServerGroup('Utente');
            } else {
                if(config.tipoMessaggio == 0) {
                    ev.client.chat(messaggyno);
                } else {
                    ev.client.poke(messaggyno2);
                }
            }
        }
    });
});

There was 1x "});" to much and "getTotalConnectionsCount" isnt working, maybe a bug, replaced it with "getTotalConnections", it does the same
 
Top