Thread: Money swap

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1 Money swap 
    Registered Member
    Join Date
    Sep 2020
    Posts
    26
    Thanks given
    1
    Thanks received
    1
    Discord
    View profile
    Rep Power
    11
    sorted
    Reply With Quote  
     

  2. #2  
    Member Market Banned Market Banned

    NeilG's Avatar
    Join Date
    Jul 2013
    Posts
    365
    Thanks given
    86
    Thanks received
    568
    Discord
    View profile
    Rep Power
    1830
    What's going on here?

    does this not return the amount already?
    Code:
    player.getInventory().getAmount(5023)
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Sep 2020
    Posts
    26
    Thanks given
    1
    Thanks received
    1
    Discord
    View profile
    Rep Power
    11
    Quote Originally Posted by NeilG View Post
    What's going on here?

    does this not return the amount already?
    Code:
    player.getInventory().getAmount(5023)
    Nah this works fine i just need to find out how to do this all command line but in reverse

    if(itemId == 5022) {
    int amount = 0;

    for(int i = 0; i < player.getInventory().getAmount(5022); i++) {
    amount++;
    }
    player.getInventory().delete(5022,1000000);
    player.getInventory().add(5023,1);
    }

    this is what im trying to do but it does not want to work properly cuz even if i have 1x 5022 it will give me 1x 5023
    Reply With Quote  
     

  4. #4  
    Registered Member
    Concerned's Avatar
    Join Date
    Aug 2015
    Posts
    44
    Thanks given
    20
    Thanks received
    13
    Discord
    View profile
    Rep Power
    123
    look up the modulo operator
    Reply With Quote  
     

  5. #5  
    Community Veteran


    Arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,914
    Thanks given
    206
    Thanks received
    331
    Discord
    View profile
    Rep Power
    1242
    So you are looping a amount to check for an amount? Seems like you need to fix your logic.
    Spoiler for Spoiler:

    Code:
    if(itemId == 5022) {
    int amount = player.getInventory().getAmount(5022) / 1000000;
    player.getInventory().delete(5022,amount *1000000);
    player.getInventory().add(5023,amount);
    }


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Sep 2020
    Posts
    26
    Thanks given
    1
    Thanks received
    1
    Discord
    View profile
    Rep Power
    11
    Quote Originally Posted by Arch337 View Post
    So you are looping a amount to check for an amount? Seems like you need to fix your logic.
    Spoiler for Spoiler:

    Code:
    if(itemId == 5022) {
    int amount = player.getInventory().getAmount(5022) / 1000000;
    player.getInventory().delete(5022,amount *1000000);
    player.getInventory().add(5023,amount);
    }
    ok bud
    Reply With Quote  
     

  7. #7  
    Member Market Banned Market Banned

    NeilG's Avatar
    Join Date
    Jul 2013
    Posts
    365
    Thanks given
    86
    Thanks received
    568
    Discord
    View profile
    Rep Power
    1830
    Quote Originally Posted by koska View Post
    Nah this works fine i just need to find out how to do this all command line but in reverse
    Yeah it works, but it makes no sense
    you already have the amount figured out, so you're counting up from 0 to the amount to figure out the amount.
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    Sep 2020
    Posts
    26
    Thanks given
    1
    Thanks received
    1
    Discord
    View profile
    Rep Power
    11
    Quote Originally Posted by NeilG View Post
    Yeah it works, but it makes no sense
    you already have the amount figured out, so you're counting up from 0 to the amount to figure out the amount.
    Concerned helped i figgure it out ty
    Reply With Quote  
     

  9. #9  
    Donator

    Fiddle's Avatar
    Join Date
    Dec 2011
    Age
    23
    Posts
    1,751
    Thanks given
    489
    Thanks received
    340
    Discord
    View profile
    Rep Power
    179
    Code:
    		for(int i = 0; i <= player.getInventory().getAmount(5022); i++) {
    			if (i >= 1000000) {
    				if (i % 1000000 == 0)
    					amount++;
    			}
    		}
    		player.getInventory().add(5023, amount);
    Don't be scared. It can't hurt you.
    Reply With Quote  
     

  10. Thankful user:


  11. #10  
    Registered Member
    Join Date
    Sep 2020
    Posts
    26
    Thanks given
    1
    Thanks received
    1
    Discord
    View profile
    Rep Power
    11
    Quote Originally Posted by El Camino View Post
    Code:
    		for(int i = 0; i <= player.getInventory().getAmount(5022); i++) {
    			if (i >= 1000000) {
    				if (i % 1000000 == 0)
    					amount++;
    			}
    		}
    		player.getInventory().add(5023, amount);
    Yep thats what i figgured big thanx
    Reply With Quote  
     

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. Replies: 0
    Last Post: 04-29-2016, 10:59 AM
  2. Replies: 12
    Last Post: 03-06-2011, 10:28 PM
  3. Replies: 4
    Last Post: 09-27-2010, 03:00 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •