AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   String in a string (https://forums.alliedmods.net/showthread.php?t=163179)

bibu 07-27-2011 13:49

String in a string
 
PHP Code:

#define NAME "Name: %s"

client_print(idprint_chat"%s"NAMETHE_OTHER_STRING

This simply shows me Name: %s. How can I do something like this?

joaquimandrade 07-27-2011 14:29

Re: String in a string
 
Quote:

Originally Posted by bibu (Post 1519779)
PHP Code:

#define NAME "Name: %s"

client_print(idprint_chat"%s"NAMETHE_OTHER_STRING

This simply shows me Name: %s. How can I do something like this?

remove the

Code:

, "%s"
part.

Hunter-Digital 07-27-2011 16:00

Re: String in a string
 
You can use the define to specify the format style:

Code:

#define FORMAT "Whatever %s you %d want %.1f"

//...

client_print(id, print_chat, FORMAT, szString, iNumber, fFloat)

Or explain better what you're trying to do.

hornet 07-28-2011 02:05

Re: String in a string
 
NAME isn't formatted to anything, so it will just show show Name: %s . As joa said, remove your 3rd argument "%s" . And then assuming that THE_OTHER_STRING contains the name your inserting?

abdul-rehman 07-28-2011 05:07

Re: String in a string
 
You can try this:
Code:
#define NAME "Name: %s" client_print(id, print_chat, NAME, THE_OTHER_STRING)

fysiks 07-28-2011 05:13

Re: String in a string
 
Four posts saying the same thing! I think that should get the point accross.


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

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