![]() |
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:
PHP Code:
|
Can we see the next function? I may be able to come up with a better way to fix it.
|
Quote:
PHP Code:
|
There's a couple problems, but the main one is you're using it wrong. It's not returning a string of accounts, it's returning an array of players. The only reason tokenizing it works is because it's being coerced into a string of comma-separated accounts.
Try this instead: PHP Code:
|
Wow you guys responded really fast! was not expecting that.
I ended up using a slightly altered version of cbk's example. Thanks everyone who responded! |
| All times are GMT +2. The time now is 06:56 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.