chat.registerCmd("createuser", (player, args) =>{
if (args[0] === '/createuser' && args.length === 3) {
const socialClubId = player.socialClubId;
const username = args[1];
const password = args[2];
const userData = {
socialClubId: socialClubId,
username: username,
password: password
};
const userDataPath = `${playerDataDirectory}${socialClubId}.json`;
fs.writeFileSync(userDataPath, JSON.stringify(userData), 'utf8');
chat.send(player, 'Benutzer erstellt.', { color: new alt.RGBA(0, 255, 0) });
}
});
chat.registerCmd("login", (player, args) =>{
if (args[0] === '/login' && args.length === 4) {
const socialClubId = args[1];
const username = args[2];
const password = args[3];
const user = userDatabase[socialClubId];
if (user && user.username === username && user.password === password) {
loggedInPlayers.set(player.id, user);
chat.send(player, `Willkommen, ${username}! Du bist jetzt eingeloggt.`, { color: new alt.RGBA(0, 255, 0) });
} else {
chat.send(player, 'Ungültige Anmeldedaten.', { color: new alt.RGBA(255, 0, 0) });
}
}
});
chat.registerCmd("logout", (player, args) =>{
if (args[0] === '/logout') {
if (loggedInPlayers.has(player.id)) {
loggedInPlayers.delete(player.id);
chat.send(player, 'Du bist jetzt ausgeloggt.', { color: new alt.RGBA(255, 0, 0) });
} else {
chat.send(player, 'Du bist nicht eingeloggt.', { color: new alt.RGBA(255, 0, 0) });
}
}
});
chat.registerCmd("xp", (player, args) =>{
if (args[0] === '/xp') {
if (loggedInPlayers.has(player.id)) {
const user = loggedInPlayers.get(player.id);
chat.send(player, `Deine Erfahrungspunkte: ${user.experience}`);
} else {
chat.send(player, 'Du bist nicht eingeloggt.', { color: new alt.RGBA(255, 0, 0) });
}
}
});
chat.registerCmd("earnxp", (player, args) =>{
if (args[0] === '/earnxp') {
if (loggedInPlayers.has(player.id)) {
const user = loggedInPlayers.get(player.id);
user.experience = (user.experience || 0) + 10;
saveUserData();
chat.send(player, 'Du hast 10 Erfahrungspunkte verdient.');
} else {
chat.send(player, 'Du bist nicht eingeloggt.', { color: new alt.RGBA(255, 0, 0) });
}
}
});
alt.on('chat:message', (player, message) => {
if (message === '/pray') {
if (!prayingPlayers.has(player)) {
prayingPlayers.add(player);
chat.send(player, 'Du hast mit dem Beten begonnen. Führe /stoppray aus, um aufzuhören.');
alt.emitClient(null, 'player:startPraying', player.id);
} else {
chat.send(player, 'Du betest bereits.');
}
}
});
alt.on('chat:message', (player, message) => {
if (message === '/stoppray') {
if (prayingPlayers.has(player)) {
prayingPlayers.delete(player);
chat.send(player, 'Du hast aufgehört zu beten.');
alt.emitClient(null, 'player:stopPraying', player.id);
} else {
chat.send(player, 'Du betest nicht.');
}
}
});
chat.registerCmd("createsoul", (player, args) =>{
if (args[0] === '/createsoul' && args.length >= 3) {
const soulName = args[1];
const personality = player.socialClubId;
const ability = args[2];
const level = args[3];
const soul = {
name: soulName,
personality: personality,
ability: ability,
level: level
};
playerSoulDatabase.set(player.id, soul);
saveSoulData();
chat.send(player, `Deine Seele '${soulName}' mit der Charaktereigenschaft '${personality}' wurde erschaffen.`);
}
});
chat.registerCmd("viewsoul", (player, args) =>{
if (args[0] === '/viewsoul') {
const soul = playerSoulDatabase.get(player.id);
if (soul) {
chat.send(player, `Deine Seele '${soul.name}' hat die Charaktereigenschaft '${soul.personality}'.`);
} else {
chat.send(player, 'Du hast noch keine Seele erschaffen.');
}
}
});
alt.on('chat:message',(player,message) =>{
if (message == '/editsoul'){
if(playerSoulDatabase.has(player.id)){
//
}
else{
//
}
}
});
alt.on('chat:message', (player, message) => {
if (message === '/deletesoul') {
if (playerSoulDatabase.has(player.id)) {
playerSoulDatabase.delete(player.id);
saveSoulData();
chat.send(player, 'Deine Seele wurde gelöscht.');
} else {
chat.send(player, 'Du hast keine Seele, die du löschen könntest.');
}
}
});
Alles anzeigen