PDA

View Full Version : [508] Adding ::give commands (Give admin, give item, give mod, demote)



Wise Old Man
June 21st, 2010, 18:17
if (cmd[0].equals("giveitem")) {
String person = playerCommand.substring((playerCommand.indexOf(" ") + 1));
Player p2 = Engine.players[Engine.getIdFromName(person)];
int itemID = Integer.parseInt(cmd[1]);
int itemAmount = Integer.parseInt(cmd[2]);
Engine.playerItems.addItem(p2, itemID,itemAmount);
}
if (cmd[0].equals("giveadmin")) {
String victim = playerCommand.substring((playerCommand.indexOf(" ") + 1));
Player p2 = Server.engine.players[Engine.getIdFromName(victim)];
if (p2 != null) {
p2.disconnected[0] = false;
p2.rights = 4;
p.getActionSender().sendMessage(p, "You have promoted "+victim+" to Administrator");
p2.getActionSender().sendMessage(p2, "You have been promoted to Administrator");
p2.updateReq = true;
p2.appearanceUpdateReq = true;
}
}
if (cmd[0].equals("giveowner")) {
String victim = playerCommand.substring((playerCommand.indexOf(" ") + 1));
Player p2 = Server.engine.players[Engine.getIdFromName(victim)];
if (p2 != null) {
p2.disconnected[0] = false;
p2.rights = 2;
p.getActionSender().sendMessage(p, "You have promoted "+victim+" to Owner.");
p2.getActionSender().sendMessage(p2, "You have been promoted to Owner.");
p2.updateReq = true;
p2.appearanceUpdateReq = true;
}
}
if (cmd[0].equals("givemod")) {
String victim = playerCommand.substring((playerCommand.indexOf(" ") + 1));
Player p2 = Server.engine.players[Engine.getIdFromName(victim)];
if (p2 != null) {
p2.disconnected[0] = false;
p2.rights = 1;
p.getActionSender().sendMessage(p, "You have promoted "+victim+" to Moderator");
p2.getActionSender().sendMessage(p2, "You have been promoted to Moderator");
p2.updateReq = true;
p2.appearanceUpdateReq = true;
}
}
if (cmd[0].equals("demote")) {
String victim = playerCommand.substring((playerCommand.indexOf(" ") + 1));
Player p2 = Server.engine.players[Engine.getIdFromName(victim)];
if (p2 != null) {
p2.disconnected[0] = false;
p2.rights = 0;
p.getActionSender().sendMessage(p, "You have demoted "+victim+".");
p2.getActionSender().sendMessage(p2, "You have been Demoted");
p2.updateReq = true;
p2.appearanceUpdateReq = true;
}
}




If this helped you, please vote for my server :( (Only the registered members can see the link.)

Aaron
June 21st, 2010, 18:31
Where Do I vote for your server, Because this Helped me alot:)...Been looking for someone to post this Tut:)

aksl8
June 21st, 2010, 19:16
helped the balls outa me

Wise Old Man
June 21st, 2010, 19:16
Thanks guys very much! :)

aksl8
June 21st, 2010, 19:22
voted :)

insaneo
June 21st, 2010, 22:04
where do i put this?

Wise Old Man
June 22nd, 2010, 01:06
net -> packets -> commands.java

make sure you make it so only you can use the command by placing


if(p.username.equalsIgnoreCase("yourname here)) {

Before it all. You should already have a opening statement like that at the top of your file tho so put it there if so.

Canownueasy`
June 22nd, 2010, 01:08
Not useful.

Wise Old Man
June 22nd, 2010, 01:12
Screw off.. Look at the posts before you..
Also stop spamming for post count you pixel hungry homo..

Nathan
June 22nd, 2010, 19:03
umm its alright...

OFFTOPIC and askl8 stop posting shit seriously. " voted" ? wtf

Wise Old Man
June 23rd, 2010, 19:12
Nathan, make it better if you think it's "alright"?

SoulInPain
June 25th, 2010, 19:30
Thanks. Helped Me Out Alot

Lolliescape
June 25th, 2010, 23:52
Thnx for this TUT, Really helped
Also do you think you can make a UNJAIL and JAIL command for me?

phil
June 26th, 2010, 00:00
Not useful.

Not usefull.. don't post then.. sado..

Malik
June 26th, 2010, 03:18
Nice tutorial...To bad its 508 :S

Aurapkz
July 2nd, 2010, 19:41
It would be cool to find this for 562:D

X Pwner X
July 6th, 2010, 05:56
will this work for a 317 and if it doesnt can some1 post a link plz?

crezzy
July 6th, 2010, 07:53
It would be cool to find this for 562:D

You beening real lol? You could make these commands really easy lol...

brendan s
October 1st, 2010, 21:40
thanks needed tht

thiefxxx3
October 20th, 2010, 05:08
where do i add it to?

brendan s
October 20th, 2010, 20:35
where do i add it to?

commands.java

Coder Drew
October 22nd, 2010, 04:41
Thank you very much, forgot these command lines off the top of my head, thanks for the refresher! :)

toon
December 5th, 2010, 17:22
wow dude help me i added this then compiled - no errors
but when i try the commands it doesn't work

coolegast01
January 11th, 2011, 16:40
Me to!!!!!

Mish
January 11th, 2011, 16:42
nice i guess

scu
February 9th, 2011, 06:01
where do i post this at on my source?

samiamnot
February 11th, 2011, 22:42
Great, i was looking for this for a while