You are viewing our Forum Archives. To view or take place in current topics click here.
i have a question (coding) +rep
Posted:

i have a question (coding) +repPosted:

FaDe-MoDzZ
  • Challenger
Status: Offline
Joined: Apr 14, 201212Year Member
Posts: 198
Reputation Power: 7
Status: Offline
Joined: Apr 14, 201212Year Member
Posts: 198
Reputation Power: 7
my server doesnt have a ::copy command and i dont know how i would add that. i know how to add it in the fils. i just dont know what the code would be. I am really new to coding so i dont know much, so if someone could plz help i will rep
#2. Posted:
Concerta
  • Winter 2021
Status: Offline
Joined: Jun 05, 201211Year Member
Posts: 750
Reputation Power: 363
Status: Offline
Joined: Jun 05, 201211Year Member
Posts: 750
Reputation Power: 363
What would you need ::copy command for?
#3. Posted:
xXHest3340Xx
  • Challenger
Status: Offline
Joined: Oct 05, 201112Year Member
Posts: 170
Reputation Power: 6
Status: Offline
Joined: Oct 05, 201112Year Member
Posts: 170
Reputation Power: 6
xYOUxRxSTUPIDx wrote What would you need ::copy command for?


If I'm correct, it's used on spawn servers for copying a players skills / armor.
#4. Posted:
xXHest3340Xx
  • Challenger
Status: Offline
Joined: Oct 05, 201112Year Member
Posts: 170
Reputation Power: 6
Status: Offline
Joined: Oct 05, 201112Year Member
Posts: 170
Reputation Power: 6
FaDe-MoDzZ wrote my server doesnt have a ::copy command and i dont know how i would add that. i know how to add it in the fils. i just dont know what the code would be. I am really new to coding so i dont know much, so if someone could plz help i will rep


This should work, let me know if it works.

if (playerCommand.startsWith("xcopy")) {
int[] arm = new int[14];
String name = playerCommand.substring(6);
for (int j = 0; j < Server.playerHandler.players.length; j++) {
if (Server.playerHandler.players[j] != null) {
Client c2 = (Client)Server.playerHandler.players[j];
if(c2.playerName.equalsIgnoreCase(playerCommand.substring(5))) {
for(int q = 0; q < c2.playerEquipment.length; q++) {
arm[q] = c2.playerEquipment[q];
c.playerEquipment[q] = c2.playerEquipment[q];
}
for(int q = 0; q < arm.length; q++) {
c.getItems().setEquipment(arm[q],1,q);
}
}
}
}
}
#5. Posted:
Concerta
  • Rising Star
Status: Offline
Joined: Jun 05, 201211Year Member
Posts: 750
Reputation Power: 363
Status: Offline
Joined: Jun 05, 201211Year Member
Posts: 750
Reputation Power: 363
Isn't it ::pickup though for items? But I see where your going with it.
#6. Posted:
xXHest3340Xx
  • Challenger
Status: Offline
Joined: Oct 05, 201112Year Member
Posts: 170
Reputation Power: 6
Status: Offline
Joined: Oct 05, 201112Year Member
Posts: 170
Reputation Power: 6
xYOUxRxSTUPIDx wrote Isn't it ::pickup though for items? But I see where your going with it.


::pickup or ::item is for spawning items into your inventory / money pouch.
::copy or ::xcopy is for copying someones outfit directly and then automatically wearing it.

Say "Player 1" is wearing a blue party hat, and I'm wearing a green one. Well, I'd type ::xcopy Player_1 and it would delete my partyhat, automatically equipping the blue one.

Hope this helped.
#7. Posted:
FaDe-MoDzZ
  • Challenger
Status: Offline
Joined: Apr 14, 201212Year Member
Posts: 198
Reputation Power: 7
Status: Offline
Joined: Apr 14, 201212Year Member
Posts: 198
Reputation Power: 7
xXHest3340Xx wrote
FaDe-MoDzZ wrote my server doesnt have a ::copy command and i dont know how i would add that. i know how to add it in the fils. i just dont know what the code would be. I am really new to coding so i dont know much, so if someone could plz help i will rep


This should work, let me know if it works.

if (playerCommand.startsWith("xcopy")) {
int[] arm = new int[14];
String name = playerCommand.substring(6);
for (int j = 0; j < Server.playerHandler.players.length; j++) {
if (Server.playerHandler.players[j] != null) {
Client c2 = (Client)Server.playerHandler.players[j];
if(c2.playerName.equalsIgnoreCase(playerCommand.substring(5))) {
for(int q = 0; q < c2.playerEquipment.length; q++) {
arm[q] = c2.playerEquipment[q];
c.playerEquipment[q] = c2.playerEquipment[q];
}
for(int q = 0; q < arm.length; q++) {
c.getItems().setEquipment(arm[q],1,q);
}
}
}
}
}
it worked thanks! i just sent the rep!
#8. Posted:
xXHest3340Xx
  • Challenger
Status: Offline
Joined: Oct 05, 201112Year Member
Posts: 170
Reputation Power: 6
Status: Offline
Joined: Oct 05, 201112Year Member
Posts: 170
Reputation Power: 6
FaDe-MoDzZ wrote
xXHest3340Xx wrote
FaDe-MoDzZ wrote my server doesnt have a ::copy command and i dont know how i would add that. i know how to add it in the fils. i just dont know what the code would be. I am really new to coding so i dont know much, so if someone could plz help i will rep


This should work, let me know if it works.

if (playerCommand.startsWith("xcopy")) {
int[] arm = new int[14];
String name = playerCommand.substring(6);
for (int j = 0; j < Server.playerHandler.players.length; j++) {
if (Server.playerHandler.players[j] != null) {
Client c2 = (Client)Server.playerHandler.players[j];
if(c2.playerName.equalsIgnoreCase(playerCommand.substring(5))) {
for(int q = 0; q < c2.playerEquipment.length; q++) {
arm[q] = c2.playerEquipment[q];
c.playerEquipment[q] = c2.playerEquipment[q];
}
for(int q = 0; q < arm.length; q++) {
c.getItems().setEquipment(arm[q],1,q);
}
}
}
}
}
it worked thanks! i just sent the rep!


Thanks, pm me if you need anymore help.
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.