Thread: [PI]public void pickPlayerPocket[PI]

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 [PI]public void pickPlayerPocket[PI] 
    i want a PM. The best in life is free.
    Project M's Avatar
    Join Date
    Mar 2012
    Posts
    368
    Thanks given
    20
    Thanks received
    13
    Rep Power
    14
    Im struggeling to make this work. When im trying to pickpocket someone, it says You fail to pick their pockets.item
    Means, when item = 0, it send that message.

    But the player has items, but i dont know how to get this to work propertly.

    any ideas?


    Code:
    public void pickPlayerPocket(int index) {
    
    		Client p = (Client)PlayerHandler.players[index];
    
    		c.pickingPlayer = false;
    
    		if(p == null) return;
    
    		if (p.inDuelArena() || p.inCw() || p.isBanking || p.inTrade) {
    			c.sendMessage("This player is busy.");
    			return;
    		}
    		c.sendMessage("You attempt to pick " + p.playerName + "'s pockets...");
    
    		if (c.playerLevel[17] < p.playerLevel[17]) {
    			c.sendMessage("You need to have a theiving level of " + p.playerLevel[17] + " to pick this person pockets.");
    			return;
    		}
    		if (Misc.random(4) == 2) {
    			c.sendMessage("You fail to pick their pockets random.");
    			return;
    		}
    
    		int item = 0, amount = 0, trys = 0;
    		while(item == 0 && trys < 10) {
    			for (int i = 0; i < p.playerItems.length; i++) {
    				if ((p.playerItems[i]-1) > 0) {
    					int v = c.getShops().getItemShopValue(p.playerItems[i] - 1);
    					if (v > 10000) continue; // higher than 1 million? skip that shit :)
    					if (Misc.random(4) == 4) {
    					int player = 0;
    					item = player;
    						if(p.playerItemsN[i] > 1)
    							amount = Misc.random((p.playerItemsN[i] > 1000000 ? 1000000 : p.playerItemsN[i]));
    						else
    							amount = 1;
    					}
    				}
    			}
    			trys++;
    		}
    		if (item == 0) {
    			c.sendMessage("You fail to pick their pockets.item");
    			return;
    		}
    		p.getItems().deleteItem(item, amount);
    		c.getItems().addItem(item, amount);
    		c.sendMessage("You successfully picked " + p.playerName + "'s pockets!");
    	}
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Apr 2009
    Posts
    1,728
    Thanks given
    403
    Thanks received
    210
    Rep Power
    390
    Code:
    public void pickPlayerPocket(int index) {
    
    		Client p = (Client)PlayerHandler.players[index];
    
    		c.pickingPlayer = false;
    
    		if(p == null) return;
    
    		if (p.inDuelArena() || p.inCw() || p.isBanking || p.inTrade) {
    			c.sendMessage("This player is busy.");
    			return;
    		}
    		c.sendMessage("You attempt to pick " + p.playerName + "'s pockets...");
    
    		if (c.playerLevel[17] < p.playerLevel[17]) {
    			c.sendMessage("You need to have a theiving level of " + p.playerLevel[17] + " to pick this person pockets.");
    			return;
    		}
    		if (Misc.random(4) == 2) {
    			c.sendMessage("You fail to pick their pockets random.");
    			return;
    		}
    
    		int item = 0, amount = 0, trys = 0;
    		if(item == 0 && trys < 10) {
    			for (int i = 0; i < p.playerItems.length; i++) {
    				if ((p.playerItems[i]-1) > 0) {
    					int v = c.getShops().getItemShopValue(p.playerItems[i] - 1);
    					if (v > 10000) continue; // higher than 1 million? skip that shit :)
    					if (Misc.random(4) == 4) {
    					int player = 0;
    					item = player;
    						if(p.playerItemsN[i] > 1)
    							amount = Misc.random((p.playerItemsN[i] > 1000000 ? 1000000 : p.playerItemsN[i]));
    						else
    							amount = 1;
    					}
    				}
    			}
    			trys++;
    		}
    		if (item == 0) {
    			c.sendMessage("You fail to pick their pockets.item");
    			return;
    		}
    		p.getItems().deleteItem(item, amount);
    		c.getItems().addItem(item, amount);
    		c.sendMessage("You successfully picked " + p.playerName + "'s pockets!");
    	}
    Try that?
    Reply With Quote  
     

  3. #3  
    i want a PM. The best in life is free.
    Project M's Avatar
    Join Date
    Mar 2012
    Posts
    368
    Thanks given
    20
    Thanks received
    13
    Rep Power
    14
    Quote Originally Posted by Phat 4 u View Post
    Code:
    public void pickPlayerPocket(int index) {
    
    		Client p = (Client)PlayerHandler.players[index];
    
    		c.pickingPlayer = false;
    
    		if(p == null) return;
    
    		if (p.inDuelArena() || p.inCw() || p.isBanking || p.inTrade) {
    			c.sendMessage("This player is busy.");
    			return;
    		}
    		c.sendMessage("You attempt to pick " + p.playerName + "'s pockets...");
    
    		if (c.playerLevel[17] < p.playerLevel[17]) {
    			c.sendMessage("You need to have a theiving level of " + p.playerLevel[17] + " to pick this person pockets.");
    			return;
    		}
    		if (Misc.random(4) == 2) {
    			c.sendMessage("You fail to pick their pockets random.");
    			return;
    		}
    
    		int item = 0, amount = 0, trys = 0;
    		if(item == 0 && trys < 10) {
    			for (int i = 0; i < p.playerItems.length; i++) {
    				if ((p.playerItems[i]-1) > 0) {
    					int v = c.getShops().getItemShopValue(p.playerItems[i] - 1);
    					if (v > 10000) continue; // higher than 1 million? skip that shit :)
    					if (Misc.random(4) == 4) {
    					int player = 0;
    					item = player;
    						if(p.playerItemsN[i] > 1)
    							amount = Misc.random((p.playerItemsN[i] > 1000000 ? 1000000 : p.playerItemsN[i]));
    						else
    							amount = 1;
    					}
    				}
    			}
    			trys++;
    		}
    		if (item == 0) {
    			c.sendMessage("You fail to pick their pockets.item");
    			return;
    		}
    		p.getItems().deleteItem(item, amount);
    		c.getItems().addItem(item, amount);
    		c.sendMessage("You successfully picked " + p.playerName + "'s pockets!");
    	}
    Try that?
    Didnt work.
    No difference
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  4. #4  
    Super Donator

    Batukka's Avatar
    Join Date
    Oct 2011
    Posts
    2,437
    Thanks given
    86
    Thanks received
    342
    Rep Power
    496
    problem is on item variable i dont see that where you set it different numbers than 0.
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  5. #5  
    i want a PM. The best in life is free.
    Project M's Avatar
    Join Date
    Mar 2012
    Posts
    368
    Thanks given
    20
    Thanks received
    13
    Rep Power
    14
    Quote Originally Posted by Biggie Smalls View Post
    problem is on item variable i dont see that where you set it different numbers than 0.
    Could you help me to get it work please`?
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  6. #6  
    Registered Member

    Join Date
    Sep 2008
    Posts
    4,830
    Thanks given
    893
    Thanks received
    1,439
    Discord
    View profile
    Rep Power
    2924
    It's because you set this
    Code:
    item = player;
    when the variable player = 0;
    So it'll always be 0 no matter what you do.
    "Know thy self, know thy enemy. A thousand battles, a thousand victories." - Sun Tzu
    GitHub: [Only registered and activated users can see links. ]
    Reply With Quote  
     

  7. #7  
    i want a PM. The best in life is free.
    Project M's Avatar
    Join Date
    Mar 2012
    Posts
    368
    Thanks given
    20
    Thanks received
    13
    Rep Power
    14
    Quote Originally Posted by Faris View Post
    It's because you set this
    Code:
    item = player;
    when the variable player = 0;
    So it'll always be 0 no matter what you do.
    Could you help me fix it?
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  8. #8  
    i want a PM. The best in life is free.
    Project M's Avatar
    Join Date
    Mar 2012
    Posts
    368
    Thanks given
    20
    Thanks received
    13
    Rep Power
    14
    bump
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  9. #9  
    Super Donator

    Batukka's Avatar
    Join Date
    Oct 2011
    Posts
    2,437
    Thanks given
    86
    Thanks received
    342
    Rep Power
    496
    Code:
    public void pickPlayerPocket(int index) {
    
    		Client p = (Client)PlayerHandler.players[index];
    
    		c.pickingPlayer = false;
    
    		if(p == null) return;
    
    		if (p.inDuelArena() || p.inCw() || p.isBanking || p.inTrade) {
    			c.sendMessage("This player is busy.");
    			return;
    		}
    		c.sendMessage("You attempt to pick " + p.playerName + "'s pockets...");
    
    		if (c.playerLevel[17] < p.playerLevel[17]) {
    			c.sendMessage("You need to have a theiving level of " + p.playerLevel[17] + " to pick this person pockets.");
    			return;
    		}
    		if (Misc.random(4) == 2) {
    			c.sendMessage("You fail to pick their pockets random.");
    			return;
    		}
    
    		int item = 0, amount = 0, trys = 0;
    		while(item == 0 && trys < 10) {
    			for (int i = 0; i < p.playerItems.length; i++) {
    				if ((p.playerItems[i]-1) > 0) {
    					int v = c.getShops().getItemShopValue(p.playerItems[i] - 1);
    					if (v > 10000) continue; // higher than 1 million? skip that shit :)
    					if (Misc.random(4) == 4) {
    					item = i;
    						if(p.playerItemsN[i] > 1)
    							amount = Misc.random((p.playerItemsN[i] > 1000000 ? 1000000 : p.playerItemsN[i]));
    						else
    							amount = 1;
    					}
    				}
    			}
    			trys++;
    		}
    		if (item == 0) {
    			c.sendMessage("You fail to pick their pockets.item");
    			return;
    		}
    		p.getItems().deleteItem(item, amount);
    		c.getItems().addItem(item, amount);
    		c.sendMessage("You successfully picked " + p.playerName + "'s pockets!");
    	}
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  10. #10  
    i want a PM. The best in life is free.
    Project M's Avatar
    Join Date
    Mar 2012
    Posts
    368
    Thanks given
    20
    Thanks received
    13
    Rep Power
    14
    Quote Originally Posted by Biggie Smalls View Post
    Code:
    public void pickPlayerPocket(int index) {
    
    		Client p = (Client)PlayerHandler.players[index];
    
    		c.pickingPlayer = false;
    
    		if(p == null) return;
    
    		if (p.inDuelArena() || p.inCw() || p.isBanking || p.inTrade) {
    			c.sendMessage("This player is busy.");
    			return;
    		}
    		c.sendMessage("You attempt to pick " + p.playerName + "'s pockets...");
    
    		if (c.playerLevel[17] < p.playerLevel[17]) {
    			c.sendMessage("You need to have a theiving level of " + p.playerLevel[17] + " to pick this person pockets.");
    			return;
    		}
    		if (Misc.random(4) == 2) {
    			c.sendMessage("You fail to pick their pockets random.");
    			return;
    		}
    
    		int item = 0, amount = 0, trys = 0;
    		while(item == 0 && trys < 10) {
    			for (int i = 0; i < p.playerItems.length; i++) {
    				if ((p.playerItems[i]-1) > 0) {
    					int v = c.getShops().getItemShopValue(p.playerItems[i] - 1);
    					if (v > 10000) continue; // higher than 1 million? skip that shit :)
    					if (Misc.random(4) == 4) {
    					item = i;
    						if(p.playerItemsN[i] > 1)
    							amount = Misc.random((p.playerItemsN[i] > 1000000 ? 1000000 : p.playerItemsN[i]));
    						else
    							amount = 1;
    					}
    				}
    			}
    			trys++;
    		}
    		if (item == 0) {
    			c.sendMessage("You fail to pick their pockets.item");
    			return;
    		}
    		p.getItems().deleteItem(item, amount);
    		c.getItems().addItem(item, amount);
    		c.sendMessage("You successfully picked " + p.playerName + "'s pockets!");
    	}
    Works, but .. when i successfully picked someone i get random items? i want to steal the items from player ( if the valute is under 1m)
    [Only registered and activated users can see links. ]
    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. Need public void multiWay
    By Faris in forum Requests
    Replies: 9
    Last Post: 02-16-2012, 08:20 PM
  2. Replies: 2
    Last Post: 10-25-2011, 08:15 AM
  3. [PI]Public Void XPLock[PI]
    By Antto in forum Help
    Replies: 2
    Last Post: 02-19-2011, 03:19 PM
  4. [NEED]Public Void bankItem
    By Adam™ in forum Requests
    Replies: 0
    Last Post: 04-26-2010, 02:03 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
  •