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
    Rep Power
    11
    sorted
    Reply With Quote  
     

  2. #2  
    Member Money swap Market Banned

    NeilG's Avatar
    Join Date
    Jul 2013
    Posts
    413
    Thanks given
    95
    Thanks received
    618
    Rep Power
    1975
    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
    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

    Join Date
    Aug 2015
    Posts
    78
    Thanks given
    35
    Thanks received
    25
    Rep Power
    110
    look up the modulo operator
    Reply With Quote  
     

  5. #5  
    Community Veteran


    Arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,950
    Thanks given
    210
    Thanks received
    349
    Rep Power
    1376
    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
    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 Money swap Market Banned

    NeilG's Avatar
    Join Date
    Jul 2013
    Posts
    413
    Thanks given
    95
    Thanks received
    618
    Rep Power
    1975
    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
    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
    25
    Posts
    1,755
    Thanks given
    496
    Thanks received
    346
    Rep Power
    237
    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
    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
  •