Hello guys, I am TheCoder75, a novice MCPE coder. This is my first mod in forever. Basically, all the commands are multiplayer compatible. Currently, there is a money system that you can't do anything with yet bc the deposit and withdrawal system is not working. But EVERY other command works.
bankM = money - p[1];
clientMessage("Your bank account now holds:");
clientMessage(bankM);
How about if they deposit money that more than they have? example they have 100 but they deposit 200 ..
and your switch case dont check if the input are number or string, sometimes they will type the p[1]is string and you will add string into your money.
bankM = money - p[1];
clientMessage("Your bank account now holds:");
clientMessage(bankM);
How about if they deposit money that more than they have? example they have 100 but they deposit 200 ..
and your switch case dont check if the input are number or string, sometimes they will type the p[1]is string and you will add string into your money.
No, I do not have Github. But, is there any way you could help me fix this? I have tried multiple things but always got major banking bugs.
But on a completely different subject, do you enjoy the other commands? Any bugs found?
Please press the Green Arrow +1 button if you enjoy the mod besides the major banking bugs.
Hello guys, I am TheCoder75, a novice MCPE coder. This is my first mod in forever. Basically, all the commands are multiplayer compatible. Currently, there is a money system that you can't do anything with yet bc the deposit and withdrawal system is not working. But EVERY other command works.
http://www.mediafire.com/view/qxxidccn8c26atc/MultiPlayerCommandsv1.0.js
Do you have github?
Im interested in this mods
But there are a bad code
No, I do not have Github. But, is there any way you could help me fix this? I have tried multiple things but always got major banking bugs.
But on a completely different subject, do you enjoy the other commands? Any bugs found?
Please press the Green Arrow +1 button if you enjoy the mod besides the major banking bugs.
I dont test it because im asus user, asus user cannot use mods,
i can help you in the code, but you should test it.
function newLevel(){clientMessage(ChatColor.AQUA + "Welcome to Multiplayer Commands v1.0");
clientMessage(ChatColor.AQUA + "/help for commands");
}
function leaveGame(){print("Mod has successfully shut down");
Level.saveData();
}
function procCmd(c) {var p = c.split(" ");
var command = p[0];
switch(command) {
case 'help': {
if(!p[1]) {
clientMessage(ChatColor.BLUE + "Showing help page 1 of 2 (/help <page>)");
clientMessage(ChatColor.RED + "/die");
clientMessage(ChatColor.BLUE + "/coords");
clientMessage(ChatColor.GREEN + "/heal");
clientMessage(ChatColor.RED + "/give <id: amount>");
clientMessage(ChatColor.AQUA + "/credits");
clientMessage(ChatColor.GREEN + "/moneysys");
clientMessage(ChatColor.AQUA + "/balance");
clientMessage(ChatColor.BLUE + "/setH (sets player Health)");
break;
}
if(p[1] == '2'){
clientMessage(ChatColor.BLUE + "Showing help page 2 of 2 (/help <page>)");
clientMessage(ChatColor.AQUA + "/immortal");
break;}
}
case 'balance': {
clientMessage("Your balance is: " + money);
break;}
case 'heal': {
if(Level.getGameMode() == 0) {
Player.setHealth(20);
clientMessage("You have successfully healed yourself.");
} else clientMessage("You are on creative !");
break;}
case 'die' : {
if(Level.getGameMode() == 0) Player.setHealth(0);
else clientMessage("You are on creative !");
break;}
case 'coords': {
clientMessage("Your coordinates are:");
clientMessage("X: " + parseInt(getPlayerX()));
clientMessage("Y: " + parseInt(getPlayerY()));
clientMessage("Z: " + parseInt(getPlayerZ()));
break;}
case 'setH': {
if(typeof(p[1]) == int) {
clientMessage("You have set your health to: " + p[1]);
Player.setHealth(p[1]);
} else {
clientMessage("Please enter a number");
}
break;}
case 'credits': {
clientMessage("I coded this mod all by myself. No");
clientMessage("reason to have this command :D");
break;}
case 'moneysys': {
clientMessage("/bank to see your bank balance");
clientMessage(ChatColor.RED + "/deposit <amount>");
clientMessage(ChatColor.RED + "/withdraw <amount");
clientMessage(ChatColor.AQUA + "Bank your money to avoid loss.");
break;}
case 'give': {
addItemInventory(p[1], p[2]);
clientMessage("You have been given " + p[2] + " of " + p[1]);
break;}
case 'deposit': {
if(money >= p[1]) {
bankM = money - p[1];
clientMessage("Your bank account now holds:");
clientMessage(bankM);
} else
clientMessage("You don't have enough money");
break;}
case 'withdraw': {
if(bankM >= p[1]) {
bankM = bankM - p[1];
money = p[1] + money;
clientMessage("You have withdrawn: " + p[1]);
clientMessage("You now have " + money + " on hand.");
clientMessage("And " + bankM + "in the bank.");
} else clientMessage("You don't have money: " + p[1] + " In your bank");
break;}
case 'immortal': {
clientMessage("You are immortal now");
Player.setHealth(100000000);
break;}}}
Thank you so much!!! TESTING IT NOW
if some error tell me.
Yes, the save data function does not work
ModPE.saveData()
ModPE.readData()
Anyway to make it save for a certain world? Every world has the same money
First
Save the world name to ModPE.saveData
then if player join world
var worldName = ModPE.readData(blaba,balbal);
function newLevel() {
if(Level.getWorldDir() == worldName) {
ModPE.readData();
ModPE.readData();ModPE.readData();
}}
function leaveGame() {
if(Level.getWorldDir() == worldName) {
ModPE.saveData()
ModPE.saveData()
ModPE.saveData()
}
}