Raised This Month: $ Target: $400
 0% 

String in a string


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bibu
Veteran Member
Join Date: Sep 2010
Old 07-27-2011 , 13:49   String in a string
Reply With Quote #1

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?
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 07-27-2011 , 14:29   Re: String in a string
Reply With Quote #2

Quote:
Originally Posted by bibu View Post
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.
joaquimandrade is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 07-27-2011 , 16:00   Re: String in a string
Reply With Quote #3

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.
__________________
Hunter-Digital is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 07-28-2011 , 02:05   Re: String in a string
Reply With Quote #4

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?
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 07-28-2011 , 05:07   Re: String in a string
Reply With Quote #5

You can try this:
Code:
#define NAME "Name: %s" client_print(id, print_chat, NAME, THE_OTHER_STRING)
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-28-2011 , 05:13   Re: String in a string
Reply With Quote #6

Four posts saying the same thing! I think that should get the point accross.
__________________
fysiks is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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