03.12.2013, 05:27
It ultimately comes down to YOUR opinion, but here are my preferences:
#1 - In cases like the one you presented, I would go with define because it is a better fit for said example. I typically will only use an enum in that case when I have a list of constants whos values are set in a specific manner (The common ones being: each one is increased by one, or each value is shifted to the left/right (bitwise)).
#2 - I prefer the second one hands down. It just is much cleaner and organized.
#3 - Depends on the function and its usage! This is less a preference and more of a functionality issue. If I know I am going to be using CallRemoteFunction or using this function in a timer, It obviously has to be public; no choice about it. If its just a function that I am planning on releasing/using for one file, then I would chose stock.
#4 - This is also more about functionality, rather then preference, as they are not equal. I would go with the fastest method, which in my scripting days, was YCMD (followed closely by zcmd).
#5 - I would probably just use the macro if I had to pick one instead of just using my player array.
#6 - It depends on the situation. I have a BIG pet peeve when it comes to people over using the triadic operator because they think it makes them seem more knowledgeable, or skilled. If it's a small statement, I understand...but if not, just use a regular if statement (I prefer A btw).
#7 - I will always use a for loop over a while when it comes to iterating a specifically known amount of times. Any smart man would (less chances of mistakenly creating an endless loop).
#8 - It depends on my mood. This is a good preference thing to ask! I usually use b the most.
#9 - Situation. Unless its a straight up ideal situation for switch, I'll go with if instead. That simply comes from other languages though. Pawn has my favorite implementation of the control structure personally (i liked being able to specify constant number ranges).
#10 - (Ignoring that you do not need to fill the array dimensions in this case/have a size issue with the second dimension) The first one is cleaner, and I would definitely go with that if it was a simple script. I like building dynamic scripts that are easy to modify ingame...so I would likely go with something along the lines of the second one if I was building it for personal use.
#11 - I would probably format the players name into my sentence ("%s is a boss"). Not really a practical example in either case tbh.
#12 - I've used a and b (though I always null the string out when using strcat). I think format is more clear tbh, but some people are going to complain about the speed in this thread :P.
#13 - A flat out.
#14 - Oh dear gawd...a...just a...always (with the exception of g_ for globals).
#1 - In cases like the one you presented, I would go with define because it is a better fit for said example. I typically will only use an enum in that case when I have a list of constants whos values are set in a specific manner (The common ones being: each one is increased by one, or each value is shifted to the left/right (bitwise)).
#2 - I prefer the second one hands down. It just is much cleaner and organized.
#3 - Depends on the function and its usage! This is less a preference and more of a functionality issue. If I know I am going to be using CallRemoteFunction or using this function in a timer, It obviously has to be public; no choice about it. If its just a function that I am planning on releasing/using for one file, then I would chose stock.
#4 - This is also more about functionality, rather then preference, as they are not equal. I would go with the fastest method, which in my scripting days, was YCMD (followed closely by zcmd).
#5 - I would probably just use the macro if I had to pick one instead of just using my player array.
#6 - It depends on the situation. I have a BIG pet peeve when it comes to people over using the triadic operator because they think it makes them seem more knowledgeable, or skilled. If it's a small statement, I understand...but if not, just use a regular if statement (I prefer A btw).
#7 - I will always use a for loop over a while when it comes to iterating a specifically known amount of times. Any smart man would (less chances of mistakenly creating an endless loop).
#8 - It depends on my mood. This is a good preference thing to ask! I usually use b the most.
#9 - Situation. Unless its a straight up ideal situation for switch, I'll go with if instead. That simply comes from other languages though. Pawn has my favorite implementation of the control structure personally (i liked being able to specify constant number ranges).
#10 - (Ignoring that you do not need to fill the array dimensions in this case/have a size issue with the second dimension) The first one is cleaner, and I would definitely go with that if it was a simple script. I like building dynamic scripts that are easy to modify ingame...so I would likely go with something along the lines of the second one if I was building it for personal use.
#11 - I would probably format the players name into my sentence ("%s is a boss"). Not really a practical example in either case tbh.
#12 - I've used a and b (though I always null the string out when using strcat). I think format is more clear tbh, but some people are going to complain about the speed in this thread :P.
#13 - A flat out.
#14 - Oh dear gawd...a...just a...always (with the exception of g_ for globals).