Code:for (int i = 0; i < c.playerEquipment.length; i++) { if (c.playerEquipment[i] > 0) { c.sendMessage("Take your items off before using this function."); return; } }
|
Should've posted this in my first post today but, is there a way that when someone clicks on the portal to enter the minigame, if you are wearing armor or have items in your inventory you must bank them before entering?, I've been it before it other servers but i never really played with it before.
Code:for (int i = 0; i < c.playerEquipment.length; i++) { if (c.playerEquipment[i] > 0) { c.sendMessage("Take your items off before using this function."); return; } }
I've never done this before, but would it look like this?
Code:/**Going into the zombie Minigame**/ } else if (client.objectX == 2464 && client.objectY == 4783) { // Object Coords, for (int i1 = 0; i < client.playerEquipment.length; i++) { if (client.playerEquipment[i1] > 0) { client.sendMessage("Take your items off before using this function."); return; } } } else { client.getPA().startTeleport(2525, 4776, 0, "modern"); client.sendMessage("<b><col=ff0000>You have been given a few starter items to begin."); client.sendMessage("<b><col=ff0000>Zombies will drop items for you to use also."); client.sendMessage("<b><col=ff0000>PREPARE TO FIGHT FOR YOUR LIFE."); client.getPA().addZombieStarter(); break; }
//Eclipse keeps telling me "int i" is already declared as a local variable just they're something that shouldn't even effect it ._.
Never mind i just removed the "int" part, thanks guys it works! :]
Woops, didn't realize you fixed.
If I recall correctly, isn't a lack of an item represented by a -1 and not a zero?
So it should be:
Code:for (int i = 0; i < c.playerEquipment.length; i++) { if (!c.playerEquipment[i] = -1) { c.sendMessage("Take your items off before using this function."); return; } }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |