View Single Post
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 06-13-2009 , 01:39   Re: Pawn Picture Tutorial
Reply With Quote #16

Good overall, but I have a few comments:

Quote:
Another variable type is called a Boolean or Bool for short.
To create a bool variable we use:
Code:
new bool:variable_name


Bool variables can only be two values, true or false. Nothing else.
This is incorrect. Pawn bools can store other values as can Floats. The tags are just that, tags. I don't believe in the idea of misleading beginners to make things more simple to understand. I think you should explain this properly.

Quote:
Code:
Name[7] = 0
This is bad practice and you should avoid it not only in Pawn but also in other languages. It is always better to use the proper escape character. In this case, it is '^0', which the ASCII code for is 0. This will also give you an excuse to talk about escape characters, which you did not cover.

Quote:
And some functions do not return anything:
Pawn functions always return something. Even if no return is explicitly stated in a function, it will return 0.

Quote:
PLUGIN_HANDLED says to stop the information from being sent anywhere else. It will stop it from going to other plugins and stop it from going to the server.
There's no real problem here. I would just suggest that you say that some forwards will ignore their return value (i.e. plugin_init()).

Quote:
Almost every plugin will contain: #include <amxmodx> as it has the basic natives for creating a plugin.
The amxmodx include file also contains the forwards plugin_init and plugin_precache.
Functions which have multiforwards hooked to them get called whether or not they are declared as forwards. The only real purpose of forwards is for documentation. There may be something else I don't know about, though.

Quote:
Code:
new gVariable_Name
Terrible variable naming. Please do not encourage people to write code like this.

Quote:
precache_sound("sound_name.wav")
// Note that sounds can have most of the regular types of extensions but try to stick to .mp3 and .wav
I'm very uncertain about both this and my following comment. I'm pretty sure that mp3s have to be precached using precache_generic(). I'm also pretty sure that only wav files can be precached using precache_sound(). I could be wrong, though. Don't hold me to that. I just suggest you look into it.

Quote:
Code:
	default:{
		//if variable is not any of the preceding cases execute this code
	}
You should clarify that a default case is not required.

Quote:
Code:
if( variable )
	//this is the only part within the if statement
	//this is not within the if statement
This is completely wrong. The compiler ignores lines while parsing this. For example, this would compile fine and in the way you would intend it to:

Code:
if ( condition )
    // pants
    // pants
    pants()
    // pants
I covered this topic in my Code Styling article under the "Code Blocks" section.

Quote:
Code:
if( variable ){
This is a terrible style as well and you should not be encouraging people to use it. If you have to, for some God-forsaken reason, leave your curly braces on the same line as the opening statement, at least add a space between them.

Quote:
//If you find yourself adding or subtracting one, you can use this shortcut
variable++ //this increases by one
variable-- //this decreases by one
You should clarify the difference between pre/post incrementing/decrementing.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552