Raised This Month: $23 Target: $400
 5% 

Pawn Picture Tutorial


Post New Thread Reply   
 
Thread Tools Display Modes
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 06-10-2009 , 15:50   Re: Pawn Picture Tutorial
Reply With Quote #11

Lol. I love it.
__________________
joaquimandrade is offline
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 06-10-2009 , 15:52   Re: Pawn Picture Tutorial
Reply With Quote #12

Wow Exelent Tutorial
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-10-2009 , 18:21   Re: Pawn Picture Tutorial
Reply With Quote #13

Very nice.
__________________
fysiks is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 06-11-2009 , 07:02   Re: Pawn Picture Tutorial
Reply With Quote #14

Quote:
Originally Posted by Alka View Post
I must start learning pawn >.<
Don't even bother. It's useless.
__________________
hleV is offline
supergreg
Senior Member
Join Date: Jul 2007
Location: Oslo, Norway
Old 06-11-2009 , 18:56   Re: Pawn Picture Tutorial
Reply With Quote #15

Totally read my mind (and predicted my request). Not only the topics I wanted, but visually+metaphorically as I was hoping for. Awesome. 20 cans of anchovies for you and your avatar, Emp.
supergreg is offline
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
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-13-2009 , 02:06   Re: Pawn Picture Tutorial
Reply With Quote #17

Quote:
Originally Posted by Hawk552 View Post
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.
It seems to me that this is just a readability issue. Is there some other reason that I can't think of.
__________________
fysiks is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 06-13-2009 , 11:00   Re: Pawn Picture Tutorial
Reply With Quote #18

This is fucking hilarious. Awesome work, Emp!
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 06-13-2009 , 12:11   Re: Pawn Picture Tutorial
Reply With Quote #19

Quote:
Originally Posted by fysiks View Post
It seems to me that this is just a readability issue. Is there some other reason that I can't think of.
If other languages use a different character for their null terminator or it ever changes, then you will be left out in the dirt if you used 0. It's just better practice. We should use '^0' for the same reason we name constants.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-13-2009 , 13:07   Re: Pawn Picture Tutorial
Reply With Quote #20

Quote:
Originally Posted by Hawk552 View Post
If other languages use a different character for their null terminator or it ever changes, then you will be left out in the dirt if you used 0. It's just better practice. We should use '^0' for the same reason we name constants.
Oh, thanks, that makes sense .
__________________
fysiks is offline
Reply


Thread Tools
Display Modes

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 22:00.


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