Thread: [PI] - Spam Message when full inventory

Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1 [PI] - Spam Message when full inventory 
    Registered Member PvM Hussain's Avatar
    Join Date
    Aug 2013
    Posts
    266
    Thanks given
    23
    Thanks received
    3
    Rep Power
    11


    As you can see in this picture right here, I get spammed when my inventory is filled.. where could/do I change this?
    Please guys, help out here
    http://i43.tinypic.com/24v1la8.gif
    Reply With Quote  
     

  2. #2  
    Donator
    hero x sword's Avatar
    Join Date
    Apr 2012
    Age
    28
    Posts
    863
    Thanks given
    93
    Thanks received
    100
    Rep Power
    26
    Quote Originally Posted by Thor Epsilon View Post


    As you can see in this picture right here, I get spammed when my inventory is filled.. where could/do I change this?
    Please guys, help out here
    post your code
    Reply With Quote  
     

  3. #3  
    Super Donator
    Lunacy's Avatar
    Join Date
    Aug 2013
    Posts
    187
    Thanks given
    25
    Thanks received
    49
    Rep Power
    7
    When your inventory is full you should stop the fishing event.
    Reply With Quote  
     

  4. #4  
    Registered Member PvM Hussain's Avatar
    Join Date
    Aug 2013
    Posts
    266
    Thanks given
    23
    Thanks received
    3
    Rep Power
    11
    Quote Originally Posted by hero x sword View Post
    post your code
    Code:
    package server.content.skills;
    
    import core.util.Misc;
    import server.Config;
    import server.event.CycleEvent;
    import server.event.CycleEventContainer;
    import server.event.CycleEventHandler;
    import server.game.items.Item;
    import server.game.minigames.randomevents.RiverTroll;
    import server.game.minigames.randomevents.RockGolem;
    import server.game.players.Client;
    import server.game.players.Player;
    
    public class Fishing {
    
    	private enum Spot {
    		LURE(309, new int[]{335, 331}, 309, 314, new int[]{20, 30}, false, new int[]{50, 70}, 623),
    		CAGE(312, new int[]{377}, 301, -1, new int[]{40}, false, new int[]{90}, 619),
    		BIGNET(313, new int[]{353, 341, 363}, 305, -1, new int[]{16, 23, 46}, false, new int[]{20, 45, 100}, 620),
    		SMALLNET(316, new int[]{317, 321}, 303, -1, new int[]{1, 15}, false, new int[]{10, 40}, 621),
    		MONKNET(326, new int[]{7944}, 303, -1, new int[]{68}, false, new int[]{120}, 621),
    		LURE2(309, new int[]{349}, 307, 313, new int[]{25}, true, new int[]{60}, 623),
    		HARPOON(312, new int[]{359, 371}, 311, -1, new int[]{35, 50}, true, new int[]{80, 100}, 618),
    		HARPOON2(313, new int[]{383}, 311, -1, new int[]{76}, true, new int[]{110}, 618),
    		BAIT(316, new int[]{327, 345}, 307, 313, new int[]{5, 10}, true, new int[]{20, 30}, 623),
    		BAIT2(326, new int[]{327, 345}, 307, 313, new int[]{5, 10}, true, new int[]{20, 30}, 623);
    
    		int npcId, equipment, bait, anim;
    		int[] rawFish, fishingReqs, xp;
    		boolean second;
    		private Spot(int npcId, int[] rawFish, int equipment, int bait, int[] fishingReqs, boolean second, int[] xp, int anim) {
    			this.npcId = npcId;
    			this.rawFish = rawFish;
    			this.equipment = equipment;
    			this.bait = bait;
    			this.fishingReqs = fishingReqs;
    			this.second = second;
    			this.xp = xp;
    			this.anim = anim;
    		}
    
    		public int getNPCId() {
    			return npcId;
    		}
    
    		public int[] getRawFish() {
    			return rawFish;
    		}
    
    		public int getEquipment() {
    			return equipment;
    		}
    
    		public int getBait() {
    			return bait;
    		}
    
    		public int[] getLevelReq() {
    			return fishingReqs;
    		}
    
    		public boolean getSecond() {
    			return second;
    		}
    
    		public int[] getXp() {
    			return xp;
    		}
    
    		public int getAnim() {
    			return anim;
    		}
    	}
    
    	public static Spot forSpot(int npcId, boolean secondClick) {
    		for (Spot s : Spot.values()) {
    			if (secondClick) {
    				if (s.getSecond()) {
    					if (s.getNPCId() == npcId) {
    						if (s != null)
    							return s;
    					}
    				}
    			} else {
    				if (s.getNPCId() == npcId) {
    					if (s != null)
    						return s;
    				}
    			}
    		}
    		return null;
    	}
    
    	public static void setupFishing(Client c, Spot s) {
    		if (c.playerLevel[Player.playerFishing] >= s.getLevelReq()[0]) {
    			if (c.getItems().playerHasItem(s.getEquipment())) {
    				if (s.getBait() != -1) {
    					if (c.getItems().playerHasItem(s.getBait(), 1)) {
    						startFishing(c, s);
    					} else {
    						c.sendMessage("You don't have enough bait to fish here.");
    						c.startAnimation(65535);
    					}
    				} else {
    					startFishing(c, s);
    				}
    			} else {
    				c.sendMessage("You need a "+Item.getItemName(s.getEquipment()).toLowerCase()+" to fish here.");
    			}
    		} else {
    			c.sendMessage("You need a fishing level of at least "+s.getLevelReq()[0]+" to fish here.");
    		}
    	}
    
    	public static void startFishing(final Client c, final Spot s) {
    		final int wat = Misc.random(100) >= 70 ? getMax(c, s.fishingReqs) : (getMax(c, s.fishingReqs) != 0 ? getMax(c, s.fishingReqs) - 1 : 0);
    		c.startAnimation(s.getAnim());
    		CycleEventHandler.getSingleton().addEvent(1, c, new CycleEvent() {
    			int cycle = 0;
    			@Override
    			public void execute(CycleEventContainer container) {
    				cycle++;
    				c.startAnimation(s.getAnim());
    				if(c.getItems().freeSlots() < 1) {
    					c.sendMessage("Your inventory is full!");
    					container.stop();
    				}
    				if (cycle == 2) {
    					if (s.getBait() != -1) {
    						c.getItems().deleteItem(s.getBait(), c.getItems().getItemSlot(s.getBait()), 1);
    					}
    					if(Misc.random(80) == 0) {
    						RiverTroll.spawnRiverTroll(c);
    						container.stop();
    					}
    					c.getItems().addItem(s.getRawFish()[wat], 1);
    					c.sendMessage("You catch a "+Item.getItemName(s.getRawFish()[wat]).toLowerCase().replace("_", " ")+".");
    					c.isGainingExp = true;
    					c.getPA().addSkillXP(s.getXp()[wat]*Config.FISHING_EXPERIENCE, Player.playerFishing);
    					c.isGainingExp = false;
    					setupFishing(c, s);
    					this.stop();
    				}
    			}
    			@Override
    			public void stop() {
    				// Whatever you want it to do when the event stops
    			}
    		}, 2);
    	}
    	
    	public static void resetFishing(Client c) {
    		c.startAnimation(65535);
    		CycleEventHandler.getSingleton().stopEvents(c, 1);
    	}
    
    	public static int getMax(Client c, int[] reqs) {
    		int tempInt = -1;
    		for (int i : reqs) {
    			if (c.playerLevel[Player.playerFishing] >= i) {
    				tempInt++;
    			}
    		}
    		return tempInt;
    	}
    }
    http://i43.tinypic.com/24v1la8.gif
    Reply With Quote  
     

  5. #5  
    Banned

    Join Date
    Dec 2011
    Posts
    967
    Thanks given
    234
    Thanks received
    208
    Rep Power
    0
    Code:
    	public static void startFishing(final Client c, final Spot s) {
    		final int wat = Misc.random(100) >= 70 ? getMax(c, s.fishingReqs) : (getMax(c, s.fishingReqs) != 0 ? getMax(c, s.fishingReqs) - 1 : 0);
    		c.startAnimation(s.getAnim());
    		CycleEventHandler.getSingleton().addEvent(1, c, new CycleEvent() {
    			int cycle = 0;
    			@Override
    			public void execute(CycleEventContainer container) {
    				cycle++;
    				c.startAnimation(s.getAnim());
    				if(c.getItems().freeSlots() < 1) {
    					c.sendMessage("Your inventory is full!");
    					container.stop();
    				}
    				if (cycle == 2) {
    					if (s.getBait() != -1) {
    						c.getItems().deleteItem(s.getBait(), c.getItems().getItemSlot(s.getBait()), 1);
    					}
    					if(Misc.random(80) == 0) {
    						RiverTroll.spawnRiverTroll(c);
    						container.stop();
    					}
    					c.getItems().addItem(s.getRawFish()[wat], 1);
    					c.sendMessage("You catch a "+Item.getItemName(s.getRawFish()[wat]).toLowerCase().replace("_", " ")+".");
    					c.isGainingExp = true;
    					c.getPA().addSkillXP(s.getXp()[wat]*Config.FISHING_EXPERIENCE, Player.playerFishing);
    					c.isGainingExp = false;
    					setupFishing(c, s);
    					this.stop();
    				}
    			}
    			@Override
    			public void stop() {
    				// Whatever you want it to do when the event stops
    			}
    		}, 2);
    	}
    You're basically doing NOTHING when you stop the event... Your overriding it, and inside the void, there is just a comment. It'll spam every 2ms or seconds until you add something that actually stops the event

    e.g. resetting variables and return;
    Reply With Quote  
     

  6. #6  
    Registered Member PvM Hussain's Avatar
    Join Date
    Aug 2013
    Posts
    266
    Thanks given
    23
    Thanks received
    3
    Rep Power
    11
    Quote Originally Posted by Jet- View Post
    Code:
    	public static void startFishing(final Client c, final Spot s) {
    		final int wat = Misc.random(100) >= 70 ? getMax(c, s.fishingReqs) : (getMax(c, s.fishingReqs) != 0 ? getMax(c, s.fishingReqs) - 1 : 0);
    		c.startAnimation(s.getAnim());
    		CycleEventHandler.getSingleton().addEvent(1, c, new CycleEvent() {
    			int cycle = 0;
    			@Override
    			public void execute(CycleEventContainer container) {
    				cycle++;
    				c.startAnimation(s.getAnim());
    				if(c.getItems().freeSlots() < 1) {
    					c.sendMessage("Your inventory is full!");
    					container.stop();
    				}
    				if (cycle == 2) {
    					if (s.getBait() != -1) {
    						c.getItems().deleteItem(s.getBait(), c.getItems().getItemSlot(s.getBait()), 1);
    					}
    					if(Misc.random(80) == 0) {
    						RiverTroll.spawnRiverTroll(c);
    						container.stop();
    					}
    					c.getItems().addItem(s.getRawFish()[wat], 1);
    					c.sendMessage("You catch a "+Item.getItemName(s.getRawFish()[wat]).toLowerCase().replace("_", " ")+".");
    					c.isGainingExp = true;
    					c.getPA().addSkillXP(s.getXp()[wat]*Config.FISHING_EXPERIENCE, Player.playerFishing);
    					c.isGainingExp = false;
    					setupFishing(c, s);
    					this.stop();
    				}
    			}
    			@Override
    			public void stop() {
    				// Whatever you want it to do when the event stops
    			}
    		}, 2);
    	}
    You're basically doing NOTHING when you stop the event... Your overriding it, and inside the void, there is just a comment. It'll spam every 2ms or seconds until you add something that actually stops the event

    e.g. resetting variables and return;
    So what to do?
    idk what to add in or delete to make it stop spamming
    http://i43.tinypic.com/24v1la8.gif
    Reply With Quote  
     

  7. #7  
    Registered Member PvM Hussain's Avatar
    Join Date
    Aug 2013
    Posts
    266
    Thanks given
    23
    Thanks received
    3
    Rep Power
    11
    bump
    http://i43.tinypic.com/24v1la8.gif
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    Jul 2013
    Posts
    106
    Thanks given
    3
    Thanks received
    3
    Rep Power
    10
    Add a return; after container.stop(); not sure if this will work
    Reply With Quote  
     

  9. #9  
    Registered Member PvM Hussain's Avatar
    Join Date
    Aug 2013
    Posts
    266
    Thanks given
    23
    Thanks received
    3
    Rep Power
    11
    Quote Originally Posted by Diana View Post
    Add a return; after container.stop(); not sure if this will work

    Did not work.. still continue fishing & spamming (full inventory)
    http://i43.tinypic.com/24v1la8.gif
    Reply With Quote  
     

  10. #10  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    Replace
    Code:
    				if(c.getItems().freeSlots() < 1) {
    					c.sendMessage("Your inventory is full!");
    					container.stop();
    				}
    With
    Code:
    				if(c.getItems().freeSlots() < 1) {
    					c.sendMessage("Your inventory is full!");
    					container.stop();
    					return;
    				}
    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. [PI] Dropping items when inventory is full
    By Amigos in forum Snippets
    Replies: 5
    Last Post: 08-14-2014, 06:24 AM
  2. PI Server messages when archieving 99
    By thirtyseven in forum Snippets
    Replies: 7
    Last Post: 11-17-2013, 12:04 PM
  3. PI, Server messages when someone archieves 99
    By thirtyseven in forum Downloads
    Replies: 1
    Last Post: 11-17-2013, 06:21 AM
  4. Replies: 7
    Last Post: 12-02-2011, 03:20 AM
  5. Replies: 6
    Last Post: 10-29-2011, 04:08 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
  •