I am making a commands mod, and everything else is working except when I do it a gain! I have done the script the same way as I made the other commands! Place help!
} case 'spawncreeper': {
I did all the functions and all the other things to get it to work, but when I go to use it, it says "syntax error"
What do I need to change?
Rollback Post to RevisionRollBack
Click Banner to SUBSCRIBE!!! I'm in the Team Flame Clan!!! Click that little green arrow!! -------------->
function procCmd(c) {
var p = c.split(" ");
var command = p[0];
switch(command) {
case 'commands': {
clientMessage("\nCommands:n/commands, /help <command>, /explode, /give");
break;
} case 'help': {
clientMessage("\nShowing help page 1 of 2 (/help <page>)\n /help<page>\n /give <ID> <amount>\n /info\n /heal\n /die");
break;
} case 'help2': {
clientMessage("Showing help page 2 of 2 (/help <page>)\n /godmode\n /coords\n /tp <x,y,z>\n /explode <radius>\n /time set <day or night>");
break;
} case 'give': {
addItemInventory(p[1],p[2]);
clientMessage("Spawned " + p[2] + " of " + p[1] + "!");
break;
} case 'info': {
clientMessage("Made by 99FireyMan99, Version 1.0")
break;
} case 'heal': {
Player.setHealth(20);
clientMessage("You have been healed!")
break;
} case 'die': {
Player.setHealth(0);
break;
} case 'godmode': {
Player.setHealth(32767);
clientMessage("Godmode has been enabled!")
break;
} case 'coords': {
clientMessage("\nCurrent coordinates are:\nx: " + Math.floor(getPlayerX()) + " y: " + Math.floor(getPlayerY() - 1) + " z: " + Math.floor(getPlayerZ()));
break;
} case 'tp': {
setPosition(getPlayerEnt(), parseInt(p[1]), parseInt(p[2]), parseInt(p[3]));
clientMessage("\nTeleported to x: " + parseInt(p[1]) + ", y: " + parseInt(p[2]) + ", z: " + parseInt(p[3]));
break;
} case 'explode': {
explode(getPlayerX(), getPlayerY(), getPlayerZ(), p[1]);
clientMessage("BOOOOM!!!!");
break;
} case 'knockback': {
addItemInventory(267, 1);
clientMessage("Knockback Sword, Thanks to: Darth377");
} case 'time': {
if(p[1] == 'set') {
if(p[2] == 'day' || p[2] == 'daytime') {
Level.setTime(0);
clientMessage("Time set to day!");
break;
} if(p[2] == 'night') {
Level.setTime(8280);
clientMessage("Time set to night!");
}
}
break;
} case 'spawncreeper': {
Entity.spawnMob(Player.getX(),Player.getY(),Player.getZ(),33,'mob/creeper.png');
clientMessage("Creeper spawned!");
break;
}
}
}
What to improve on:
-Indent your code. Doing this will help you find where you missed { or }. It also makes your script much more human-readable
-Match every { with a }. You missed many }, and also you sometimes went crazy with the { and }, as shown here:
-The hook procCmd needs some parameters. In your script, it looks like it should be a 'c' (Looks very similar to mine...)
-You had two 'commands' cases, and two 'help' cases. You also had a random switch.
-You missed a ; on the cases tp and info.
-You missed a 'break;' after the knockback case.
-The knockback sword does nothing in this script.
If I helped, please click that little green arrow
Thank you soo much Connor!
Rollback Post to RevisionRollBack
Click Banner to SUBSCRIBE!!! I'm in the Team Flame Clan!!! Click that little green arrow!! -------------->
To post a comment, please login or register a new account.
} case 'spawncreeper': {
I did all the functions and all the other things to get it to work, but when I go to use it, it says "syntax error"
What do I need to change?
Click Banner to SUBSCRIBE!!! I'm in the Team Flame Clan!!! Click that little green arrow!! -------------->
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumIf I helped in any way, feel free to drop me an Internet:

Or some Blue XP:
A test to see what number is most thought of when a 1-10 choice is given: strawpoll.me/4012187
Don't think about it, just click on the first one that comes to you!
function procCmd(c){
var p = c.split(" ");
var command = p[0];
switch(command) {
case 'commands': {
clientMessage(" Showing help page ")
} case 'commands': {
clientMessage("\nCommands:n/commands, /help <command>, /explode, /give");
break;
} case 'help': {
}switch(p[1]) {
} case 'help': {
clientMessage("\nShowing help page 1 of 2 (/help <page>)\n /help<page>\n /give <ID> <amount>\n /info\n /heal\n /die");
break;
} case 'help2': {
clientMessage("Showing help page 2 of 2 (/help <page>)\n /godmode\n /coords\n /tp <x,y,z>\n /explode <radius>\n /time set <day or night>");
break;
} case 'give': {
addItemInventory(p[1],p[2]);
clientMessage("Spawned " + p[2] + " of " + p[1] + "!");
break;
} case 'info': {
clientMessage("Made by 99FireyMan99, Version 1.0")
break;
} case 'heal': {
Player.setHealth(20);
clientMessage("You have been healed!")
break;
} case 'die': {
Player.setHealth(0);
break;
} case 'godmode': {
Player.setHealth(32767);
clientMessage("Godmode has been enabled!")
break;
} case 'coords': {
clientMessage("\nCurrent coordinates are:\nx: " + Math.floor(getPlayerX()) + " y: " + Math.floor(getPlayerY() - 1) + " z: " + Math.floor(getPlayerZ()));
break;
} case 'tp': {
setPosition(getPlayerEnt(), parseInt(p[1]), parseInt(p[2]), parseInt(p[3]));
clientMessage("\nTeleported to x: " + parseInt(p[1]) + ", y: " + parseInt(p[2]) + ", z: " + parseInt(p[3]))
break;
} case 'explode': {
explode(getPlayerX(), getPlayerY(), getPlayerZ(), p[1]);
clientMessage("BOOOOM!!!!");
break;
} case 'knockback': {
addItemInventory(267, 1);
clientMessage("Knockback Sword, Thanks to: Darth377");
} case 'time': {
if(p[1] == 'set') {
if(p[2] == 'day' || p[2] == 'daytime') {
Level.setTime(0);
clientMessage("Time set to day!");
break;
} if(p[2] == 'night') {
Level.setTime(8280);
clientMessage("Time set to night!");
break;
} case 'spawncreeper': {
clientMessage("Creeper spawned!");
Click Banner to SUBSCRIBE!!! I'm in the Team Flame Clan!!! Click that little green arrow!! -------------->
-
View User Profile
-
View Posts
-
Send Message
Curse Premiumfunction procCmd©{ var p = c.split(" "); var command = p[0]; switch(command) { case 'commands': { clientMessage(" Showing help page ") } case 'commands': { clientMessage("\nCommands:n/commands, /help , /explode, /give"); break; } case 'help': { }switch(p[1]) { } case 'help': { clientMessage("\nShowing help page 1 of 2 (/help )\n /help\n /give \n /info\n /heal\n /die"); break; } case 'help2': { clientMessage("Showing help page 2 of 2 (/help )\n /godmode\n /coords\n /tp \n /explode \n /time set "); break; } case 'give': { addItemInventory(p[1],p[2]); clientMessage("Spawned " + p[2] + " of " + p[1] + "!"); break; } case 'info': { clientMessage("Made by 99FireyMan99, Version 1.0") break; } case 'heal': { Player.setHealth(20); clientMessage("You have been healed!") break; } case 'die': { Player.setHealth(0); break; } case 'godmode': { Player.setHealth(32767); clientMessage("Godmode has been enabled!") break; } case 'coords': { clientMessage("\nCurrent coordinates are:\nx: " + Math.floor(getPlayerX()) + " y: " + Math.floor(getPlayerY() - 1) + " z: " + Math.floor(getPlayerZ())); break; } case 'tp': { setPosition(getPlayerEnt(), parseInt(p[1]), parseInt(p[2]), parseInt(p[3])); clientMessage("\nTeleported to x: " + parseInt(p[1]) + ", y: " + parseInt(p[2]) + ", z: " + parseInt(p[3])) break; } case 'explode': { explode(getPlayerX(), getPlayerY(), getPlayerZ(), p[1]); clientMessage("BOOOOM!!!!"); break; } case 'knockback': { addItemInventory(267, 1); clientMessage("Knockback Sword, Thanks to: Darth377"); } case 'time': { if(p[1] == 'set') { if(p[2] == 'day' || p[2] == 'daytime') { Level.setTime(0); clientMessage("Time set to day!"); break; } if(p[2] == 'night') { Level.setTime(8280); clientMessage("Time set to night!"); break; } case 'spawncreeper': { clientMessage("Creeper spawned!");Do that next time. Makes it easier to see, and therefore easier to fix.
Check out my game! It's an open-world, sandbox text adventure.
Follow @hexdro_
Hexdro © 2012-2015
Click Banner to SUBSCRIBE!!! I'm in the Team Flame Clan!!! Click that little green arrow!! -------------->
Click Banner to SUBSCRIBE!!! I'm in the Team Flame Clan!!! Click that little green arrow!! -------------->