First, here's your function you'll want to call
Code:
void Cmd_announce_f( gentity_t *ent )
{
char p[1024];//This buffer will fit ~1024 characters
if ( trap_Argc () < 2 )
{//if there are less than 2 args print help (the actual command counts as an arg)
trap_SendServerCommand( ent-g_entities, va( "print \"^5Command Usage: ^7announce <message> ^3Prints a message to every client\n\"" ) );
return; //if there are less than 2 args print help (the actual command counts as an arg)
}
strcpy(p, ConcatArgs(1)); //Grab the second arg and put it in our buffer (the actual command counts as an arg)
//TODO: insert line-feed handling stuff here
G_LogPrintf( "announce: %s: %s\n", ent->client->pers.netname, p ); //log the action in the server console
trap_SendServerCommand( -1, va("cp \"%s\"", p) ); //print it on-screen
return;
}
Then chuck in this code in the ClientCommand function appropriately
Code:
else if (!Q_stricmp(cmd, "announce"))
{
Cmd_announce_f(ent);
return;
}
I haven't implemented handling line feeds into that yet, so if you want that you'll have to do it yourself I'm afraid. (A line feed goes to the next line by using '\n')
Sorry for not understanding earlier, I hadn't poked around 'arbitraryprint' in a while and thought it automatically did this =P
Feel free to use this code. I'm not gonna ask for money
