function serverCmdAddMe(%client) {
// Add them to the "list"
$ClientList[ $ClientListCount++ ] = %client;
// Done
}
function serverCmdRemoveMe(%client) {
// Remove them from the "list"
// Wait... are they even on it? Let's check:
%index = -1;
for(%i = 1; %i <= $ClientListCount; %i++) {
if( $ClientList[ %i ] == %client ) {
%index = %i;
// Yep, they're on the list
break;
}
}
if( %index < 0 ) {
// They're not on the list!!
messageClient(%client, '', '\c3You\'re not on the list...');
return;
}
// Remove them from the list
$ClientList[ %index ] = "";
// Bump back all the clients so we don't have a blank space in our $ClientList array
for(%i = %index; %i <= $ClientListCount; %i++) {
$ClientList[ %i ] = $ClientList[ %i + 1 ];
}
$ClientListCount--;
}
function serverCmdReadList(%client) {
// Show them the list... loop thru it and append each client's name
for(%i = 1; %i <= $ClientListCount; %i++) {
%current_client_on_list = $ClientList[ %i ];
%current_name = %current_client_on_list.name;
%msg = %msg @ %current_name @ (%i < $ClientListCount ? "; " : "");
}
// Message them our %msg
messageClient(%client, '', '\c3Clients on the list: \c2%1', %msg);
}