making the variable static means it won't thread off per instance/client, remove the static and you're good.
|
In my client.java I have a method for protect of melee:
Code:public static boolean praymelee = false;
In my NPCHandler I have this:
But it affects all players? I just don't understand, would I have to change it to:Code:if(npc == 1615 && client.praymelee == true) { addSlayerItem(4); }
I don't know how to do this without affecting every player? I just can't remember how to do it. If anyone could help me out I would be greatly appreciated.Code:private static boolean
making the variable static means it won't thread off per instance/client, remove the static and you're good.
idk try dat. If that's wut you mean...Code:if(npc == 1615 && client.praymelee == true && client.playerName.equalsIgnoreCase("name") ) { addSlayerItem(4); } else { return; }
What are you trying to accomplish? Is the if statement in some kind of attack NPC method? I'll assume it is.
Lets assume its:
Add a Client parameter to the method, and whenever you call that method pass in the Client object that's calling it.Code:public void attackNpc(int npc) { if(npc == 1615 && client.praymelee == true) { addSlayerItem(4); } }
Then you have access to that client and you can see if the boolean is true or not.
No. Not trying to be rude, but why does it say "Server Programmer" in your user title if you can't even understand what a parameter is...
Defining Methods (The Java™ Tutorials > Learning the Java Language > Classes and Objects)
Once you read that, hopefully you'll understand.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |