Hello Guys,
I am working on a littel script for my server.
The idea is that you can write in the channel chat "!sperren" and the channel is closed.
But I want, that the channel becomes his original name after writing "!entsperren". And their is the problem.
I dont know how I become the channel name. I have already tried with an channel update event, but this is really bad.
I hope you can help me, and sry for my bad English.
And thank you!
I am working on a littel script for my server.
The idea is that you can write in the channel chat "!sperren" and the channel is closed.
But I want, that the channel becomes his original name after writing "!entsperren". And their is the problem.
I dont know how I become the channel name. I have already tried with an channel update event, but this is really bad.
I hope you can help me, and sry for my bad English.
And thank you!
Code:
registerPlugin({
name: 'SperreChannel',
version: '1.0',
description: 'Sperrt auf Befehl den Channel in dem man sich befindet.',
author: '--------- <-------->',
},
function(sinusbot, config) {
var clientId;
var clientUid;
var channel;
var channel_name;
var gesperrt;
var id;
sinusbot.on('chat', function(ev) {
if(ev.mode == 2){
if(ev.msg == "!sperren"){
if(gesperrt != "true"){
clientId = ev.clientId;
clientUid = ev.clientUid
channel = ev.channel;
id = sinusbot.getCurrentChannelId();
chatPrivate(clientId, sinusbot.getCurrentChannelId())
if(id == channel){
if(gesperrt != "true"){
channel_name = ev.name;
chatServer('Der Channel "' + channel_name + '" ist nun gesperrt!')
gesperrt = "true";
channelUpdate(channel, { name: 'GESPERRT', maxClients: 1})
chatPrivate(clientId, "Der Channel ist nun gesperrt!")
}
}
} else {chatPrivate(ev.clientId, "Leider kann im moment erstmal nur ein Channel gesperrt sein. Dies wird aber noch ausgebessert!")}
}
if(ev.msg == "!entsperren"){
if(gesperrt == "true"){
if(clientId == ev.clientId){
chatServer('Der Channel "' + channel_name + '" ist nun entsperrt!')
gesperrt = "false";
channelUpdate(channel, { name: channel_name, maxClients: 32})
chatPrivate(clientId, "Der Channel ist nun entgesperrt!")
} else {chatPrivate(ev.clientId, "Du kannst den Channel nicht entsperren!")}
} else {chatPrivate(ev.clientId, "Leider kann im moment erstmal nur ein Channel gesperrt sein. Dies wird aber noch ausgebessert!")}
}
}
});
});