Thread: Teleporting issues in the duel arena.

Results 1 to 9 of 9
  1. #1 Teleporting issues in the duel arena. 
    Registered Member Mikey's Avatar
    Join Date
    Apr 2011
    Posts
    751
    Thanks given
    570
    Thanks received
    32
    Rep Power
    40
    Problem is you can just tele straight out in the middle of a duel.
    I've looked at this a few times before posting and I just can't get my head around it

    Anyway heres whats needed....

    The final accept button to place you into a duel...
    Code:
    			case 25120:
    			if(c.duelStatus == 5) {
    				break;
    			}
    			Client o1 = (Client) Server.playerHandler.players[c.duelingWith];
    			if(o1 == null) {
    				c.getTradeAndDuel().declineDuel();
    				return;
    			}
    
    			c.duelStatus = 4;
    			if(o1.duelStatus == 4 && c.duelStatus == 4) {				
    				c.getTradeAndDuel().startDuel();
    				o1.getTradeAndDuel().startDuel();
    				o1.duelCount = 4;
    				c.duelCount = 4;
    				c.duelDelay = System.currentTimeMillis();
    				o1.duelDelay = System.currentTimeMillis();
    			} else {
    				c.getPA().sendFrame126("Waiting for other player...", 6571);
    				o1.getPA().sendFrame126("Other player has accepted", 6571);
    			}
    			break;
    The start duel method...
    Code:
    	public void startDuel() {
    		Client o = (Client) Server.playerHandler.players[c.duelingWith];
    		if(o == null) {
    			duelVictory();
    		}		
    		c.duelStatus = 5;
    		c.headIconHints = 2;
    		
    		if(c.duelRule[7]){
    			for(int p = 0; p < c.PRAYER.length; p++) { // reset prayer glows 
    				c.prayerActive[p] = false;
    				c.getPA().sendFrame36(c.PRAYER_GLOW[p], 0);		
    			}
    			c.getCombat().resetPrayer();
    			c.getCombat().resetCurse();
    			c.prayerId = -1;	
    			c.ProtectItem = false;
    		c.getPA().refreshSkill(5);
    			c.headIcon = -1;
    			c.getPA().requestUpdates();
    		}		
    		if(c.duelRule[11]) {
    			c.getItems().removeItem(c.playerEquipment[0], 0);
    		}
    		if(c.duelRule[12]) {
    			c.getItems().removeItem(c.playerEquipment[1], 1);
    		}
    		if(c.duelRule[13]) {
    			c.getItems().removeItem(c.playerEquipment[2], 2);
    		}
    		if(c.duelRule[14]) {
    			c.getItems().removeItem(c.playerEquipment[3], 3);
    		}
    		if(c.duelRule[15]) {
    			c.getItems().removeItem(c.playerEquipment[4], 4);
    		}
    		if(c.duelRule[16]) {
    			c.getItems().removeItem(c.playerEquipment[5], 5);
    		}
    		if(c.duelRule[17]) {
    			c.getItems().removeItem(c.playerEquipment[7], 7);
    		}
    		if(c.duelRule[18]) {
    			c.getItems().removeItem(c.playerEquipment[9], 9);
    		}
    		if(c.duelRule[19]) {
    			c.getItems().removeItem(c.playerEquipment[10], 10);
    		}
    		if(c.duelRule[20]) {
    			c.getItems().removeItem(c.playerEquipment[12], 12);
    		}
    		if(c.duelRule[21]) {
    			c.getItems().removeItem(c.playerEquipment[13], 13);
    		}
    		c.getPA().removeAllWindows();
    		c.specAmount = 10;
    		c.getItems().addSpecialBar(c.playerEquipment[c.playerWeapon]);
    		
    		if(c.duelRule[8]){	
    			if(c.duelRule[1]) {
    				c.getPA().movePlayer(c.duelTeleX, c.duelTeleY, 0);
    			} else {
    				c.getPA().movePlayer(3366 + Misc.random(12), 3246 + Misc.random(6), 0);
    			}
    		} else {
    			if(c.duelRule[1]) {
    				c.getPA().movePlayer(c.duelTeleX, c.duelTeleY, 0);
    			} else {	
    				c.getPA().movePlayer(3335 + Misc.random(12), 3246 + Misc.random(6), 0);
    			}
    		}
    
    		c.getPA().createPlayerHints(10, o.playerId);
    		c.getPA().showOption(3, 0, "Attack", 1);
    		for (int i = 0; i < 20; i++) {
    			c.playerLevel[i] = c.getPA().getLevelForXP(c.playerXP[i]);
    			c.getPA().refreshSkill(i);
    		}
    		for(GameItem item : o.getTradeAndDuel().stakedItems) {
    			otherStakedItems.add(new GameItem(item.id, item.amount));
    		}
    		c.getPA().requestUpdates();			
    	}
    The startteleport method in playerassistant.
    Code:
    	public void startTeleport(int x, int y, int height, String teleportType) {
    				c.getTradeAndDuel().declineDuel();
    				c.getPA().closeAllWindows();
    		if(c.duelStatus == 5) {
    			c.sendMessage("You can't teleport during a duel!");
    			return;
    		}
    		if(c.inWild() && c.wildLevel > Config.NO_TELEPORT_WILD_LEVEL) {
    			c.sendMessage("You can't teleport above level "+Config.NO_TELEPORT_WILD_LEVEL+" in the wilderness.");
    			return;
    		}
    		if(c.Jail == true) {
    			c.sendMessage("You can't teleport out of prison idiot!");
    			return;
    		}
    		if(c.inJail() && c.Jail == true) {
    			c.sendMessage("You can't teleport out of prison idiot!");
    			return;
    		}
    		if(c.isInDungeon() && c.dungeonFinished == false) {
    			c.sendMessage("You can't teleport whilst doing dungeoneering");
    			return;
    		}
    		if(c.inFightCaves()) {
    			c.sendMessage("You can't teleport Out of FightCaves.");
    			return;
    		}
    		if(c.inPits == true) {
    			c.sendMessage("You can't teleport out of the fight pits!");
    			return;
    		}
    		if(System.currentTimeMillis() - c.teleBlockDelay < c.teleBlockLength) {
    			c.sendMessage("You are teleblocked and can't teleport.");
    			return;
    		}
    		if(!c.isDead && c.teleTimer == 0 && c.respawnTimer == -6) {
    			if (c.playerIndex > 0 || c.npcIndex > 0)
    				c.getCombat().resetPlayerAttack();
    			EarningPotential.checkTeleport(c);
    			c.stopMovement();
    			removeAllWindows();			
    			c.teleX = x;
    			c.teleY = y;
    			c.npcIndex = 0;
    			c.playerIndex = 0;
    			c.faceUpdate(0);
    			c.teleHeight = height;
    			if(teleportType.equalsIgnoreCase("modern")) {
    				c.startAnimation(8939);
    				c.teleTimer = 11;
    				c.gfx0(1576);
    				c.teleEndAnimation = 8941;
    				c.teleEndGfx = 1577;
    			}
    			if(teleportType.equalsIgnoreCase("ancient")) {
    				c.startAnimation(9599);
    				c.teleGfx = 0;
    				c.teleTimer = 11;
    				c.teleEndAnimation = 8941;
    				c.gfx0(1681); 
    			}
    			if(teleportType.equalsIgnoreCase("dungeoneering")) {
    				c.startAnimation(13652);
    				c.teleGfx = 0;
    				c.teleTimer = 16;
    				c.gfx0(2602);
    				c.teleEndAnimation = 13654;
    			}
    			if(teleportType.equalsIgnoreCase("lunar")) {
    				c.startAnimation(8939);
    				c.teleTimer = 11;
    				c.gfx0(1576);
    				c.teleEndAnimation = 8941;
    				c.teleEndGfx = 1577;
    				} 
    			}
    		}
    I'd appreciate any help and I'm open for teamviewer if you want.
    Although it may be laggy

    Thanks in advance, Mikey


     

  2. #2  
    Banned

    Join Date
    Jul 2009
    Posts
    3,999
    Thanks given
    1,003
    Thanks received
    1,028
    Rep Power
    0
    Code:
    	public void startTeleport2(int x, int y, int height) {
    		if(c.duelStatus == 5) {
    			c.sendMessage("You can't teleport during a duel!");
    			return;
    Above:

    Code:
    		if(System.currentTimeMillis() - c.teleBlockDelay < c.teleBlockLength) {
    			c.sendMessage("You are teleblocked and can't teleport.");
    			return;
    		}
     

  3. #3  
    Registered Member Mikey's Avatar
    Join Date
    Apr 2011
    Posts
    751
    Thanks given
    570
    Thanks received
    32
    Rep Power
    40
    Already got that...
    Code:
    	public void startTeleport2(int x, int y, int height, String teleportType) {
    		if(c.duelStatus == 5) {
    			c.sendMessage("You can't teleport during a duel!");
    			return;
    		}
    		if(System.currentTimeMillis() - c.teleBlockDelay < c.teleBlockLength) {
    			c.sendMessage("You are teleblocked and can't teleport.");
    			return;
    		}
    		if(c.Jail == true) {
    			c.sendMessage("You can't teleport out of prison idiot!");
    			return;
    		}
    		if(!c.isDead && c.teleTimer == 0) {			
    			c.stopMovement();
    			removeAllWindows();			
    			c.teleX = x;
    			c.teleY = y;
    			c.npcIndex = 0;
    			c.playerIndex = 0;
    			c.faceUpdate(0);
    			c.teleHeight = height;
    			c.startAnimation(8939);
    			c.teleTimer = 11;
    			c.teleGfx = 1576;
    			c.teleEndAnimation = 715;
    			
    		}
    	}


     

  4. #4  
    Registered Member Mikey's Avatar
    Join Date
    Apr 2011
    Posts
    751
    Thanks given
    570
    Thanks received
    32
    Rep Power
    40
    Bump


     

  5. #5  
    Registered Member
    netzo's Avatar
    Join Date
    Feb 2008
    Age
    31
    Posts
    1,226
    Thanks given
    402
    Thanks received
    135
    Rep Power
    185
    make a simple boolean, if the player accepts duel, make the boolean true, if the player wins or loses the duel, make it false, and make the tele method check if the boolean is false, let it work
     

  6. #6  
    Registered Member Mikey's Avatar
    Join Date
    Apr 2011
    Posts
    751
    Thanks given
    570
    Thanks received
    32
    Rep Power
    40
    Thats basically what duelstatus is doing if you look at the parts I made bold its a little more understandable.
    The only thing I can think of is when your character gets moved it resets the status of the duelstatus or the duelstatus isn't being set in the first place.

    Thanks for trying to help, if I'm wrong feel free to help me out a little

    - Mikey


     

  7. #7  
    Respected Member


    Join Date
    Jan 2009
    Posts
    5,743
    Thanks given
    1,162
    Thanks received
    3,603
    Rep Power
    5000
    if(dualStatus != 0) { dont do shit }
     

  8. #8  
    Banned
    Join Date
    Apr 2011
    Posts
    215
    Thanks given
    18
    Thanks received
    7
    Rep Power
    0
    Player Assistant...
    in:
    Code:
    public boolean teleTabTeleport(int x, int y, int height, String teleportType){
    Add:

    Code:
    else if(c.duelStatus == 5){
    		c.sendMessage("You can't teleport during a duel!");
    	}
     

  9. #9  
    Registered Member Mikey's Avatar
    Join Date
    Apr 2011
    Posts
    751
    Thanks given
    570
    Thanks received
    32
    Rep Power
    40
    Doors this would be correct yes?
    Code:
    		if(c.duelStatus != 0) {
    			c.sendMessage("You can't teleport during a duel!");
    			return;
    		}
    Just when you said "dont do shit" I wasn't sure if you meant don't let them tele or carry on teleing if you know what I mean

    Also saadmboy something similar has already been posted and thats just another method of teleing

    - Mikey

    EDIT: Fixed myself as usual

    Close please


     


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. Replies: 4
    Last Post: 11-20-2010, 10:11 PM
  2. Replies: 12
    Last Post: 11-12-2010, 10:17 AM
  3. Replies: 1
    Last Post: 10-17-2009, 08:10 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
  •