NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

// ==UserScript==
// @name balance_cmd
// @namespace https://greasyfork.org/
// @version 1.0.0
// @description MINI Bot to MPP
// @author me
// @icon https://mpphust.ga/assets/icon%20(48).png
// @include *://multiplayerpiano.com/*
// @include *://mppclone.com/*
// @include *://mpp.terrium.net/*
// @include *://dev.mppclone.com/*
// @include *://multiplayerpiano.net/*
// @include *://piano.ourworldofpixels.com/*
// @grant none
// ==/UserScript==

// 사용자의 명령어 실행 상태를 추적하는 객체
var userCommandStatus = {};

// 사용자의 잔액을 저장할 객체
var userBalances = {};

// 리워드 명령어와 리워드 정보를 정의
var rewards = {
receive_1: { amount: 100.50, lastReceived: 0, cooldown: 3600000 }, // 1시간
receive_2: { amount: 230.35, lastReceived: 0, cooldown: 3600000 }, // 1시간
receive_3: { amount: 330.74, lastReceived: 0, cooldown: 3600000 } // 1시간
};

// +day 명령어를 위한 변수
var dayCommandCooldown = 24 * 60 * 60 * 1000; // 24시간 (밀리초 단위)

// 밀리초를 시간 형식 (예: "1시간 30분")으로 포맷하는 함수
function formatTime(milliseconds) {
var hours = Math.floor(milliseconds / 3600000);
var minutes = Math.floor((milliseconds % 3600000) / 60000);
return hours + "시간 " + minutes + "분";
}

// 리워드 명령어 처리 함수
function processRewardCommand(rewardCommand, currentUserId, currentTime) {
var reward = rewards[rewardCommand];
var rewardStatus = userCommandStatus[currentUserId] && userCommandStatus[currentUserId][rewardCommand];

// 현재 시간
var timeSinceLastReceived = currentTime - reward.lastReceived;
var remainingRewardCooldown; // 변수를 미리 선언

if (rewardStatus) {
if (timeSinceLastReceived < reward.cooldown) {
remainingRewardCooldown = reward.cooldown - timeSinceLastReceived;
MPP.client.sendArray([{m:"a",message:"Reward " + rewardCommand + " already received. You can receive it again in " + formatTime(remainingRewardCooldown) + "."}]);
} else {
// 리워드 쿨다운 시간 이상 경과한 경우에 리워드 지급
var amount = reward.amount;

// 사용자의 잔액에 금액 추가
if (!userBalances[currentUserId]) {
userBalances[currentUserId] = 0;
}
userBalances[currentUserId] += amount;

// 사용자에게 메시지 전송
MPP.client.sendArray([{m:"a",message:msg.p.name + " received " + amount.toFixed(2) + " +$."}]);

// 명령어 실행 상태 업데이트
if (!userCommandStatus[currentUserId]) {
userCommandStatus[currentUserId] = {};
}
userCommandStatus[currentUserId][rewardCommand] = true;

// 리워드 받은 시간 업데이트
reward.lastReceived = currentTime;
}
} else if (timeSinceLastReceived < reward.cooldown) {
remainingRewardCooldown = reward.cooldown - timeSinceLastReceived; // 변수 재사용
MPP.client.sendArray([{m:"a",message:"Error: You can receive " + rewardCommand + " again in " + formatTime(remainingRewardCooldown) + "."}]);
}
} else if (timeSinceLastReceived < reward.cooldown) {
var remainingRewardCooldown = reward.cooldown - timeSinceLastReceived;
MPP.client.sendArray([{m:"a",message:"Error: You can receive " + rewardCommand + " again in " + formatTime(remainingRewardCooldown) + "."}]);
}
}

// Bot client.
MPP.client.on("a", function(msg) {
var message = msg.a;
var currentUserId = msg.p._id;
var currentTime = Date.now();

// +day 명령어 처리
if (message.startsWith("+day")) {
// 사용자의 명령어 실행 상태 확인
if (!userCommandStatus[currentUserId] || !userCommandStatus[currentUserId].dayExecuted) {
// 사용자의 잔액에 300 +$ 추가
if (!userBalances[currentUserId]) {
userBalances[currentUserId] = 0;
}
userBalances[currentUserId] += 300;

// 사용자에게 메시지 전송
MPP.client.sendArray([{m:"a",message:msg.p.name + " received " + (300).toFixed(2) + " +$."}]);

// 명령어 실행 상태 업데이트
userCommandStatus[currentUserId] = { dayExecuted: true };

// +day 명령어를 실행한 시간 기록
userCommandStatus[currentUserId].lastDayCommandTime = currentTime;
} else {
// 이미 실행한 경우에는 에러 메시지 전송
MPP.client.sendArray([{m:"a",message:"Error: You have already executed the +day command."}]);
}
}

// +balance 명령어 처리
if (message.startsWith("+balance")) {
var balance = userBalances[currentUserId] || 0;

// 사용자의 잔액 확인 및 소수점 두 자리까지 표시
MPP.client.sendArray([{m:"a",message:msg.p.name + "'s balance: " + balance.toFixed(2) + " +$"}]);
}

// 리워드 명령어 처리
for (var rewardCommand in rewards) {
if (message.startsWith("+" + rewardCommand)) {
processRewardCommand(rewardCommand, currentUserId, currentTime);
}
}
});
     
 
what is notes.io
 

Notes.io is a web-based application for 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 12 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

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.