Thread: Two questions: Socketbuilder and Applydead

Results 1 to 6 of 6
  1. #1 Two questions: Socketbuilder and Applydead 
    Mr Blah Man
    Guest
    Question 1: Has been answered.

    ______________________________


    Question 2: Applydead. Here is my Applydead code:

    Code:
    public boolean ApplyDead() {
    	IsReallyDead = true;
    	OnlyOnce = true;
    	if (IsDeadTimer == false) {
    		pickupTimer = 0;
    		cantLeaveTimer = 0;
    		actionAmount++;
    		actionTimer = 8;
    		ResetAttack();
    		ResetAttackNPC();
    		IsDeadTimer = true;
         		ApplyDead();
    		ApplyDeadEat = true;
    		specialAttacks();
    		specialAttacks2();
    		specialAttacks3();
    		specialAttacks4();
    		specialAttacks5();
    		specialAttacks6();
    	}
    	if ((Wild()) && (IsReallyDead = true)){
    		IsReallyDead = false;
    		startAnimation(2241);
    		if (actionTimer <= 0 && IsDeadTimer == true) {
    			youdied();
    			ApplyDeadEat = false;
       			teleportToX = 2384;
    			teleportToY = 4720;
    			IsDeadTeleporting = true;
    			frame1();
    			updateRequired = true;
    			appearanceUpdateRequired = true;
    			NewHP = getLevelForXP(playerXP[3]);
    			setSkillLevel(3, getLevelForXP(playerXP[3]), playerXP[playerHitpoints]);
    			playerLevel[3] = getLevelForXP(playerXP[3]);
    			PoisonDelay = 9999999;
    			KillerId = playerId;
    			resetAnimation();
    		}
    	} else if ((isInBounty()) && (IsReallyDead = true)){
    		IsReallyDead = false;
    		startAnimation(2241);
    		if (actionTimer <= 0 && IsDeadTimer == true) {
    			checkBounty();
    			client killerz = (client) server.playerHandler.players[KillerId];
    			if((killerz != null) && (PlayerHandler.players[KillerId] != null) && (OnlyOnce = true)) {
    				killerz.BHkillCount += 1;
    				killerz.pickupTimer = 240;
      				killerz.sendMessage("You have killed a person in bounty");
     				killerz.sendMessage("You now have a total of "+killerz.BHkillCount+" kills.");
     				OnlyOnce = false;
    			}
    			youdied();
    			ApplyDeadEat = false;
      			teleportToX = 2709;
    			teleportToY = 9475;
    			IsDeadTeleporting = true;
    			frame1();
    			updateRequired = true;
    			appearanceUpdateRequired = true;
    			NewHP = getLevelForXP(playerXP[3]);
    			setSkillLevel(3, getLevelForXP(playerXP[3]), playerXP[playerHitpoints]);
    			playerLevel[3] = getLevelForXP(playerXP[3]);
    			PoisonDelay = 9999999;
    			KillerId = playerId;
    			resetAnimation();
    		}
    	} else {
    		IsReallyDead = false;
    		startAnimation(2241);
    		if (actionTimer <= 0 && IsDeadTimer == true) {
    			keepItem1();
    			keepItem2();
    			keepItem3();
    			deleteItem(keepItem, getItemSlot(keepItem), keepItemAmount);
    			deleteItem(keepItem2, getItemSlot(keepItem2), keepItemAmount2);
    			deleteItem(keepItem3, getItemSlot(keepItem3), keepItemAmount3);
    			youdied();
    			ApplyDeadEat = false;
     			teleportToX = 2384;
    			teleportToY = 4720;
    			IsDeadTeleporting = true;
    			frame1();
    			updateRequired = true;
    			appearanceUpdateRequired = true;
    			NewHP = getLevelForXP(playerXP[3]);
    			setSkillLevel(3, getLevelForXP(playerXP[3]), playerXP[playerHitpoints]);
    			playerLevel[3] = getLevelForXP(playerXP[3]);
    			setSkillLevel(5, getLevelForXP(playerXP[5]), playerXP[playerPrayer]);
    			playerLevel[5] = getLevelForXP(playerXP[5]);
    			PoisonDelay = 9999999;
    			KillerId = playerId;
    			if(keepItem != 0)
    	    			addItem(keepItem, keepItemAmount);
    			if(keepItem2 != 0)
    				addItem(keepItem2, keepItemAmount2);
    			if(keepItem3 != 0)
    				addItem(keepItem3, keepItemAmount3);
    	 		resetKeepItem();
    			resetAnimation();
    	 	}
    	}
    	ResetAttack();
    	startAnimation(-1);
    	return true;
    }
    Don't worry about all that OnlyOnce crap, etc. For some reason, the Applydead code may activate more than once if you were lagging.

    Alright, so, there's two things happening here: Upon death, the character just stands there for a couple seconds. The animation (in red), doesn't happen. The next dodgy thing is that when the character dies, the things in green are being sent to the one who DIED, not the one who KILLED. What's happening here? could it be to do with me connecting to my server on two accounts with the same IP? I'm unable to get my server online, so I can't test that theory out.

    Thanks,

    ~ Ice Ice Baby
     

  2. #2  
    Mr Blah Man
    Guest
    (still no answer)
     

  3. #3  
    Extreme Donator

    Wolf's Avatar
    Join Date
    Jul 2006
    Age
    34
    Posts
    398
    Thanks given
    0
    Thanks received
    2
    Rep Power
    177
    Code:
    if (!socketList.has(host) || host == 127.0.0.1 || host == "localhost") {
    						socketList.add(host);
    						server.playerHandler.newPlayerClient(s, host);
    					}
    Dunno if that'll work or not, but give it a try.

    Edit: Yeah 'host' does look better than 's.getInetAddress()'

    RuneCMS member / Early Sythe member
    RS-Server ex-admin [Member #38]
    Dodian ex-admin / developer
    SRL Developer
    MITB member

    Project16/Flight creator
     

  4. #4  
    Banned

    Join Date
    Oct 2006
    Age
    31
    Posts
    777
    Thanks given
    24
    Thanks received
    95
    Rep Power
    0
    uhh its been a LONG time since i dealed with this kinda stuff this might work:

    Code:
    					if (!socketList.has(host)) { //comment out this line to allow multiple connections
    						socketList.add(host);
    						server.playerHandler.newPlayerClient(s, host);
    					} else if(connectedFrom("127.0.0.1")) {
    					} //comment out this line to allow multiple connections
    something like that :/
     

  5. #5  
    Programmer, Contributor, RM and Veteran




    Join Date
    Mar 2007
    Posts
    5,147
    Thanks given
    2,656
    Thanks received
    3,731
    Rep Power
    5000
    Code:
    	public void run() {
    		try {
    			do {
    				Socket s = serverSocket.accept();
    				String host = s.getInetAddress().getHostName();
    				if (SocketFilter.connectionIsValid(s)) {
    					if (!socketList.has(host) || host == "localhost") { //comment out this line to allow multiple connections
    						socketList.add(host);
    						server.playerHandler.newPlayerClient(s, host);
    					} //comment out this line to allow multiple connections
    				} else {
    					destroy(s);
    				}
    			} while (true);
    		} catch (Exception e) {
    			System.out.println("[SocketBuilder]: server shutdown");
    		}
    	}
    .
     

  6. #6  
    Mr Blah Man
    Guest
    Thank you very much guys. 1 rep each

    Hoping to get an answer to my other question soon?
     


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
  •