Raised This Month: $ Target: $400
 0% 

[Q] Best practices / Code snippets?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LegacyCode
Member
Join Date: Apr 2017
Old 04-08-2017 , 12:20   [Q] Best practices / Code snippets?
Reply With Quote #1

Hello World,

I used to be a front-end developer and I tried many different languages
and programs (AutoIT, PHP, Python, JavaScript,...), so I'm kinda familiar
with some coding stuff.

I've set up Sublime Text 2 to compile my .sma files easily
(thanks to https://forums.alliedmods.net/showthread.php?t=293376)
and dived into some plugins to look into the code, only to find no comments
for the most part and different takes on certain things,
e.g. hooking SayText to manipulate the chat in certain ways.

Is there some kind of best practices coding snippets database?
Would some of you plugin gods mind to share some of your genius with us?

I hope this isn't too much to ask (and not a duplicate question), but I'm so confused.
I don't want to learn bad habits when coding plugins right off the bat and the API documentation
isn't too helpful sometimes either (https://www.amxmodx.org/api/).

Also it doesn't have to be actual code snippets, although I believe that's what I learn from best.
Looking at existing code I get the grasp of what's happening, but I lack the
details on why and when I should do stuff in certain ways.

- LegacyCode

PS: I'm mainly talking about plugins for CS 1.6, but I would love to see more on this topic obviously

Last edited by LegacyCode; 04-08-2017 at 12:22. Reason: formatting
LegacyCode is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 04-08-2017 , 12:35   Re: [Q] Best practices / Code snippets?
Reply With Quote #2

Everybody wants to learn how to code but no wants to search.

Code Snippets/Tutorials
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
LegacyCode
Member
Join Date: Apr 2017
Old 04-08-2017 , 12:40   Re: [Q] Best practices / Code snippets?
Reply With Quote #3

Quote:
Originally Posted by wickedd View Post
Everybody wants to learn how to code but no wants to search.

Code Snippets/Tutorials
I searched my ass off in this section and everybody has different takes on everything.
I'm talking about best practices, plus most stuff seemed to be outdated to me (as well as many plugins).

Quote:
Originally Posted by HamletEagle View Post
There is no collection of good snippets, just the tutorial section linked above(I would not consider everything from it as good code, though). Ask a concrete question and we will help you to understand, your current post is way too vague.
Yeah kinda thought that would be the case, will do. Thank you!

- LegacyCode

Last edited by LegacyCode; 04-08-2017 at 12:41.
LegacyCode is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-08-2017 , 13:08   Re: [Q] Best practices / Code snippets?
Reply With Quote #4

Quote:
Originally Posted by LegacyCode View Post
I searched my ass off in this section and everybody has different takes on everything.
I'm talking about best practices, plus most stuff seemed to be outdated to me (as well as many plugins).
That's not uncommon among anything that is free and is primarily supported by "the internet" especially for something that is dying. Simply learn by doing and use your own common sense to evaluate trial methodologies. For more complicated code, you might need to learn whose posts are more likely to be more accurate. There is very little if any quality control on the internet in general including here.
__________________
fysiks is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-08-2017 , 12:38   Re: [Q] Best practices / Code snippets?
Reply With Quote #5

There is no collection of good snippets, just the tutorial section linked above(I would not consider everything from it as good code, though). Ask a concrete question and we will help you to understand, your current post is way too vague.
__________________

Last edited by HamletEagle; 04-08-2017 at 12:39.
HamletEagle 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 18:05.


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