blid based is pretty inconvenient though. probably better just to check if the input is all numbers and attempt a blid match first, then if that fails use findClientByName.
function serverCmdSlay(%client,%query) {
if(!%client.isAdmin) return;
// Try to find the requested client with the credentials in %query.
if(!isObject(%queryObj = findClientByName(%query))) {
if(!isObject(%queryObj = findClientByBL_ID(%query))) {
// Couldn't find the requested client via Name / BL_ID.
messageClient(%client,'',"\c6No one found by that name / BL_ID.");
return;
}
}
if(!isObject(%player = %queryObj.player)) return; // Checks if the queried client's player exists. If it doesnt, stop the function.
// Kill the player.
%player.kill();
}
Here's an example for you, OP. This will allow people to go by BL_ID and Name easily.
And then, if you want to kill me, type any of these in-game (provided i'm on the server of course):
/slay "Clay Hanson"
or
/slay Clay
or
/slay 15144
And because there may be multiple people on the server with 'Clay' in their name, you can always go by bl_id.
Always check name first, since some people could have a number-based name.