Raised This Month: $ Target: $400
 0% 

client_print and format


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
]FUSION[ Gray Death
Member
Join Date: Mar 2004
Location: Hamburg / Germany
Old 04-03-2004 , 07:02   client_print and format
Reply With Quote #1

Hi,

I often (like in PTB Team-Plugin e.g.) see code like this

Quote:
format(text, 255, "PTB: %s, some funny text.", name)
client_print(id,print_chat,text)
and asks myself again and again, why not simply use:

Quote:
client_print(id,print_chat,"PTB: %s, some funny text.", name)
Is this from some older AMX Versions, where client_print wasn't allowed to use variables or is there really some good reason for?

Thx in advance,
Gray
]FUSION[ Gray Death is offline
CheesyPeteza
Senior Member
Join Date: Feb 2004
Location: UK
Old 04-03-2004 , 11:55  
Reply With Quote #2

It was all ported from adminmod, plus he wrote it to be easy to change and easy to read.

If he had wanted to he could easily have added the option to display that text as a hud message without having to rewrite his code. (Actually didn't it do that?)

So if you create your own function like this:

show_message(message[]) {
client_print(0, print_chat, message)
}

Then use show_message(mymessage) throughout your program. If you decide in the next version of your program to only show messages to certain people, or perhaps to show it as a hud message. You don't have to go through your whole program changing every client_print to what it is you want. You just have to change it once in that function.

Well thats what I think he was doing anyway.
__________________
YO|Cheesy Peteza

[email protected]

CheesyPeteza 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 05:28.


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