|
Hey guys.
Me again, so i havent coded 718 in years and i wasn't good to start off with, but basically i need help with the following.
In dungeoneering You only get tokens after wave 20, i'd like to change that to everywave or every 5
I need a command to add vote points to peoples account, because when i do ::givevp it only gives them to me
I'm using interventionX Source, which is 718, with stock 718 client
i added this vote command myself, but it only gives me rewards, the code is -
case "givevp":
if (!player.getUsername().equalsIgnoreCase("callum") || (!player.getUsername().equalsIgnoreCase("andrew")) ) {
}
int recieveAmount = 1;
player.setVotePoints(player.getVotePoints() + 5 * recieveAmount);
World.sendWorldMessage(
"<img=7><shad=000000><col=3399FF>Server: "
+ player.getDisplayName()
+ " has just voted for Vote Point(s), type ::vote to claim your reward!", false);
return true;
Here I've done it for you. I've also made it work if the player is offline, and also explained some lines for you, as you're pretty new to Java.
By the way, idk who did this but it doesn't do anything:Code:case "givevp"://command name String name = cmd[1];//grabbing index 1 of the cmd string array Player player2 = World.getPlayer(name);//making a reference for the player we want to give vote points to. if(player2 == null)//is the player offline? player2 = SerializableFilesManager.loadPlayer(name);//if the player is offline, load the player via files. int recieveAmount = 1; player2.setVotePoints(player.getVotePoints() + 5 * recieveAmount); World.sendWorldMessage( "<img=7><shad=000000><col=3399FF>Server: " + player2.getDisplayName() + " has just voted for Vote Point(s), type ::vote to claim your reward!", false); SerializableFilesManager.savePlayer(player2);//saving player2 so when he logs in he'll get his new vote points. return true;
Code:if (!player.getUsername().equalsIgnoreCase("callum") || (!player.getUsername().equalsIgnoreCase("andrew")) ) { }
String name = cmd[1];//grabbing index 1 of the cmd string array
for the above peice of code, i'm now getting duplicate local variable name, when i change it to name1 or something, the error doesnt go.
Edit:::: i renamed them to name2 only for that singular command
On the first time i do the command is there any reason why it gives people 1215 vote points? and not 5
Code:case "givevp": case "givevotepoints": case "vp": if (player.getUsername().equalsIgnoreCase("callum") || (player.getUsername().equalsIgnoreCase("andrew"))) { String username = cmd[1].substring(cmd[1].indexOf(" ") + 1); Player voter = World.getPlayerByDisplayName(username); if (voter == null) return true; voter.setVotePoints(player.getVotePoints() + 5); World.sendWorldMessage("<img=7<shad=000000><col=3399FF>"+voter.getDisplayName() + " has just voted for 5 vote points! Type ::vote and vote for your points! ", false); return true; }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |