Ich verstehe nicht wieso dieses Script manchmal 2 mal anschreibt und manchmal nur einmal?
ich denke ich habe da irgendwo ein fehler drinnen aber ich finde ihn einfach nicht.
1. Script
ich denke ich habe da irgendwo ein fehler drinnen aber ich finde ihn einfach nicht.
1. Script
Code:
,
engine: '>= 0.13.37',
description: 'Write to Groups when a user joins a specific channel',
author: 'Montiary',
vars: [{
name: 'ShowLog',
indent: 1,
title: 'Show Logs?',
type: 'select',
options: [
'NO',
'YES'
]
}, {
name: "Triggers",
title: 'Triggers',
type: 'array',
vars: [{
name: 'Channel',
indent: 1,
title: 'Channel der den Nachricht/Ping aktiviert',
type: 'channel'
}, {
name: 'IgnoreGroups',
indent: 1,
title: 'Die Gruppen die nicht triggern',
type: 'array',
vars: [{
name: 'GroupID',
indent: 1,
title: 'Group ID',
type: 'number'
}]}, {
name: 'TargetGroups',
indent: 1,
title: 'Die Gruppen die angeschrieben werden',
type: 'array',
vars: [{
name: 'GroupID',
indent: 1,
title: 'Group ID',
type: 'number'
}]}, {
name: 'Nachricht',
indent: 1,
title: 'Nachricht die geschickt wird / !URL and !ChannelName placeholder',
type: 'string'
}]
}]
}, function(sinusbot, config) {
var engine = require('engine');
var backend = require('backend');
var event = require('event');
var ShowLog = config.ShowLog;
if (typeof ShowLog == "undefined" || ShowLog == '') {
ShowLog = false;
}
var init = config.Triggers;
if (init === undefined) {
engine.log('Not definated - beark loading');
return;
}
event.on('clientMove', function(ev) {
var Client = ev.client;
var Channel = ev.toChannel;
if (typeof Channel == 'undefined' || Channel == '') {
}else{
for(var i = 0; i < init.length; i++){
if(init[i].Channel == Channel.id()){
var Ignore = false;
var ClientGroups = Client.getServerGroups();
for(var j = 0; j < ClientGroups.length; j++){ // die schleife ist falsch
for(var c = 0;c < init[i].IgnoreGroups.length; c++){
if(init[i].IgnoreGroups[c].GroupID==ClientGroups[j].id()){
Ignore = true;
}
}
}
if(Ignore == false){
//ping the right servergroups
var Clients = backend.getClients();
for(var a = 0;a < Clients.length; a++){
ClientGroups = Clients[a].getServerGroups();
for(var b = 0;b < ClientGroups.length; b++){
for(var c = 0;c < init[i].TargetGroups.length; c++){
if(ClientGroups[b].id()==init[i].TargetGroups[c].GroupID){
if(ShowLog){
engine.log(Clients[a]);
}
var URL = "[URL=client://"+Client.databaseID()+"/"+Client.uid()+"]"+Client.name()+"[/URL]";
var ChannelName = Channel.name();
Clients[a].chat(init[i].Nachricht.replace("!URL",URL).replace("!ChannelName",ChannelName));
}
}
}
}
}
}
}
}
});
}
);
Last edited: