IsNameUnique Bug
by Seth Willits · in Torque Game Builder · 05/10/2008 (6:35 pm) · 1 replies
function isNameUnique(%name)
{
%count = ClientGroup.getCount();
for (%i = 0; %i < %count; %i++)
{
%client = ClientGroup.getObject(%i);
// This bit of original code does not work:
//%test = detag(getTaggedString(%client.name));
//if (strcmp(%name, %test) == 0)
// return false;
// Simply doing this works just dandily
if (%name $= %client.name) return false;
}
// If we get here, the name is unique.
return true;
}About the author
http://www.sethwillits.com/
Torque Owner Seth Willits
commandToClient(%client, 'SetPlayerName', %client.name); function clientCmdSetPlayerName(%name) { $pref::Player::name = %name; $GAME::Player::Name = $pref::Player::name; }