View Single Post
  #56  
Old 03-14-2010, 06:55 PM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Quote:
Originally Posted by jkldogg View Post
SORRY DOUBLE POST.

The problem is whenever you die, a little watermark appears and you press Space bar to revive, this worked fine. But switch came back and altered the script and now it doesn't let you respawn. You must reconnect to the server to revive. This is extremely annoying, and many of our players have stopped coming because of this reason. Help is appreciated, please and thank you in advance.

I tried to fix it by altering this code, but I think I did more harm than good?

Here's the full code.
PHP Code:
function onActionServerside(cmdp1p2) {
  if (
cmd == "setstats") {
    
clientr.health_current clientr.health_max 100;
    
clientr.armor_current clientr.armor_max 0;
    
onHeal(player.account);
  }
  if (
cmd == "hurt") {
    if (!
player.level.isnopkzone) {
      if (
clientr.armor_current 0) {
        if (
clientr.armor_current >= p1) {
          
clientr.armor_current -= p1;
          if (
clientr.armor_current 0) {
            
clientr.armor_max 0;
          }
          
player.ani "hurt";;
          
scheduleEvent(1"Unhurt"player.account);
        }
        else {
          
temp.remain p1-clientr.armor_current;
          
clientr.armor_current clientr.armor_max 0;
          
clientr.health_current -= temp.remain;
          if (
clientr.health_current <= 0) {
            
clientr.health_current 0;
            
death(p2);
          }
        }
      }
      else if (
clientr.health_current 0) {
        if (
clientr.health_current p1) {
          
clientr.health_current -= p1;
          
player.ani "hurt";
          
scheduleEvent(1"Unhurt"player.account);
        }
        else {
          
clientr.health_current 0;
          
death(p2);
        }
      }
    }
  }
  else if (
cmd == "respawn") {
    
onHeal(player.account);
  }
  
triggerClient("gui"this.name);
}
function 
onUnhurt(pl) {
  if (
player.ani == "hurt") {
    
player.ani "idle";
  }
}
function 
death(pl) {
  
player.ani "dead";
  
freezePlayer2();
  
clientr.deaths++;
  
clientr.dead true;
  
player.chat "" @findPlayer(pl).communityname"!";
  
findPlayer(pl).clientr.kills++;
  
findPlayer(pl).chat "" @player.communityname"!";
}
function 
onHeal(pl) {
  
findPlayer(pl).ani "idle";
  
clientr.dead false;
  
findPlayer(pl).clientr.health_current findPlayer(pl).clientr.health_max;
  
findPlayer(pl).unfreezePlayer();
  
findPlayer(pl).setLevel2("overworld_ad-ae.nw"9.37562.5);
  
findPlayer(pl).triggerClient("gui"this.name);
}

//#CLIENTSIDE
function onCreated() {
  
Health this;
  if (
clientr.health_current == null) {
    
triggerServer("gui"this.name"setstats");
  }
}
function 
GraalControl.onKeyPressed(codekeyscan) {
  if (
clientr.health_current == null) {
    if (
scan == 0) {
      
triggerServer("gui"this.name"respawn");
    }
  }
}
function 
onActionClientside() {
  
HUD.findImg(201).width = ((clientr.health_current/clientr.health_max)*82)/16;
  if (
clientr.health_current 0) {
    
HUD.findImg(201).alpha 1;
  }
  else {
    
HUD.findImg(201).alpha 0;
  }
  
HUD.findImg(202).text clientr.health_current"/" @clientr.health_max;
  
HUD.findImg(203).width = ((clientr.health_current/clientr.health_max)*82)/16;
  if (
clientr.armor_current 0) {
    
HUD.findImg(203).alpha 1;
  }
  else {
    
HUD.findImg(203).alpha 0;
  }
  
HUD.findImg(204).text = (clientr.armor_current == null?"0/0":clientr.armor_current"/"clientr.armor_max);
  if (
clientr.health_current == null) {
    
with (findImg(200)) {
      
polygon = {GraalControl.width/2-GraalControl.width/5GraalControl.height/2+GraalControl.height/4,
                 
GraalControl.width/2+GraalControl.width/5GraalControl.height/2+GraalControl.height/4,
                 
GraalControl.width/2+GraalControl.width/5GraalControl.height/2+GraalControl.height/3,
                 
GraalControl.width/2-GraalControl.width/5GraalControl.height/2+GraalControl.height/3};
      
layer 4;
      
red green blue 0;
      
mode 1;
      
alpha 0.7;
    }
    
with (findImg(201)) {
      
text "Press spacebar to revive.";
      
GraalControl.width/2GraalControl.height/2+GraalControl.height/3.5;
      
layer 4;
      
style "c";
      
red green blue 1;
      
zoom GraalControl.width/600;
    }
  }
  else {
    
hideImgs(200201);
  }
}
function 
GraalControl.onResize() {
  if (
clientr.health_current == null) {
    
with (findImg(200)) {
      
polygon = {GraalControl.width/2-GraalControl.width/5GraalControl.height/2+GraalControl.height/4,
                 
GraalControl.width/2+GraalControl.width/5GraalControl.height/2+GraalControl.height/4,
                 
GraalControl.width/2+GraalControl.width/5GraalControl.height/2+GraalControl.height/3,
                 
GraalControl.width/2-GraalControl.width/5GraalControl.height/2+GraalControl.height/3};
      
layer 4;
      
red green blue 0;
      
mode 1;
      
alpha 0.7;
    }
    
with (findImg(201)) {
      
text "Press spacebar to revive.";
      
GraalControl.width/2GraalControl.height/2+GraalControl.height/3.5;
      
layer 4;
      
style "c";
      
red green blue 1;
      
zoom GraalControl.width/600;
    }
  }
}

function 
onActionProjectile(bdmgpl) {
  if (
== "bullet") {
    
triggerServer("gui"this.name"hurt"dmgpl);
  }

Not sure what is going on, but try replacing
PHP Code:
function GraalControl.onKeyPressed(codekeyscan) { 
with
PHP Code:
function onKeyPressed(codekeyscan) { 
You should probably ask Switch about it since he's the last one who messed with it before it broke.
Reply With Quote