22.01.2011, 14:14
ima answer this quickly before i go to bed (excuse any typos).
1). A function call isnt that bad, you should just avoid unneeded calls when you can (why call something multiple times when you dont have to after all). Functions are useful when a bit of code is called a lot, and is pretty big in size. Instead of copying and pasting a ton of code that clutters your script, you just call a function.
2). It depends on what the use of the variable is, generally if something isnt global you shouldnt declare it as such (scope CAN be very important, sometimes you dont want a part of the script to have access to a var). There is no speed difference (even if there was, it would be very insignificant). If the question is asking if you should declare all vars as global and reuse them, you can as long as you are careful (pawn is single threaded, so it can only do one thing at a time, but you still have to watch out for variables getting modded when you dont want them to be). Memory isnt really a big deal in this day and age, so dont be affraid of tmp or local variables (speed is what matters here). I personaly use 2 global strings (with huge sizes for general purpose things like queries) you can do that too just make sure you null them when you need to.
3). glad its solved.
4). Its because your using variables that come out of now where at all, you need to be using the params you put (%0,%1,%2, and %3). Also dont end macro's with a semicolon, or the usage will be funny (ie: AdminLog(...) with no semicolon).
5). Dont get this question really. String size doesnt matter at all, just make sure you have room for the information you are storing AND one extra space for the terminating NULL character (\0). Otherwise when the NULL character is appending, it will be out of the arrays boundaries.
6). You said 5 was the last question, liez!!! lol, it really depends on preference. I tend to just use if/else block statements as apposed to single lined statements, else if, etc etc.
Edit:
Just saw the last line of #6, and thats not true. The code will run fine (excluding your syntax errors, and just judging the structure), if it the sscanf statement returns true (this means the parse failed) it will return control back to the program, if not it will simply continue to your SendFormattedTextToAll function and then return once again.
1). A function call isnt that bad, you should just avoid unneeded calls when you can (why call something multiple times when you dont have to after all). Functions are useful when a bit of code is called a lot, and is pretty big in size. Instead of copying and pasting a ton of code that clutters your script, you just call a function.
2). It depends on what the use of the variable is, generally if something isnt global you shouldnt declare it as such (scope CAN be very important, sometimes you dont want a part of the script to have access to a var). There is no speed difference (even if there was, it would be very insignificant). If the question is asking if you should declare all vars as global and reuse them, you can as long as you are careful (pawn is single threaded, so it can only do one thing at a time, but you still have to watch out for variables getting modded when you dont want them to be). Memory isnt really a big deal in this day and age, so dont be affraid of tmp or local variables (speed is what matters here). I personaly use 2 global strings (with huge sizes for general purpose things like queries) you can do that too just make sure you null them when you need to.
3). glad its solved.
4). Its because your using variables that come out of now where at all, you need to be using the params you put (%0,%1,%2, and %3). Also dont end macro's with a semicolon, or the usage will be funny (ie: AdminLog(...) with no semicolon).
5). Dont get this question really. String size doesnt matter at all, just make sure you have room for the information you are storing AND one extra space for the terminating NULL character (\0). Otherwise when the NULL character is appending, it will be out of the arrays boundaries.
6). You said 5 was the last question, liez!!! lol, it really depends on preference. I tend to just use if/else block statements as apposed to single lined statements, else if, etc etc.
Edit:
Just saw the last line of #6, and thats not true. The code will run fine (excluding your syntax errors, and just judging the structure), if it the sscanf statement returns true (this means the parse failed) it will return control back to the program, if not it will simply continue to your SendFormattedTextToAll function and then return once again.