Raised This Month: $ Target: $400
 0% 

Re-using Variables


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Drak
Veteran Member
Join Date: Jul 2005
Old 02-18-2009 , 13:15   Re-using Variables
Reply With Quote #1

If I did something like this. In this order.
Code:
new Temp[33]        get_user_name(id,Temp,32); client_print(id,print_chat,"Your name is: %s",Temp);         get_user_name(SomeOtherID,Temp,32); client_print(id,print_chat,"Your name is: %s",Temp);

Is there any chance that it could display the same name twice?
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-18-2009 , 13:22   Re: Re-using Variables
Reply With Quote #2

No, it won't happen.
Arkshine is offline
Drak
Veteran Member
Join Date: Jul 2005
Old 02-18-2009 , 13:25   Re: Re-using Variables
Reply With Quote #3

Thank you.
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 02-18-2009 , 13:28   Re: Re-using Variables
Reply With Quote #4

Having said that, "temp" is a TERRIBLE name for a variable. I'm hoping it was just a poor choice of random variable name to be used in the example. Variable names should always describe the type of data it holds.
__________________
Brad is offline
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 02-18-2009 , 17:01   Re: Re-using Variables
Reply With Quote #5

I second that Brad, or you'll end up with something like The Specialists.
BOYSplayCS is offline
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 02-18-2009 , 17:02   Re: Re-using Variables
Reply With Quote #6

Oh, I have another question, sorry for the double-post.

Is the reason it doesn't work because you can only use ONE VARIABLE NAME in one function?
BOYSplayCS is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-18-2009 , 18:02   Re: Re-using Variables
Reply With Quote #7

Not sure to fully understand what's your problem exactly.
Arkshine is offline
Reply



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 16:53.


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