Thread: How to add pickup/spawn item on Project Insanity?

Results 1 to 10 of 10
  1. #1 How to add pickup/spawn item on Project Insanity? 
    Registered Member Ags Pride's Avatar
    Join Date
    Mar 2010
    Posts
    53
    Thanks given
    0
    Thanks received
    1
    Rep Power
    1
    How to add pickup/spawn item on Project Insanity? can you help me on this one?
    Reply With Quote  
     

  2. #2  
    Austin_
    Guest
    My command.java has everything you need + sorted out better.

    Code:
    package server.model.players.packets;
    
    import server.Config;
    import server.Connection;
    import server.Server;
    import server.model.players.Client;
    import server.model.players.PacketType;
    import server.model.players.PlayerHandler;
    import server.util.Misc;
    import server.world.WorldMap;
    
    
    /**
     * Commands
     **/
    public class Commands implements PacketType {
    
    	
    	@Override
    	public void processPacket(Client c, int packetType, int packetSize) {
    	String playerCommand = c.getInStream().readString();
    	if(Config.SERVER_DEBUG)
    		Misc.println(c.playerName+" playerCommand: "+playerCommand);
    		if (playerCommand.startsWith("/") && playerCommand.length() > 1) {
    			if (c.clanId >= 0) {
    				System.out.println(playerCommand);
    				playerCommand = playerCommand.substring(1);
    				Server.clanChat.playerMessageToClan(c.playerId, playerCommand, c.clanId);
    			} else {
    				if (c.clanId != -1)
    					c.clanId = -1;
    				c.sendMessage("You are not in a clan.");
    			}
    			return;
    		}
    		if(c.playerRights >= 0) {
    					if (playerCommand.equalsIgnoreCase("players")) {
    				c.sendMessage("There are currently "+PlayerHandler.getPlayerCount()+ " players online.");
    			}
    						if (playerCommand.startsWith("changepassword") && playerCommand.length() > 15) {
    				c.playerPass = playerCommand.substring(15);
    				c.sendMessage("Your password is now: " + c.playerPass);			
    			}
    		}
    		if (c.playerRights >= 1) {
    					if (playerCommand.startsWith("unban")) {
    				try {	
    					String playerToBan = playerCommand.substring(6);
    					Connection.removeNameFromBanList(playerToBan);
    					c.sendMessage(playerToBan + " has been unbanned.");
    				} catch(Exception e) {
    					c.sendMessage("Player Must Be Offline.");
    				}
    			}
    					if (playerCommand.startsWith("ban") && playerCommand.charAt(3) == ' ') { // use as ::ban name
    				try {	
    					String playerToBan = playerCommand.substring(4);
    					Connection.addNameToBanList(playerToBan);
    					Connection.addNameToFile(playerToBan);
    					for(int i = 0; i < Config.MAX_PLAYERS; i++) {
    						if(Server.playerHandler.players[i] != null) {
    							if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
    								Server.playerHandler.players[i].disconnected = true;
    							} 
    						}
    					}
    				} catch(Exception e) {
    					c.sendMessage("Player Must Be Offline.");
    				}
    			}
    					if (playerCommand.startsWith("yell")) {
    				for (int j = 0; j < Server.playerHandler.players.length; j++) {
    					if (Server.playerHandler.players[j] != null) {
    						Client c2 = (Client)Server.playerHandler.players[j];
    						switch (c.playerRights){
    						case 1:
    						c2.sendMessage("@[email protected][M]@[email protected]["+c.playerName+"]: "+ playerCommand.substring(5)+"");
    						break;
    						case 2:
    						c2.sendMessage("@[email protected][A]@[email protected]["+c.playerName+"]: "+ playerCommand.substring(5)+"");
    						break;
    						case 3:
    						c2.sendMessage("@[email protected][O]@[email protected]["+c.playerName+"]: "+playerCommand.substring(5)+"");
    						break;
    					}
    					}
    			}
    		}
    		}
    		if (c.playerRights >= 2) {
    					if (playerCommand.startsWith("xteleto")) {
    				String name = playerCommand.substring(8);
    				for (int i = 0; i < Config.MAX_PLAYERS; i++) {
    					if (Server.playerHandler.players[i] != null) {
    						if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(name)) {
    							c.getPA().movePlayer(Server.playerHandler.players[i].getX(), Server.playerHandler.players[i].getY(), Server.playerHandler.players[i].heightLevel);
    						}
    					}
    				}			
    			}
    			
    					if (playerCommand.startsWith("mute")) {
    				try {	
    					String playerToBan = playerCommand.substring(5);
    					Connection.addNameToMuteList(playerToBan);
    					for(int i = 0; i < Config.MAX_PLAYERS; i++) {
    						if(Server.playerHandler.players[i] != null) {
    							if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
    								Client c2 = (Client)Server.playerHandler.players[i];
    								c2.sendMessage("You have been muted by: " + c.playerName);
    								break;
    							} 
    						}
    					}
    				} catch(Exception e) {
    					c.sendMessage("Player Must Be Offline.");
    				}			
    			}
    		}
    		
    		
    		
    		if (c.playerRights >= 3) {
    					if (playerCommand.startsWith("shop")) {
    				c.getShops().openShop(Integer.parseInt(playerCommand.substring(5)));
    			}
    
    			if (playerCommand.startsWith("tele")) {
    				String[] arg = playerCommand.split(" ");
    				if (arg.length > 3)
    					c.getPA().movePlayer(Integer.parseInt(arg[1]),Integer.parseInt(arg[2]),Integer.parseInt(arg[3]));
    				else if (arg.length == 3)
    					c.getPA().movePlayer(Integer.parseInt(arg[1]),Integer.parseInt(arg[2]),c.heightLevel);
    			}
    						if (playerCommand.startsWith("object")) {
    				String[] args = playerCommand.split(" ");				
    				c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, 0, 10);
    			}
    			if (playerCommand.startsWith("item")) {
    				if (c.inWild())
    					return;
    				try {
    				String[] args = playerCommand.split(" ");
    				if (args.length == 3) {
    					int newItemID = Integer.parseInt(args[1]);
    					int newItemAmount = Integer.parseInt(args[2]);
    					if ((newItemID <= 20000) && (newItemID >= 0)) {
    						c.getItems().addItem(newItemID, newItemAmount);
    						System.out.println("Spawned: " + newItemID + " by: " + c.playerName);
    					} else {
    						c.sendMessage("No such item.");
    					}
    				} else {
    					c.sendMessage("Use as ::item 995 200");
    				}
    				} catch (Exception e) {
    				
    				}
    			}
    			if (playerCommand.equalsIgnoreCase("mypos")) {
    				c.sendMessage("X: "+c.absX+" Y: "+c.absY+"");
    }
    			if (playerCommand.startsWith("interface")) {
    				String[] args = playerCommand.split(" ");
    				c.getPA().showInterface(Integer.parseInt(args[1]));
    			}
    			if (playerCommand.startsWith("reloaddrops")) {
    				Server.npcDrops = null;
    				Server.npcDrops = new server.model.npcs.NPCDrops();
    				/*for (int j = 0; j < Server.playerHandler.players.length; j++) {
    					if (Server.playerHandler.players[j] != null) {
    						Client c2 = (Client)Server.playerHandler.players[j];
    						c2.sendMessage("[" + c.playerName + "] " + "NPC Drops have been reloaded.");
    					}
    				}*/
    			}
    			
    
    			if (playerCommand.startsWith("reloadshops")) {
    				Server.shopHandler = new server.world.ShopHandler();
    			}
    			
    
    			if (playerCommand.startsWith("interface")) {
    				String[] args = playerCommand.split(" ");
    				c.getPA().showInterface(Integer.parseInt(args[1]));
    			}
    			if (playerCommand.startsWith("gfx")) {
    				String[] args = playerCommand.split(" ");
    				c.gfx0(Integer.parseInt(args[1]));
    			}
    			if (playerCommand.startsWith("update")) {
    				String[] args = playerCommand.split(" ");
    				int a = Integer.parseInt(args[1]);
    				PlayerHandler.updateSeconds = a;
    				PlayerHandler.updateAnnounced = false;
    				PlayerHandler.updateRunning = true;
    				PlayerHandler.updateStartTime = System.currentTimeMillis();
    			}
    		
    
    
    			if (playerCommand.equalsIgnoreCase("debug")) {
    				Server.playerExecuted = true;
    			}
    			if (playerCommand.equalsIgnoreCase("master")) {
    				for (int i = 0; i < 21; i++) {
    					c.playerLevel[i] = 99;
    					c.playerXP[i] = c.getPA().getXPForLevel(100);
    					c.getPA().refreshSkill(i);	
    					c.getPA().requestUpdates();
    				}
    			}
    	
    			
    			
    
    
    			
    			if(playerCommand.startsWith("npc") && c.playerName.equalsIgnoreCase("Sanity")) {
    				try {
    					int newNPC = Integer.parseInt(playerCommand.substring(4));
    					if(newNPC > 0) {
    						Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY, 0, 0, 120, 7, 70, 70, false, false);
    						c.sendMessage("You spawn a Npc.");
    					} else {
    						c.sendMessage("No such NPC.");
    					}
    				} catch(Exception e) {
    					
    				}			
    			}
    			
    			
    			if (playerCommand.startsWith("ipban")) { // use as ::ipban name
    				try {
    					String playerToBan = playerCommand.substring(6);
    					for(int i = 0; i < Config.MAX_PLAYERS; i++) {
    						if(Server.playerHandler.players[i] != null) {
    							if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
    								Connection.addIpToBanList(Server.playerHandler.players[i].connectedFrom);
    								Connection.addIpToFile(Server.playerHandler.players[i].connectedFrom);
    								c.sendMessage("You have IP banned the user: "+Server.playerHandler.players[i].playerName+" with the host: "+Server.playerHandler.players[i].connectedFrom);
    								Server.playerHandler.players[i].disconnected = true;
    							} 
    						}
    					}
    				} catch(Exception e) {
    					c.sendMessage("Player Must Be Offline.");
    				}
    			}
    			
    			if (playerCommand.startsWith("anim")) {
    				String[] args = playerCommand.split(" ");
    				c.startAnimation(Integer.parseInt(args[1]));
    				c.getPA().requestUpdates();
    			}
    			
    			if (playerCommand.startsWith("ipmute")) {
    				try {	
    					String playerToBan = playerCommand.substring(7);
    					for(int i = 0; i < Config.MAX_PLAYERS; i++) {
    						if(Server.playerHandler.players[i] != null) {
    							if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
    								Connection.addIpToMuteList(Server.playerHandler.players[i].connectedFrom);
    								c.sendMessage("You have IP Muted the user: "+Server.playerHandler.players[i].playerName);
    								Client c2 = (Client)Server.playerHandler.players[i];
    								c2.sendMessage("You have been muted by: " + c.playerName);
    								break;
    							} 
    						}
    					}
    				} catch(Exception e) {
    					c.sendMessage("Player Must Be Offline.");
    				}			
    			}
    			if (playerCommand.startsWith("unipmute")) {
    				try {	
    					String playerToBan = playerCommand.substring(9);
    					for(int i = 0; i < Config.MAX_PLAYERS; i++) {
    						if(Server.playerHandler.players[i] != null) {
    							if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
    								Connection.unIPMuteUser(Server.playerHandler.players[i].connectedFrom);
    								c.sendMessage("You have Un Ip-Muted the user: "+Server.playerHandler.players[i].playerName);
    								break;
    							} 
    						}
    					}
    				} catch(Exception e) {
    					c.sendMessage("Player Must Be Offline.");
    				}			
    			}
    			if (playerCommand.startsWith("unmute")) {
    				try {	
    					String playerToBan = playerCommand.substring(7);
    					Connection.unMuteUser(playerToBan);
    				} catch(Exception e) {
    					c.sendMessage("Player Must Be Offline.");
    				}			
    			}
    
    		}
    	
    			
    			
    		}
    }
    Reply With Quote  
     

  3. #3  
    Registered Member Ags Pride's Avatar
    Join Date
    Mar 2010
    Posts
    53
    Thanks given
    0
    Thanks received
    1
    Rep Power
    1
    God, you're gifted. Thanks again!
    Reply With Quote  
     

  4. #4  
    Austin_
    Guest
    No problem lol.
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Feb 2013
    Posts
    20
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    can u add case for a player? i did one but not working. please help
    Reply With Quote  
     

  6. #6  
    Member
    Join Date
    Jan 2013
    Posts
    110
    Thanks given
    3
    Thanks received
    1
    Rep Power
    0
    Quote Originally Posted by Ags Pride View Post
    How to add pickup/spawn item on Project Insanity? can you help me on this one?
    Just rip it from another source

    #CodingAtItsFinest
    Reply With Quote  
     

  7. #7  
    Banned
    Join Date
    Apr 2013
    Posts
    108
    Thanks given
    11
    Thanks received
    3
    Rep Power
    0
    just add the Item command to the Player's part of it.
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    Jan 2016
    Posts
    9
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    those are wrong commands the source comes with a wrong item/pickup command so you have nothing of use
    Reply With Quote  
     

  9. #9  
    mush

    Danny's Avatar
    Join Date
    Sep 2013
    Posts
    1,221
    Thanks given
    38
    Thanks received
    316
    Rep Power
    551
    Quote Originally Posted by dusty1366 View Post
    those are wrong commands the source comes with a wrong item/pickup command so you have nothing of use
    2010 thread.
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  10. #10  
    Registered Member
    Join Date
    Jan 2016
    Posts
    9
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    oh ok didn't look at date
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •