PDA

View Full Version : Make everybody say that your server rulez! (command)



lazyfatguy
February 9th, 2011, 14:57
Hey, this is my first thread ever... so plz say it if I did something wrong! :)

so.... first go to client.java and search for


public class client extends Player implements Runnable {
Under that add

public void NAME()
{
for (Player p : server.playerHandler.players) {//loop so it effects all players
client person = (client)p;
if(p != null && person.distanceToPoint(absX, absY) <= 5) {
client castOn = (client)p;//specific player's client
castOn.plrText = "YOUR SERVER rulez!";
castOn.plrTextUpdateRequired = true;
castOn.setAnimation(2109);
castOn.updateRequired = true;
castOn.appearanceUpdateRequired = true;
}
}
}

Change the NAME to the name you want it to have (it doesn't matter what...)
And change the YOUR SERVER to your server name!
Ok..
Next... the command to make them say it!
search for
private void customCommand(String command)
And add
if(command.startsWith("ANYTHING") && (playerRights >= 3)) {
NAME();
}
after that.
Change the ANYTHING to the name you want the command to be and change the NAME to what you picked before.
(public void NAME)
Compile and test it! :D

Extra:
To make every npc same it too (idea from SolitudeX).

search:

public void NAME()
{
for (Player p : server.playerHandler.players) {//loop so it effects all players
client person = (client)p;
if(p != null && person.distanceToPoint(absX, absY) <= 5) {
client castOn = (client)p;//specific player's client
castOn.plrText = "YOUR SERVER rulez!";
castOn.plrTextUpdateRequired = true;
castOn.setAnimation(2109);
castOn.updateRequired = true;
castOn.appearanceUpdateRequired = true;
}
}
}

and change it to



public void NAME()
{
for (Player p : server.playerHandler.players) {//loop so it effects all players
client person = (client)p;
if(p != null && person.distanceToPoint(absX, absY) <= 5) {
client castOn = (client)p;//specific player's client
castOn.plrText = "YOUR SERVER rulez!";
castOn.plrTextUpdateRequired = true;
castOn.setAnimation(2109);
castOn.updateRequired = true;
castOn.appearanceUpdateRequired = true;
}
}
try {
for(int i = 0; i < server.npcHandler.npcs.length; i++) {
try {
if(server.npcHandler.npcs[i] != null) {
server.npcHandler.npcs[i].updateRequired = true;
server.npcHandler.npcs[i].textUpdateRequired = true;
server.npcHandler.npcs[i].textUpdate = "YOUR SERVER rulez!";
}
} catch (Exception e) {
sM("Npc "+i+" was not able to shout...");
}
}
} catch (Exception e) {
sM("Didn't work...");
}
}

Compile and test! :D

2kbarrows
February 9th, 2011, 14:59
Not very hard...
Next time, try to use a cleaner format, and better grammar, other than that good job.

SIR MOJO
February 9th, 2011, 15:02
Going to add to my server!

SolitudeX
February 9th, 2011, 15:05
These are useless sorry to say..

lazyfatguy
February 9th, 2011, 15:06
K :l .. Thanks for the advice :) (i'm Dutch... that's why my grammar sucks probably...)

SolitudeX
February 9th, 2011, 15:18
It's fine grammar.. Haha make a cool command where it Vent's through the NPC's

2kbarrows
February 9th, 2011, 15:20
It's fine grammar.. Haha make a cool command where it Vent's through the NPC's

Actually it's not >.>.
Not really useless...
If you made this, it's useful, maybe it's a better method.

SolitudeX
February 9th, 2011, 15:29
Actually it's not >.>.
Not really useless...
If you made this, it's useful, maybe it's a better method.

User's don't like venting stupid stuff.

lazyfatguy
February 10th, 2011, 15:22
I added the npc thingy :D

Major
February 10th, 2011, 17:12
Quite a lot of servers have this built in, but nice. Been released before, but all the same, Gj.

lazyfatguy
February 10th, 2011, 17:45
Tnx :D

Hakam
February 15th, 2011, 16:21
Not much effort on it. But somehow, its kind of useful.

Marcus01
February 15th, 2011, 16:27
Yes, players may be in a conversation having been interrupted and having to say "amgz thiz server rulez so muchz". Its just not what players want.

lazyfatguy
February 18th, 2011, 19:00
Haha.. maybe they're having a very important converstation on a rsps :P but you're right... xD

Nouish
March 17th, 2011, 20:09
Please use conventions:


public void NAME() {
for (Player p : server.playerHandler.players) {
client person = (client) p;
if (p != null && person.distanceToPoint(absX, absY) <= 5) {
person.plrText = "YOUR SERVER rulez!";
person.plrTextUpdateRequired = true;
person.setAnimation(2109);
person.updateRequired = true;
person.appearanceUpdateRequired = true;
}
}
}

lazyfatguy
March 27th, 2011, 11:46
Ok...

CurrentTheory
April 12th, 2011, 19:41
Isn't there a method very much like it, in most sources?

terrorz69
April 13th, 2011, 21:03
lol, this is awesome.

lazyfatguy
May 7th, 2011, 19:19
Thank you :D

darknationpk
May 7th, 2011, 19:31
Useless command.

lazyfatguy
May 12th, 2011, 19:20
Thanks alot

Crocodile
May 21st, 2011, 22:13
Keeps tellin me 1 error when i compile and i dont know what it is?

lazyfatguy
May 29th, 2011, 16:02
Me neither.. I can't see what the error is xD

pk flavor
June 4th, 2011, 02:27
good job bro :D

Starkzter
January 1st, 2012, 11:14
Isn't there a simple "Hail" command you can add to Commands.java file that is way easier to do then this?