Raised This Month: $ Target: $400
 0% 

Which is Better?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AfteR.
Veteran Member
Join Date: Dec 2008
Location: λ
Old 02-08-2010 , 14:55   Which is Better?
Reply With Quote #1

It's simple, but I want to know which way is better:

PHP Code:
public client_putinserverid )
{
    new 
name[32]
    
get_user_name(idnamesizeof(name) - 1)
    
    
client_print(idprint_chat"%s has entered .."name)

or

PHP Code:
public client_putinserverid )
{
    static 
name[32]
    
get_user_name(idnamesizeof(name) - 1)
    
    
client_print(idprint_chat"%s has entered .."name)

In these case, which is better: static or new? (its just an example, it not necesarily has to be the name) and why..
AfteR. is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-08-2010 , 14:59   Re: Which is Better?
Reply With Quote #2

Both are be fine.
FYI, you can't print anything to player at this moment, you have to delay it a bit.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-08-2010 , 15:06   Re: Which is Better?
Reply With Quote #3

Since its such a small string, you will be fine using either. When working with very large strings it is better to use static.
__________________
Bugsy is offline
NiQu
Veteran Member
Join Date: Nov 2009
Old 02-08-2010 , 15:09   Re: Which is Better?
Reply With Quote #4

Personally i would use "new" and not "static", i got no reason why

You have to create a task delay of around 5 seconds or the message wont be printed, or the message will be printed but way to early.(You cant recieve messages before choosing team.).
NiQu is offline
AfteR.
Veteran Member
Join Date: Dec 2008
Location: λ
Old 02-08-2010 , 15:24   Re: Which is Better?
Reply With Quote #5

Hahhaa I forgot to change id to 0
AfteR. 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 07:26.


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