table_command
Indigo/table_command · 852 B
From the archive indigo001.tgz
Download the archive « Back to the archive contents
<?
$command_table = array( "say" => array( "do_say" ),
"who" => array( "do_who" ),
"quit" => array( "do_quit" ),
"chat" => array( "do_chat" ),
"sockets" => array( "do_sockets" ),
"commands" => array( "do_commands" ),
"look" => array( "do_look" ) );
/* returns an array() or nada */
function check_command( $arg )
{
global $command_table;
foreach( $command_table as $command => $command_set )
{
if( ereg( "^$arg", $command ) )
return( $command_set );
}
return(0);
}
function do_commands( $player, $empty )
{
global $command_table;
$x = 0;
foreach( $command_table as $command => $command_set )
{
$x++;
$output .= sprintf( "%18s", $command );
if( $x == 4 )
{
$output .= "\n";
$x = 0;
}
}
$output .= "\n";
send_to_desc( $player->sock_id, $output );
}
?>