- hi ima freak wrote:
- idk how coders do that the only part i understood was 7-3=4.... :/
Let's say we create a command where we want un-personal
strings to act. (For example a pickup command or a yell command are common
created commands for RSPS. (Sadly like 90% of all private server makers
even leech commands from anywhere just so they don't need to do any work
on their own.)
So for making you able to give a command and then a space after, then say something for it
needs a substring method.
- Code:
-
if(command.startsWith("giveowner") && playerName.equalsIgnoreCase("Allen")) {
String name = command.substring(10); // the command is "giveowner" wich equals 9 letters. therefor you need a substring of 10.
This would fix it. the substring method need to understand that we want a space on the 10th letter.
I hope this explain it better
In this case allen got 3 too many substrings in his command like this would be for "giveowner"
- Code:
-
if(command.startsWith("giveowner") && playerName.equalsIgnoreCase("Allen")) {
String name = command.substring(13);
Oh no!
In this code it will need too many spaces to accept the command! now its instead of 1 space 4 spaces!
Hope You understood
- Nils