View Single Post
  #1  
Old 06-24-2011, 05:26 PM
BrianD BrianD is offline
Registered User
Join Date: Jun 2011
Posts: 2
BrianD is on a distinguished road
Custom fighting system..can't alter variable properly?

I've designed a custom sword/fighting system for my server, and can't seem to work out the only real problem. I use findnearestplayers to recognize the closest player, and tokenize it, however this sometimes turns out in client.hurt[1] being my own account, and not the nearest account besides my own. in theory, client.hurt[0] should be my own account, and the second closest player to me besides myself is client.hurt[1]...however it's sporadic and i'm not sure why.

Anyways. I tried to make it so if it recognizes client.hurt[1] as the player's account it changes it to client.hurt[0] but this is not working. Any suggestions?
PHP Code:
//#CLIENTSIDE
function activePlayers() 
{
temp.player.x;
temp.player.y;
client.acc player.account;
client.hurtfindnearestplayers(temp.xtemp.y);
client.hurt.tokenize(",");
if (
client.hurt[1] == player.account) {
client.hurt[1] = client.hurt[0];
}
Attack(client.typeplayer.dir); //next function which would calculate 
                                          //if the player is close enough to client.hurt[1]
                                         //to hurt him.
 

with this script, after it does the attack function, it moves serverside to distribute health loss. Here's what it echos to show you how it screws up client.hurt[1] and client.hurt[0]:

PHP Code:
Fighting:Graal778318 hurt pc:5390521 for 2
<b>Fighting:Graal778318 hurt pc:5390521 for 2
<b>Fighting:Graal778318 hurt pc:5390521 for 2
<b>Fighting:Graal778318 hurt pc:5390521 for 2
Weapon
/GUI-script +Fighting added/updated by BrianD
Weapon
/GUI-script +Fighting added/updated by BrianD
<b>Fighting:Graal778318 hurt pc:5390521 for 2
<b>Fighting:Graal778318 hurt Graal778318 for 2
<b>Fighting:Graal778318 hurt pc:5390521 for 2
<b>Fighting:Graal778318 hurt pc:5390521 for 2
<b>Fighting:Graal778318 hurt pc:5390521 for 2
<b>Fighting:Graal778318 hurt pc:5390521 for 2
<b>Fighting:Graal778318 hurt Graal778318 for 2
<b>Fighting:Graal778318 hurt Graal778318 for 2
<b>Fighting:Graal778318 hurt pc:5390521 for 2
<b>Fighting:Graal778318 hurt Graal778318 for 2
<b>Fighting:Graal778318 hurt Graal778318 for 2
<b>Fighting:Graal778318 hurt Graal778318 for 2
<b>Fighting:Graal778318 hurt pc:5390521 for 2
<b>Fighting:Graal778318 hurt Graal778318 for 2
<b>Fighting:Graal778318 hurt Graal778318 for 
Forgive my sloppiness by the way haha, i'm not a neat scripter.
Reply With Quote