It's not really a big deal but you can do the "search" processing on the client-side.
Then in the case of multiple results, you can just display a dialog and have the player select who they wanted to summon.
I would suggest using.. string.starts("text") or string.pos("text") for checking for partials. I.e:
PHP Code:
function onCreated() {
temp.str = "loltextlmao";
echo(temp.str.pos("text")); // echos 3 (found == position >= 0)
echo(temp.str.pos("rofl")); // echos -1 (not found)
echo(temp.str.starts("lol")); // echos 1 (found)
echo(temp.str.starts("lmao")); // echos 0 (not found)
}
Also in your check... you should have community name support as well. Another thing when searching you should probably check them all in lowercase or uppercase. I.e:
PHP Code:
function onCreated() {
temp.exact = "Phil";
temp.cond = temp.exact.lower();
temp.matches = {};
for (a: allplayers) {
// Skip RCs
if (a.level == NULL) continue;
// Check for Exact Match
if (a.account == temp.exact || a.communityname == temp.exact) {
temp.found = a.account;
break;
}
// Check for Partials
if (a.account.lower().pos(temp.cond) >= 0 || a.communityname.lower().pos(temp.cond) >= 0 || a.nick.lower().pos(temp.cond) >= 0) {
temp.matches.add(a.account);
}
}
if (temp.found != "") {
echo("Found... " @ temp.found);
} else {
echo("Other matches... " @ temp.matches);
}
}