AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   client_print (https://forums.alliedmods.net/showthread.php?t=143661)

ProIcons 11-22-2010 15:51

client_print
 
PHP Code:

msg(word[])
{
    
client_print(0print_chat,"[Network] %s",word);
    return 
PLUGIN_CONTINUE



PHP Code:

if (equali(players,"2"))
          {
              
client_print(0print_chat,"[Network] Team Alpha: %s ^n[Network] Team Beta %s"player[1], player[2]);
          }
          else if (
equali(players,"4"))
          {
              
client_print(0print_chat,"[Network] Team Alpha: %s - %s ^n[Network] Team Beta %s - %s"player[1], player[2], player[3], player[4]);
          } 

Well i want the message function to can get all the values in the format

PHP Code:

msg("Team Alpha: %s - %s ^n[Network] Team Beta %s - %s",value1,value2,value3,value4); 

And generaly all the values that i will set, is it possible?

hleV 11-22-2010 16:18

Re: client_print
 
Code:
msg(word[], any:...) {         new text[128];         vformat(text, charsmax(text), word, 2);           client_print(0, print_chat, "[Network] %s", text); }

ProIcons 11-22-2010 17:06

Re: client_print
 
just any?:P

any:...

Exolent[jNr] 11-22-2010 21:52

Re: client_print
 
Quote:

Originally Posted by ProIcons (Post 1354726)
just any?:P

any:...

That means extra arguments are not limited to a specific tag.
If "..." was only put there, compiler wouldn't let Float (for example) to be passed.

Example:
Code:
#include < amxmodx > public plugin_init( ) {     new Float:flValue;     test( "%f", flValue ); } test( format[], ... ) {     new message[ 192 ]     vformat( message, 191, format, 2 )         server_print( "%s", message ) }
That would give a tag mismatch error.
Code:
#include < amxmodx > public plugin_init( ) {     new Float:flValue;     test( "%f", flValue ); } test( format[], {Float,_}:... ) {     new message[ 192 ]     vformat( message, 191, format, 2 )         server_print( "%s", message ) }
That allows Floats and untagged variables to be passed.
Code:
#include < amxmodx > public plugin_init( ) {     new Float:flValue;     test( "%f", flValue ); } test( format[], any:... ) {     new message[ 192 ]     vformat( message, 191, format, 2 )         server_print( "%s", message ) }
That allows variables of all tags to be passed.


All times are GMT -4. The time now is 11:26.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.