|
|
How to make this command working... Like all is okayif (playerCommand.equals("slotmachine") || playerCommand.equals("Slotmachine")){
int hasitem = 500000;
int slot = (Misc.random(1000));
int risked = (hasitem * 100);
if (!c.getItems().playerHasItem(995, hasitem)) {
c.sendMessage("You havent got above "+hasitem+" gp in your inventory.");
return;
}
if (slot = 111,222,333,444,555,666,777,888,999) {
c.sendMessage("You got "+slot+" and lost 500k.");
c.getItems().deleteItem(995, c.getItems().getItemSlot(995), hasitem);
} else {
c.sendMessage("You got "+slot+" and won 100M.");
c.getItems().addItem(995, risked);
}
}
if (slot = 111,222,333,444,555,666,777,888,999) {
mistake here.. can anyone fix it.
Yea like slotmachine if u get 3 same pictures u win,. mine is with numbers..
But yea errors...
What were the errors? Try changing
This
to thisCode:if (slot = 111,222,333,444,555,666,777,888,999) {
I also saw that you are saying that the player would loose if they got the numbers above, is this what you want?Code:if (slot = 111 || 222 || 333 || 444 || 555 ||666 || 777 || 888 || 999) {
No that was another game... i want that if player gets 111,222,333,444,555,666,777,888,999 then he would get 50M... like 500k * 100. but yea it dont work... I am making a Casino to my server thats why im doing all kinds of games.

Code:if (playerCommand.equalsIgnoreCase("slotmachine")){ int hasitem = 500000; int slot = (Misc.random(1000)); int risked = (hasitem * 100); if (!c.getItems().playerHasItem(995, hasitem)) { c.sendMessage("You havent got above "+hasitem+" gp in your inventory."); return; } if (slot == 111 || slot == 222 || slot == 333 || slot == 444 || slot == 555 || slot == 666 || slot == 777 || slot == 888 || slot == 999) { c.sendMessage("You got "+slot+" and won "+(risked/1000000)+"M."); c.getItems().addItem(995, risked); } else { c.sendMessage("You got "+slot+" and lost 500k."); c.getItems().deleteItem(995, c.getItems().getItemSlot(995), hasitem); } }

are you all oblivious to modulus or doesn't that work in Java?Code:if (playerCommand.equalsIgnoreCase("slotmachine")) { int hasitem = 500000; int slit = (Misc.random(1000)); int risked = (hasitem * 100); if (!c.getItems().playerHasItem(995, hasitem)) { c.sendMessage("You need at least " + hasitem + "gp to use this command."); return 0; } if (slot%111==0) { c.sendMessage("You got " + slot + " and won " + (risked/1000000) + "m."); c.getItems().addItem(995, risked); } else { c.sendMessage("You got " + slot + " and lost 500k."); c.getItems().deleteItem(995, c.getItems().getItemSlot(995), hasitem); } }
I was in the middle of making an array. Thanks chainsaw
My title is Java Apprentice for a reason.
| « [PI] Making Monsters Come out Of portals in Pest Control | Vote4Cash!!!! » |
| Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |