View Single Post
  #3  
Old 11-29-2009, 08:27 AM
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
Quote:
Originally Posted by GULTHEX View Post
NPC Code:
if(actionprojectile){
newhp = strtofloat(#s(clientr.hp)) - client.attackpower;
if (newhp<=0) {
newhp = 100;
setani dead,;
dead;
} else {
setani hurt,;
clientr.hp =-20;
}
setstring clientr.hp,#v(newhp);
}{
function dead() {
setlevel2 onlinestartlocal.nw,21,55;
}
}


why wont it warp them?
Why are you using GS1?

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);

When you're shooting the projectile, you can do something like

PHP Code:
setShootParams(20); 
before the shoot() command, which will allow you to give guns different damages.
__________________

Last edited by cbk1994; 11-29-2009 at 08:28 PM.. Reason: oops
Reply With Quote