Ok, I'm
gonna show you guys how to print stuff to a client, but before I
start
I would like to thank John
Cook for answering my questions about this tutorial. Thank you
John!.
Ok, the function we need is:
ClientPrint( entvars_t *client, int msg_dest, const char *msg );
This is the only function we need, and now I'm going to
explain you guys how to use it!.
Now, we got 3 parameters to fill, here is what ya need:
The first one (entvars_t *client)
is the client you want to print to.
The second one is where in the player's hud will the message appear,
here are the values:
HUD_PRINTNOTIFY // prints
on the top left of the screen (like the QC function sprint();
HUD_PRINTCONSOLE // prints
directly to the console
HUD_PRINTTALK // prints to
the center bottom of the screen, where the chat text would appear
HUD_PRINTCENTER // prints
to the center of the screen (like the QC function centerprint();
And the last value is the message you want to print.
Example:
ClientPrint(m_pPlayer->pev,
HUD_PRINTCENTER, "Hi, im printing to the center of the screen!\n");
This is pretty cool, cause you only have to change the middle
parameter to change the location of the print!
Also, we can use this function:
UTIL_ClientPrintAll( int msg_dest, const char *msg );
to print to all the clients at the same time, the first
value, is where we want to print the message
and we use the same values as above, the second parameter, is the
message we want to print.
Example:
UTIL_ClientPrintAll(
HUD_PRINTNOTIFY,"Hi all!\n" );
Thats it!, hope this helps some of you guys, as always you
can mail me about
anything
you can't understand! Cya. |