AlliedModders

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

kramesa 08-09-2012 23:12

Help with stock
 
Hi all.

This is my code:

Code:
stock print_msg(id, message[], any:...) {     client_print(id, print_chat, "%s %s", prefix, message);         if(id == 0)         server_print("%s %s", prefix, message);             return PLUGIN_HANDLED; }

My problem is: When I put a variable, example:
Code:
print_msg(id, "Your name is: %s", szName);
, only shows Your name is:

Sorry for my bad english!

Thanks.

YamiKaitou 08-09-2012 23:13

Re: Help with stock
 
vformat

Liverwiz 08-09-2012 23:15

Re: Help with stock
 
You need to actually read the paramaters sent in to the any... arguments.
numargs is where you should be looking.
Also read some stock and third party includes that use that functionality as examples. Connor's ColorChat include is a good one.

EDIT: Use that in conjunction with YamiKaitou's post as well. But mostly his.

ConnorMcLeod 08-10-2012 02:13

Re: Help with stock
 
numargs is not needed at all, use only vformat.

If the problem is only with index == 0, and if you want to print in console, use console_print, with index == 0 it doesn't loop through players but prints in server console.


All times are GMT -4. The time now is 05:44.

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