View Single Post
  #4  
Old 11-29-2009, 08:26 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
I've already explained in other threads that you need to place the damage into another weapon, and even given you the code for the HP system:

Quote:
Originally Posted by cbk1994 View Post
PHP Code:
function onActionServerSide(cmddamage) {
  if (
cmd == "hit") {
    
this.hitPlayer(damage);
  }
}

function 
hitPlayer(damage) {
  
player.clientr.hp max (0player.clientr.hp damage); // max() chooses the largest of the two values
  
  
if (player.clientr.hp <= 0) {
    
this.playerDead();
  } else {
    
player.setAni("hurt"NULL);
  }
}

function 
playerDead() {
  
player.setAni("dead"NULL);
  
player.setlevel2("onlinestartlocal.nw"2155);
  
// now you'll need eventually to heal them
  
}
//#CLIENTSIDE
function onActionProjectile(damage) {
  
triggerServer("gui"this.name"hit"damage);

Every player has to have the system weapon. The way it works is when a player is hit with a bullet, it calls the "onActionProjectile" event in every weapon. If a weapon has the event "defined", then it will be executed. If they don't have your gun script, which is where you mistakenly put the HP checks, then it won't be called.

Take your onActionProjectile code, place it in to a weapon like "-Health", and add a line of code in the Control-NPC to add it to players on login.

EDIT: Jerret beat me to it
__________________
Reply With Quote