Raised This Month: $ Target: $400
 0% 

Important question: How can newbies learn SourcePawn?


Post New Thread Reply   
 
Thread Tools Display Modes
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 04-05-2023 , 17:31   Re: Important question: How can newbies learn SourcePawn?
Reply With Quote #11

"l4d1 events" comes up with the correct page as the first result.

Searching for specific things in quotes or putting "site:forums.alliedmods.net" to search for results only from here.

Less words, more keywords. Once you know those pages, bookmark them.

Another useful site is Valve Developer to reference and find out stuff about various entities, how maps work, VScripts etc.

It would also be wise to run the sm_dump* commands to find out various netprops/datamaps entities have. Use various Dev tools plugins to make plugin writing easier. All this stuff is listed in the TUT thread I wrote.

Many things are transferable between L4D1 and L4D2, the things that are not are the new additions to L4D2 (new infected, new models/sounds, VScripts, etc). Some things will behave differently as they were updated or changed in L4D2. That's something you have to figure out testing or comparing with both games.

The plugin you linked is specifically for L4D2 because its either not possible in L4D1 or maybe the author doesn't have the game or just didn't want to find the offsets. It's patching the games memory using Source Scramble, this is more advanced stuff so you would be jumping in the deep end trying to modify that for L4D1.

I got into SM by viewing other plugins and reading through the wiki pages several times for years after I started and viewing more details about certain functions/natives in the API or include files themselves. I began by modifying existing plugins, simple things at first and more complex stuff later on, and then writing simple plugins by looking through similar plugins or searching AM forums for snippets. From that expanding the scope of knowledge by trying new things, using things I've not used before or doing things no one else has done, that's what I find fun.

There is enough information to learn and get by, you have to put the time into reading through stuff, learning from examples and testing things, lots of debug printing to see the flow of forwards being called, or where things are triggered, if the values you're expecting are actually those values etc.

Eventually you'll know all the basics and have an understanding of the language, then you can move onto more advanced stuff like SDKCalls, detours or memory patching, which opens up a whole world of possibilities.

I would suggest viewing through my plugins and those from other established scripters within L4D1/2. A lot of mine have comments about why something is done the way it is, or bugs encountered that resulted in the methods used. If you want, PM me. I can send an archive with all my scripts that you could use to search through for keywords. I also found that helpful when I started, downloading lots of plugins and then searching through those scripts for keywords on stuff I was trying to do.

Good luck.
__________________
Silvers is offline
TotalChaos SourcePawner
Senior Member
Join Date: Feb 2023
Location: IN PINEAPPLE, UNDER SEA
Old 04-05-2023 , 18:36   Re: Important question: How can newbies learn SourcePawn?
Reply With Quote #12

Quote:
Originally Posted by Silvers View Post
"l4d1 events" comes up with the correct page as the first result.

Searching for specific things in quotes or putting "site:forums.alliedmods.net" to search for results only from here.

Less words, more keywords. Once you know those pages, bookmark them.

Another useful site is Valve Developer to reference and find out stuff about various entities, how maps work, VScripts etc.

It would also be wise to run the sm_dump* commands to find out various netprops/datamaps entities have. Use various Dev tools plugins to make plugin writing easier. All this stuff is listed in the TUT thread I wrote.

Many things are transferable between L4D1 and L4D2, the things that are not are the new additions to L4D2 (new infected, new models/sounds, VScripts, etc). Some things will behave differently as they were updated or changed in L4D2. That's something you have to figure out testing or comparing with both games.

The plugin you linked is specifically for L4D2 because its either not possible in L4D1 or maybe the author doesn't have the game or just didn't want to find the offsets. It's patching the games memory using Source Scramble, this is more advanced stuff so you would be jumping in the deep end trying to modify that for L4D1.

I got into SM by viewing other plugins and reading through the wiki pages several times for years after I started and viewing more details about certain functions/natives in the API or include files themselves. I began by modifying existing plugins, simple things at first and more complex stuff later on, and then writing simple plugins by looking through similar plugins or searching AM forums for snippets. From that expanding the scope of knowledge by trying new things, using things I've not used before or doing things no one else has done, that's what I find fun.

There is enough information to learn and get by, you have to put the time into reading through stuff, learning from examples and testing things, lots of debug printing to see the flow of forwards being called, or where things are triggered, if the values you're expecting are actually those values etc.

Eventually you'll know all the basics and have an understanding of the language, then you can move onto more advanced stuff like SDKCalls, detours or memory patching, which opens up a whole world of possibilities.

I would suggest viewing through my plugins and those from other established scripters within L4D1/2. A lot of mine have comments about why something is done the way it is, or bugs encountered that resulted in the methods used. If you want, PM me. I can send an archive with all my scripts that you could use to search through for keywords. I also found that helpful when I started, downloading lots of plugins and then searching through those scripts for keywords on stuff I was trying to do.

Good luck.
Thank you, Silvers.
I will keep all this in mind next time I try to create a plugin.
Also, I feel kinda stupid that I didn't think to search "l4d1 events".
But I also kinda thought that would give me other kinds of events, not things to hook into.



Clearly I have no idea how to use Google...
TotalChaos SourcePawner is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 04-17-2023 , 16:57   Re: Important question: How can newbies learn SourcePawn?
Reply With Quote #13

@TotalChaos SourcePawner, it was easy to find l4d1 event having l4d2 page opened, see: https://imgur.com/a/CND1rtR, which open events for all games.

As about error "wrong prototype", you just need to know what is "prototype", then the only resource you need, is SourceMod API, which is the only page I have bookmarked/always opened + events page. Then, just find required function and compare its members/types with the code you written.

Alternative is: install convenient IDE, like BasicPawn, allowing to show you IntelliSense tips / prototypes and function description instantly while you're writing the code.

I almost didn't need any knowledge when I modified first SM plugin. You just change something, add logging as much as possible, and see what's happen when you replace the plugin on server. And this "replace" thing was the only annoying, because during development you perhaps want to replace plugin 100+ times, and it's not a joke.

You just need to figure out once which convenient tools you want to use to make your development as easy as possible. For me, the minimum is:
[DEV] Autoreload plugins
[tweak] Compile plugins by double click
[batch] sm plugins ftp (sftp) uploader

The second most hard task for me was to figure out how all those SM internal forwards work, like "OnPluginStart". When I should use "OnClientPutInServer", and when "OnClientConnected". What's the difference, what is the execution sequence. And that's the really one of basic thing you must learn and good understand.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
TotalChaos SourcePawner
Senior Member
Join Date: Feb 2023
Location: IN PINEAPPLE, UNDER SEA
Old 04-17-2023 , 18:20   Re: Important question: How can newbies learn SourcePawn?
Reply With Quote #14

Quote:
Originally Posted by Dragokas View Post
@TotalChaos SourcePawner, it was easy to find l4d1 event having l4d2 page opened, see: https://imgur.com/a/CND1rtR, which open events for all games.

As about error "wrong prototype", you just need to know what is "prototype", then the only resource you need, is SourceMod API, which is the only page I have bookmarked/always opened + events page. Then, just find required function and compare its members/types with the code you written.

Alternative is: install convenient IDE, like BasicPawn, allowing to show you IntelliSense tips / prototypes and function description instantly while you're writing the code.

I almost didn't need any knowledge when I modified first SM plugin. You just change something, add logging as much as possible, and see what's happen when you replace the plugin on server. And this "replace" thing was the only annoying, because during development you perhaps want to replace plugin 100+ times, and it's not a joke.

You just need to figure out once which convenient tools you want to use to make your development as easy as possible. For me, the minimum is:
[DEV] Autoreload plugins
[tweak] Compile plugins by double click
[batch] sm plugins ftp (sftp) uploader

The second most hard task for me was to figure out how all those SM internal forwards work, like "OnPluginStart". When I should use "OnClientPutInServer", and when "OnClientConnected". What's the difference, what is the execution sequence. And that's the really one of basic thing you must learn and good understand.
Thanks Dragokas.
I'll see if I can switch over to using BasicPawn (before I used Notepad++).
I don't really see the point of some of the extra stuff you listed for BasicPawn, though. So I don't think I'll be installing any of that.

And I know how to find the L4D1 events page easily.
One way I would do it is go to the L4D2 events page and change the URL to the L4D1 page (removing the "2" and an underscore).
I just hate how Google thinks, is all. It doesn't make any sense to me.


As somebody suggested before, I will be taking some beginner coding classes for a few different languages eventually.
Hopefully that helps a bit.
TotalChaos SourcePawner 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 10:45.


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