Raised This Month: $12 Target: $400
 3% 

Learning AMXX scripting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GlobalPlague
Senior Member
Join Date: Feb 2016
Location: Pluto
Old 09-16-2021 , 11:43   Learning AMXX scripting
Reply With Quote #1

Hello. I play Counter-Strike for more than 11 years, i like the game, and i have servers for more than 6 years.

When i started making servers, i used already existing plugins, and later i learned how to make minor changes to the plugins i use. The problem is that i have my own unique ideas about plugins, but i also don't know how to create AMXX plugins from scratch.

When i download an AMXX plugin and look at the code, i understand some of the code, but not everything. There are functions and words i don't understand. My understanding on Pawn is not good enough to allow me to make complex codes for Zombie Mod servers.

I have never worked with Java, C++ or any other programming language. Many people told me that i need to learn Java and C++ before i can understand Pawn. But, i dont want to learn other programming language. I want to learn only Pawn, because i want to make AMXX plugins only, and i dont need to write codes for other applications that require Java or C++.

I want to have better understanding on Pawn, so i can write my own plugins. I want to know how to start making a plugin and what codes to write at the beginning of the code. Yes, i know how to add "Inc" and how to register the plugin, but i dont know how to do complex codes, such as making zombie Classes with abilities. I know how to create a plugin that creates new zombie Classes, but i dont know how to add abilities to the zombie classes, such as smoker (drag), regeneration, invisibility, flying, and other abilities such as releasing fire balls and poisonous smokes when the player presses "G", for example. Yes, most of these zombie class abilities already exist, but i just use them as an example to show you what type of codes i want to write.

So, you already know what type of AMXX knowledge i need. Can you show me tutorials that are designed for beginners who don't understand Pawn? I really, really want to learn Pawn, but i find it very hard. I dont even know what "forward", "return PLUGIN_HANDLED", "new const", "cmd", "register_concmd", etc..., mean.
GlobalPlague is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-16-2021 , 14:17   Re: Learning AMXX scripting
Reply With Quote #2

Having prior programming experience is helpful, but telling a complete beginner who is only interested in amxx scripting to go learn java and c++ before learning pawn is stupid, terrible advice.

Pawn is extremely simple and you don't need to know much more than declaring variables and functions to be able to write plugins. Then, you just need to be familiar with the AMXX API and have the proper mindset about coding.

A good place to start is this topic, where you have a list of tutorials: https://forums.alliedmods.net/showth...awnProgramming

Start with the basic tutorials about pawn programming. I also suggest you read this:
https://wiki.alliedmods.net/Intro_to...od_X_Scripting and
https://wiki.alliedmods.net/Advanced...ng_(AMX_Mod_X)

Also bookmark this: http://amxmodx.org/api/
Here you can search functions and see what they do, functions like "register_concmd" for example.

Then, it is a matter of figuring something you want to do(something simple, don't start with anything too crazy), think about it for a while and SEARCH SEARCH SEARCH. Searching is the most important skill that you need to master. This forum has examples for almost anything you may want to do and searching in scripting help will often give you the answer you need.

For example, let's say you want to create a plugin that turns the player invisible when he isn't moving. You need to break this idea into parts that you will research/implement individually.
It's fairly obvious that you have 2 tasks:
-figuring out how to turn a player invisible
-figuring out how to detect when a player is not moving

Then, after you know how to do each of these 2 things, you can create the plugin. I would start by searching alliedmodders for "how to make a player invisible" and test this part alone. Maybe make a command that will turn you invisible, just to confirm that the code you found works.
Then search how to detect when a player is not moving, test this part separately to make sure it works - maybe print a message when you stop moving.
Then merge them together and create your plugin.

Do not blindly copy paste code: search, find some code, take it and then try to understand it. Search the functions inside amxx API site I linked, search the forums for more information about particular functions or things you do not understand. Also, get in the habit of debugging your code: test, add messages, see what your code is doing and compare that to what you want it to do. Then you will know where the problem is and how to fix it.

What I said may look like really high-level advice or nothing concrete, but that's how you learn. There is no magical tutorial that will teach you to code in one hour. Learning what functions do is important, but having the proper mindset and knowing how to approach a coding task is way more important. In the beginning, everything will be confusing but push thru it. In no time things will start making sense, but you have to invest time and take responsibility for your learning.
__________________

Last edited by HamletEagle; 09-16-2021 at 14:20.
HamletEagle is offline
rtxa
Senior Member
Join Date: Mar 2018
Location: Argentina
Old 09-16-2021 , 17:01   Re: Learning AMXX scripting
Reply With Quote #3

Yeah, you don't need to learn others language like C and Java to learn Pawn because I also started without knowing any language, but of course C (mostly) and Java will enforce what you are learning. Besides, Pawn is very simple and you can start very easily to make your first plugins. The first plugin I made was a Zombie Mod for Half-Life and it took me some months because I had to read a lot, a lot of tutorials in the Wiki, in the forums, searching for help in the forums, mostly there are solutions for everything in the forum.
__________________
rtxa is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-16-2021 , 21:24   Re: Learning AMXX scripting
Reply With Quote #4

It's definitely going to take a little time, but if you put the time in to learn the basic principles, everything starts to make sense. For example, when you learn that you can code things to happen based on events happening in the game, this opens the first door to your idea. So if you want something to happen when a player first becomes alive, find out how to hook spawn.. similar for death, taking damage, dying, jumping, bomb picked up, spent money, touch or see another player, etc, etc.. Door # 2 is figuring out how to code the stuff you want to happen at that event.

I'd do what HamletEagle said. AMX-X is still very much alive and these forums are very active. There is ~20 years worth of random plugins and/or code that members have posted. You can literally find an example for almost anything. If you can't find it, search harder because it's there. And many of us regulars are always here to answer questions.

Bookmark these as they will be very helpful. I am ~17 years into AMX-X scripting and still keep these on my bookmarks bar in chrome and use them both relatively frequently:

If you want to find what a native does and what its parameters are. You can also browse through each module using the left navbar:
http://www.amxmodx.org/api/

This has all of the game events that you can hook. You are not limited to hooking these events as there are other ways to hook things:
https://wiki.alliedmods.net/Half-life_1_game_events
__________________

Last edited by Bugsy; 09-16-2021 at 21:30.
Bugsy is offline
robomarkets01
New Member
Join Date: Sep 2021
Location: Limassol, Cyprus
Old 09-17-2021 , 08:57   Re: Learning AMXX scripting
Reply With Quote #5

robomarkets01 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 03:39.


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