Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
const mysql = require('mysql');
const connection = mysql.createConnection({
host: 'localhost',
user: 'root',
password: '9874123HaX',
database: 'haxball_users'
});
connection.connect((err) => {
if (err) {
console.error('Error connecting to database: ' + err.stack);
return;
}
console.log('Database connection established');
});
HaxballJS.then((HBInit) => {
const room = HBInit({
roomName: "HaxBall Online Daily Test #1",
maxPlayers: 16,
public: false,
noPlayer: true,
token: "thr1.AAAAAGXiKVFR5umpmCQ-DA.bwslVj21Tv8",
});
room.setDefaultStadium("Big");
room.setScoreLimit(5);
room.setTimeLimit(0);
let lastMessage = "";
room.onPlayerJoin = (player) => {
room.sendChat(`Hoş geldin ${player.name}! Oyundaki bütün komutlar !yardım ile öğrenebilirsin.`);
};
room.onPlayerChat = (player, message) => {
if (message.startsWith('!kayıt')) {
const parts = message.split(" ");
const command = parts[0];
const password1 = parts.length > 1 ? parts[1] : undefined;
connection.query('SELECT COUNT(*) AS userCount, password FROM users WHERE username = ?', [player.name], (err, results) => {
if (err) {
console.error('Error checking if username exists: ' + err);
return;
}
const userCount = results[0].userCount;
const userPassword = results[0].password;
if (userCount === 1) {
room.sendAnnouncement(`Sunucumuzda kaydınız mevcut, yeni bir kayıt oluşturamazsınız. !giriş ŞİFRE ile giriş yapmalısınız.`, player.id, 0xFF0000, 'bold');
return false;
}
if (password1 && password1.length >= 3 && password1.length <= 15) {
const username = player.name;
connection.query('INSERT INTO users (username, password) VALUES (?, ?)', [username, password1], (err, result) => {
if (err) {
console.error('Error inserting user into database: ' + err);
return;
}
console.log(`${username} isimli oyuncu başarıyla kayıt oldu.`);
room.sendAnnouncement(`${username} isimli oyuncu başarıyla kayıt oldu.`, player.id, 0xFFFFFF, 'bold');
});
return false;
}
room.sendAnnouncement(`Şifreniz en az 3 en fazla 15 karakter olmalıdır.`, player.id, 0xFF0000, 'bold');
return false;
});
return false; // Komut mesajlarını engellemek için
} else if (message.startsWith('!giriş')) {
const parts = message.split(" ");
const command = parts[0];
const password = parts[1];
connection.query('SELECT COUNT(*) AS userCount, password FROM users WHERE username = ?', [player.name], (err, results) => {
if (err) {
console.error('Error checking if username exists: ' + err);
return;
}
const userCount = results[0].userCount;
const userPassword = results[0].password;
if (userCount !== 1) {
room.sendAnnouncement(`Sunucumuzda kaydınız bulunmamaktadır, öncelikle !kayıt komutu ile kayıt oluşturmalısınız.`, player.id, 0xFF0000, 'bold');
return false;
}
if (password === userPassword) {
room.sendAnnouncement(`Hoş geldiniz ${player.name}!`, player.id, 0x00FF00, 'bold');
} else {
room.sendAnnouncement(`Girdiğiniz şifre hatalı, tekrar deneyin.`, player.id, 0xFF0000, 'bold');
}
});
return false; // Komut mesajlarını engellemek için
}
// Diğer mesajların gönderilmesi için
lastMessage = `${player.name}: ${message}`;
room.sendAnnouncement(lastMessage, null, 0xFFFFFF, 'normal');
return false;
};
room.onPlayerLeave = (player) => {
room.sendChat(`${player.name} oyundan ayrıldı.`);
};
room.onRoomLink = function (link) {
console.log(link);
};
});
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team