Quote:
Originally Posted by Knightmare1
Jazz, i meant how do i find the player whos im attacking. like if i attack some player, how would i make them get hurt.
this is what i have so far:
|
He means to send a triggeraction when you press S, and then have it detect it, probably something like this:
PHP Code:
function onActionServerSide()
{
if (params[0] == "hurt")
{
clientr.hp -= temp.player.clientr.weapon_damage;
}
elseif (params[0] == "dead")
{
clientr.hp = 0;
clientr.dead = 1;
clientr.deaths += 1;
}
elseif (params[0] == "kill")
{
clientr.kills_@clientr.weapon += 1;
clientr.kills += 1;
clientr.exp += 4;
clientr.message = "You have killed " @temp.player_hit;
}
elseif (params[0] == "revive")
{
clientr.hp = clientr.hp_max;
setlevel2("final_osl.nw", 30, 30);
}
elseif (params[0] == "attack")
{
temp.player.clientr.hp -= clientr.weapon_damage;
}
}
function onCreated()
{
clientr.hp = 100;
clientr.hp_max = 100;
clientr.deaths = 0;
clientr.kills = 0;
clientr.dead = 0;
}
function onActionHit(acct) {
player.chat = "I've been hit by" SPC acct;
clientr.hp -= temp.player.clientr.weapon_damage;
}
//#CLIENTSIDE
function onKeyPressed() {
if (keydown(5)) {
setAni(clientr.ani_attack, "");
triggeraction(player.x + 1 + vecx(player.dir) * 1.5, player.y + 2 + vecy(player.dir) * 1.5, "Hit", player.account);
}
}