Raised This Month: $ Target: $400
 0% 

Few Questions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Drak
Veteran Member
Join Date: Jul 2005
Old 11-20-2006 , 19:34   Few Questions
Reply With Quote #1

Just some simple questions, what would be better in the functions? (Performance wise)
Code:
new name[33] client_print(id,print_chat,"Name: %s",get_user_name(id,name,32))
Or
Code:
new name[33] get_user_name(id,name,32) client_print(id,print_chat,"Name: %s",name)
Or would they both be the same?

Also, are 'enums' just like defines, but in a struct like form?
Code:
enum {      ONE = 1      TWO = 2      THREE = 3 }
Code:
#define ONE 1 #define TWO 2 #define THREE 3
Would this be the same?
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 11-20-2006 , 20:18   Re: Few Questions
Reply With Quote #2

Quote:
Originally Posted by SixTwin View Post
Just some simple questions, what would be better in the functions? (Performance wise)
Code:
new name[33] client_print(id,print_chat,"Name: %s",get_user_name(id,name,32))
Or
Code:
new name[33] get_user_name(id,name,32) client_print(id,print_chat,"Name: %s",name)
Or would they both be the same?
You can't do the first one so your question is invalid.
__________________
Brad is offline
Old 11-20-2006, 20:23
The Specialist
This message has been deleted by The Specialist.
jim_yang
Veteran Member
Join Date: Aug 2006
Old 11-20-2006 , 22:23   Re: Few Questions
Reply With Quote #3

enum CsTeams {
CS_TEAM_UNASSIGNED = 0,
CS_TEAM_T = 1,
CS_TEAM_CT = 2,
CS_TEAM_SPECTATOR = 3
};
so when you declare a new var using enum, e.g. new CsTeams:team
so the possible value of team is only 0/1/2/3.
#define is a preprocessor directive, just place a symbol with its defined value when compile.
so new team; the value of team could be any int value in its range.
bad english sry.
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
Drak
Veteran Member
Join Date: Jul 2005
Old 11-20-2006 , 22:44   Re: Few Questions
Reply With Quote #4

Okay, and just one more question. When i see stuff like
Code:
new something = (1<<2||1<<3)
and so on. What does "<<" mean?
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
jim_yang
Veteran Member
Join Date: Aug 2006
Old 11-20-2006 , 22:54   Re: Few Questions
Reply With Quote #5

my english is really bad to explain that. hope you can understand
3 decimal = 00000011 binary
5 decimal = 00000101 binary

& | ~ << >> these are bit operator.

so 3&5 means
00000011
00000101
result:
00000001

<< means bit left move
1 decimal = 00000001 binary
1<<1 means 1 left move 1 bit result: 00000010 binary = 2 decimal
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
dutchmeat
Senior Member
Join Date: Sep 2006
Old 11-21-2006 , 04:43   Re: Few Questions
Reply With Quote #6

here's how decimal versus binary works:
if your decimal would be 32 it is:
Code:
binary(scale):           1 2 4 8 16 32 64 128 256 512 1024
binary:                  0 0 0 0  0  1
so when your decimal is 52
your binary is:
Code:
binary(scale):           1 2 4 8 16 32 64 128 256 512 1024
binary:                  0 0 1 0  1  1
4 + 16 = 20 + 32 = 52.
Some relative information just finished this study last year.
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.
dutchmeat 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 07:01.


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