Quote:
Originally Posted by GULTHEX
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(cmd, damage) {
if (cmd == "hit") {
this.hitPlayer(damage);
}
}
function hitPlayer(damage) {
player.clientr.hp = max (0, player.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", 21, 55);
// 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.