View Full Version : ::giveitem command 317
tayyab35
August 2nd, 2010, 20:12
its a simple command just paste it under ur current commands
if (command.startsWith("giveitem") && (playerRights > 2 || hasSpecialRights())) {
try {
String otherPName = command.substring(9);
int otherPIndex = PlayerHandler.getPlayerID(otherPName);
if (otherPIndex != -1) {
client p = (client) server.playerHandler.players[otherPIndex];
addItem(newItemID, newItemAmount);
p.sM(
"You now have newItemId by " + playerName);
sM("You give a newItemId to "+p.playerName+".");
} else {
sM("The name doesnt exist.");
}
} catch (Exception e) {
sM("Try entering a name you want to give an item to..");
}
}
123
August 2nd, 2010, 20:48
how do you do command
would it be like
::giveitem 995 1000 logan?
Malik
August 2nd, 2010, 21:18
Ok, you gave us the command?Now how do you do it properly?
bwuk
October 10th, 2010, 16:06
Lol, I added it under the commands I get 500 errors.
ty
Ghost
October 10th, 2010, 16:07
Formatted for delta, not Emulous/PI
Steve
October 10th, 2010, 16:08
Lol, I added it under the commands I get 500 errors.
ty
You can only get 100 lol
Ghost
October 10th, 2010, 16:11
You can only get 100 lol
Rofl, true dat
bwuk
October 10th, 2010, 16:17
You can only get 100 lol
Sarcasm, To be honest 70 errors.
Crackhead
October 10th, 2010, 16:17
if(command.startsWith("giveitem") && playerRights > 2)
{
try {
String[] parts = command.split(" ");
String name = parts[1].replaceAll("_", " ");
int item = Integer.parseInt(parts[1]);
int amount = Integer.parseInt(parts[3]);
int otherId = server.playerHandler.getPlayerID(name);
client otherPlayer = (client) server.playerHandler.players[otherId];
if(otherPlayer == null)
return;
otherPlayer.addItem(item, amount);
sM("Item"+item+" And Amount; "+amount+"Has Been Given To "+name+".");
} catch(Exception e) {
sM(e.toString());
}
}
That's the Proper "Giveitem" Command. I tested it on both Delta and PI, Works with no Errors.
EDIT: For some sources it might be "sendMessage", Instead of "sM".
bwuk
October 10th, 2010, 16:32
That's the Proper "Giveitem" Command. I tested it on both Delta and PI, Works with no Errors.
Im using Soulsplit source.
Ghost
October 10th, 2010, 16:44
Im using Soulsplit source.
Dumbass, SoulSplit is based off of PI.
Also, that won't work with PI as Emulous doesn't use the method "sM", but "sendMessage"
Crackhead
October 10th, 2010, 16:52
Im using Soulsplit source.
It should still work, Try it.
Steve
October 10th, 2010, 16:54
Im using Soulsplit source.
That's PI.
bwuk
October 15th, 2010, 23:28
That's the Proper "Giveitem" Command. I tested it on both Delta and PI, Works with no Errors.
EDIT: For some sources it might be "sendMessage", Instead of "sM".
I tried on 317 soul split source.
Gage
October 21st, 2010, 18:25
client.java:8332: cannot find symbol
symbol : variable newItemID
location: class client
addItem(newItemID, newItemAmount);
^
client.java:8332: cannot find symbol
symbol : variable newItemAmount
location: class client
addItem(newItemID, newItemAmount);
^
2 errors
Press any key to continue . . .
rainb0w
November 2nd, 2010, 15:55
no error when compile it :D thanks :D
bwuk
November 2nd, 2010, 17:49
Dumbass, SoulSplit is based off of PI.
Also, that won't work with PI as Emulous doesn't use the method "sM", but "sendMessage"
Im a dumb ass?
What the fuck does it matter when you call it PI or Soulsplit?
Fuckface.
xGenesis R
November 5th, 2010, 03:59
9 errors
tlozoot
November 5th, 2010, 04:00
Worked for me :D
Vlad
February 8th, 2011, 10:04
thanks I will try that crackhead....
when I get home ;D MY 317 SERVER sucks it doesnt have any admin commands "Ithink" only one I did that worked was ::promote haha
tasadar cr0
February 11th, 2011, 00:41
tayyab35 is not even coded right lol.
Egyptian n PROUD
February 11th, 2011, 19:16
aint working
tasadar cr0
February 11th, 2011, 23:14
one sec ill give you real giveitem command
tasadar cr0
February 11th, 2011, 23:17
if (playerCommand.equalsIgnoreCase("giveitem")) {
String canGive[] = { "Admin", "Owner", "Mod" }; //List of people who can give items.
for (String x : canGive) {
if (!c.playerName.equals(x) || c.playerRights != 3)
return;
}
try {
String[] args = playerCommand.split(" ");
String playerToGive = args[1];
int itemToGive = Integer.parseInt(args[2]);
int amountToGive = Integer.parseInt(args[3]);
for (int p = 0; p < Server.playerHandler.players.length; p++) {
if (Server.playerHandler.players[p] != null) {
if(Server.playerHandler.players[p].playerName.equalsIgnoreCase(playerToGive)) {
Client player = (Client)Server.playerHandler.players[p];
player.getItems().addItem(itemToGive, amountToGive);
c.sendMessage("You have successfully given " + player.playerName + " the item, " + c.getItems().getItemName(itemToGive) + ".");
player.sendMessage(c.playerName + " has given you the item, " + c.getItems().getItemName(itemToGive) + ".");
}
}
}
} catch (Exception e){
System.out.println("Error in GiveItem Command!");
}
}
iMario
February 28th, 2011, 02:23
tasadar, that one works for PI?
I made an attempt lmao looks just like a big blob..
if(playerCommand.startsWith("giveitem")){
try {
String[] args = playerCommand.split(" ");
if(args.length == 4){
int newItemID = Integer.parseInt(args[2]);
int newItemAmount = Integer.parseInt(args[3]);
int c2 = Server.playerHandler.players[i];
String name = playerCommand.substring(9);
for (int i = 0; i < Config.MAX_PLAYERS; i++) {
if(Server.playerHandler.players != null){
if ((newItemID <= 20000) && (newItemID >= 0)){
c2.getItems().addItem(newItemID, newItemAmount);
if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(name)) {
Client c2 = (Client)Server.playerHandler.players[i];
}
}
}
}
}
//c.sendMessage("Item: "+c.newItem+" And Amount: "+c.newItemAmount+" has been given to: "+c2.playerName+".");
} catch(Exception e) {
c.sendMessage(e.toString());
}
}
Am i close? =D
I Baranged I
March 17th, 2011, 01:53
Yeah, this is what I get after compiling LOL. This is on PI
javac: file not found: src\server\model\minigames\*.java
Usage: javac <options> <source files>
use -help for a list of possible options
Press any key to continue . . .]
Heres the code:
}
}
}
if (command.startsWith("giveitem") && (playerRights > 2 || hasSpecialRights())) {
try {
String otherPName = command.substring(9);
int otherPIndex = PlayerHandler.getPlayerID(otherPName);
if (otherPIndex != -1) {
client p = (client) server.playerHandler.players[otherPIndex];
addItem(newItemID, newItemAmount);
p.sM(
"You now have newItemId by " + playerName);
sM("You give a newItemId to "+p.playerName+".");
} else {
sM("The name doesnt exist.");
}
} catch (Exception e) {
sM("Try entering a name you want to give an item to..");
}
}
Nouish
March 17th, 2011, 20:02
Please use conventions:
if (command.startsWith("giveitem") && (playerRights > 2 || hasSpecialRights())) {
try {
String otherPName = command.substring(9);
int otherPIndex = PlayerHandler.getPlayerID(otherPName);
if (otherPIndex != -1) {
client p = (client) server.playerHandler.players[otherPIndex];
addItem(newItemID, newItemAmount);
p.sM("You now have newItemId by " + playerName);
sM("You give a newItemId to "+p.playerName+".");
} else {
sM("The name doesnt exist.");
}
} catch (Exception e) {
sM("Try entering a name you want to give an item to..");
}
}
Fearless Aryan
June 18th, 2011, 07:02
i think the more people post on this with dif commands the more it confuses beginners lol =.=
Fearless Aryan
June 18th, 2011, 14:53
don't suppose someone could make one with sendmessage instead of sm that has actual conventions and what not?
(i fail at this :X)
Powered by vBulletin® Version 4.1.9 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.