Thread: client c = ?!@@!?!?!?!! rep++

Page 1 of 2 12 LastLast
Results 1 to 10 of 19
  1. #1 client c = ?!@@!?!?!?!! rep++ 
    Banned

    Join Date
    Sep 2009
    Posts
    3,245
    Thanks given
    195
    Thanks received
    255
    Rep Power
    0
    Ok I'm trying to learn here so no flame for my retardation.



    Code:
    				if (npcs[i].isDead == true) {
    					
    					if (npcs[i].npcType == 750) {
    					spawnNpc(c, 751, c.getX(), c.getY()-1, -1, 0, 120, 25, 200, 200, true, true);
    					}
    error is c. can't be found.

    Code:
    src\server\model\npcs\NPCHandler.java:1058: cannot find symbol
    symbol  : variable c
    location: class server.model.npcs.NPCHandler
                                            spawnNpc(c, 751, c.getX(), c.getY()-1, -
    1, 0, 120, 25, 200, 200, true, true);
                                                     ^
    src\server\model\npcs\NPCHandler.java:1058: cannot find symbol
    symbol  : variable c
    location: class server.model.npcs.NPCHandler
                                            spawnNpc(c, 751, c.getX(), c.getY()-1, -
    1, 0, 120, 25, 200, 200, true, true);
                                                             ^
    src\server\model\npcs\NPCHandler.java:1058: cannot find symbol
    symbol  : variable c
    location: class server.model.npcs.NPCHandler
                                            spawnNpc(c, 751, c.getX(), c.getY()-1, -
    1, 0, 120, 25, 200, 200, true, true);
                                                                       ^
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    3 errors
    Press any key to continue . . .
    Usuaully c. works in every class so I've never understood how to declare c. to be client.java or what ever i need to declare it as for the above method to work?

    the spawn npc method is here.

    Code:
    	public void spawnNpc(Client c, int npcType, int x, int y, int heightLevel, int WalkingType, int HP, int maxHit, int attack, int defence, boolean attackPlayer, boolean headIcon) {
    		// first, search for a free slot
    		int slot = -1;
    		for (int i = 1; i < maxNPCs; i++) {
    			if (npcs[i] == null) {
    				slot = i;
    				break;
    			}
    		}
    		if(slot == -1) {
    			//Misc.println("No Free Slot");
    			return;		// no free slot found
    		}
    		NPC newNPC = new NPC(slot, npcType);
    		newNPC.absX = x;
    		newNPC.absY = y;
    		newNPC.makeX = x;
    		newNPC.makeY = y;
    		newNPC.heightLevel = heightLevel;
    		newNPC.walkingType = WalkingType;
    		newNPC.HP = HP;
    		newNPC.MaxHP = HP;
    		newNPC.maxHit = maxHit;
    		newNPC.attack = attack;
    		newNPC.defence = defence;
    		newNPC.spawnedBy = c.getId();
    		if(headIcon) 
    			c.getPA().drawHeadicon(1, slot, 0, 0);
    		if(attackPlayer) {
    			newNPC.underAttack = true;
    			if(c != null) {
    				if(server.model.minigames.Barrows.COFFIN_AND_BROTHERS[c.randomCoffin][1] != newNPC.npcType) {
    					if(newNPC.npcType == 2025 || newNPC.npcType == 2026 || newNPC.npcType == 2027 || newNPC.npcType == 2028 || newNPC.npcType == 2029 || newNPC.npcType == 2030) {
    						newNPC.forceChat("You dare disturb my rest!");
    					}
    				}
    				if(server.model.minigames.Barrows.COFFIN_AND_BROTHERS[c.randomCoffin][1] == newNPC.npcType) {
    					newNPC.forceChat("You dare steal from us!");
    				}
    				
    				newNPC.killerId = c.playerId;
    			}
    		}
    		npcs[slot] = newNPC;
    	}
    rep+ for help thankyou! =D
     

  2. #2  
    Banned

    Join Date
    Sep 2009
    Posts
    3,245
    Thanks given
    195
    Thanks received
    255
    Rep Power
    0
    24H bump
     

  3. #3  
    PokeNation! Xaves's Avatar
    Join Date
    Dec 2007
    Age
    32
    Posts
    3,476
    Thanks given
    356
    Thanks received
    788
    Rep Power
    646
    post in NPCHandler.java with that modification in Rune-Server Official Pastebin
     

  4. #4  
    Banned

    Join Date
    Jan 2007
    Posts
    518
    Thanks given
    1
    Thanks received
    3
    Rep Power
    0
    Is it something like this you need?

    Code:
    	private Client c;
    	
    	public NPCHandler(Client c) {
    		this.c = c;
    	}
     

  5. #5  
    Banned

    Join Date
    Sep 2009
    Posts
    3,245
    Thanks given
    195
    Thanks received
    255
    Rep Power
    0
    I'm not sure what I need Marius =[ It's in the process method { so can't add another method inside.
     

  6. #6  
    Registered Member
    Join Date
    Aug 2009
    Posts
    608
    Thanks given
    1
    Thanks received
    17
    Rep Power
    6
    Right under: public/private class NPCHandler.java {
    add: client c;

    Also make sure you import client.java.
     

  7. #7  
    The Illest

    iitzTyson's Avatar
    Join Date
    May 2010
    Posts
    1,164
    Thanks given
    345
    Thanks received
    73
    Rep Power
    103
    I think all your missing is an import?
     

  8. #8  
    Banned

    Join Date
    Sep 2009
    Posts
    3,245
    Thanks given
    195
    Thanks received
    255
    Rep Power
    0
    great! no errors , but my npc doesn't spawn! it gives me an error and shuts server down


    Code:
    					if (npcs[i].npcType == 750) {
    					spawnNpc(c, 2030, 2869, 3547 -1, -1, 0, 120, 25, 200, 200, true, true);
     

  9. #9  
    Registered Member

    Join Date
    Mar 2008
    Age
    32
    Posts
    749
    Thanks given
    18
    Thanks received
    31
    Rep Power
    130
    Do what you have been told and post your NPChandler class into pastebin...
    Message me for a DETAILED security scan of your website.
     

  10. #10  
    Registered Member
    Join Date
    Aug 2009
    Posts
    608
    Thanks given
    1
    Thanks received
    17
    Rep Power
    6
    Try spawning your npc in the cfg?
     

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

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