Thread: 718 [Stuck on a couple things]

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1 718 [Stuck on a couple things] 
    Registered Member
    Join Date
    Oct 2014
    Posts
    31
    Thanks given
    7
    Thanks received
    2
    Rep Power
    11
    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
    Reply With Quote  
     

  2. #2  
    Contributor

    clem585's Avatar
    Join Date
    Sep 2013
    Posts
    3,788
    Thanks given
    706
    Thanks received
    702
    Rep Power
    570
    Quote Originally Posted by callido View Post
    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
    ....

    Quote Originally Posted by Galkon View Post
    When posting a help thread, please follow these guidelines:

    Supply as much information as possible
    Include your server base, revision, and what client you are using
    Include the source of the problem if you know it, any information you have about the problem and how it is replicated
    Include any files related to the problem and its surrounding code, this will speed up the process of you getting help as members can see all the code that concerns this problem
    Project thread
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Oct 2014
    Posts
    31
    Thanks given
    7
    Thanks received
    2
    Rep Power
    11
    Quote Originally Posted by clem585 View Post
    ....
    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;
    Reply With Quote  
     

  4. #4  
    Extreme Donator

    TaterMater's Avatar
    Join Date
    Aug 2011
    Posts
    1,511
    Thanks given
    218
    Thanks received
    375
    Rep Power
    121
    Quote Originally Posted by callido View Post
    I'm using interventionX Source, 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;
    That's because you're referencing you (player) to give the vote points to. You need to grab a reference for the player you want to give vote points to. Example:
    Code:
    Player player2 = World.getPlayer(cmd[1]);

    Reply With Quote  
     

  5. Thankful user:


  6. #5  
    Registered Member
    Join Date
    Oct 2014
    Posts
    31
    Thanks given
    7
    Thanks received
    2
    Rep Power
    11
    Quote Originally Posted by TaterMater View Post
    That's because you're referencing you (player) to give the vote points to. You need to grab a reference for the player you want to give vote points to. Example:
    Code:
    Player player2 = World.getPlayer(cmd[1]);
    Ah okay, what part of the code would i add this too then?
    Reply With Quote  
     

  7. #6  
    Extreme Donator

    TaterMater's Avatar
    Join Date
    Aug 2011
    Posts
    1,511
    Thanks given
    218
    Thanks received
    375
    Rep Power
    121
    Quote Originally Posted by callido View Post
    Ah okay, what part of the code would i add this too then?
    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.

    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;
    By the way, idk who did this but it doesn't do anything:
    Code:
    if (!player.getUsername().equalsIgnoreCase("callum") || (!player.getUsername().equalsIgnoreCase("andrew")) ) {
    }

    Reply With Quote  
     

  8. Thankful user:


  9. #7  
    Registered Member
    Join Date
    Oct 2014
    Posts
    31
    Thanks given
    7
    Thanks received
    2
    Rep Power
    11
    Quote Originally Posted by TaterMater View Post
    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.

    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;
    By the way, idk who did this but it doesn't do anything:
    Code:
    if (!player.getUsername().equalsIgnoreCase("callum") || (!player.getUsername().equalsIgnoreCase("andrew")) ) {
    }
    Thank you! your kindness is appreciated, also i added that code, so that only the owners can give out vote points.
    Reply With Quote  
     

  10. #8  
    Extreme Donator

    TaterMater's Avatar
    Join Date
    Aug 2011
    Posts
    1,511
    Thanks given
    218
    Thanks received
    375
    Rep Power
    121
    Quote Originally Posted by callido View Post
    Thank you! your kindness is appreciated, also i added that code, so that only the owners can give out vote points.
    In that caes, you need this:

    Code:
    if (!player.getUsername().equalsIgnoreCase("callum") && !player.getUsername().equalsIgnoreCase("andrew")) {
    return;
    }

    Reply With Quote  
     

  11. Thankful user:


  12. #9  
    Registered Member
    Join Date
    Oct 2014
    Posts
    31
    Thanks given
    7
    Thanks received
    2
    Rep Power
    11
    Quote Originally Posted by TaterMater View Post
    In that caes, you need this:

    Code:
    if (!player.getUsername().equalsIgnoreCase("callum") && !player.getUsername().equalsIgnoreCase("andrew")) {
    return;
    }
    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
    Reply With Quote  
     

  13. #10  
    Banned

    Join Date
    Jul 2011
    Posts
    1,767
    Thanks given
    493
    Thanks received
    425
    Rep Power
    0
    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;
    				}
    Reply With Quote  
     

  14. Thankful user:


Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. 718 Stuck on 0% for others
    By Freestuffplox in forum Help
    Replies: 3
    Last Post: 11-17-2013, 11:46 PM
  2. Need help on a couple things
    By jchapman in forum Help
    Replies: 6
    Last Post: 02-07-2009, 02:04 AM
  3. A couple things
    By Heaven Sent in forum Help
    Replies: 0
    Last Post: 01-25-2009, 11:53 PM
  4. Couple things for Delta Source
    By X HeCkTiC in forum Help
    Replies: 2
    Last Post: 12-02-2008, 03:58 AM
  5. Couple Things
    By A T I in forum RS 503+ Client & Server
    Replies: 5
    Last Post: 08-28-2008, 07:14 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •