AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Language for creating plugins on cs (https://forums.alliedmods.net/showthread.php?t=273961)

marian1999 10-30-2015 07:19

Language for creating plugins on cs
 
Is true that only Pawn is used for creation of plugins for cs servers?

If yes please explain me from where to start:
-What program is used to write in pawn
-How to test and run "Hello world"


Eventually some book or site for learning how to create plugins, not deprecated from the new standarst :)


I'm using Windows (7) OS


Thank you in advance.

redivcram 10-30-2015 08:48

Re: Language for creating plugins on cs
 
Yes Pawn is the most precise language for GoldSource games' plugins.

Amx Mod X Studio, you can download it from amxmodx.org

It's very easy to learn, you just need to know basic programming and get to know the constants and some ingame logics... or something.

There are a lot of examples for plugins, you can download any plugins' source you want from this site. The extension is .sma, compiled (The one you put in your server's directory is .amxx) Download the .sma's and take a look at them, to see how are those plugins made, what does it contain.

Here's a simple Hello World plugin. This simply prints out a chat message whenever a player types /hello in chat

PHP Code:

#include <amxmodx> // We must include this library everywhere

public plugin_init() // This function is called when the server starts
{
    
register_plugin("Hello World""1.0""redivcram"); // We must register the plugin, there are 3 parameters
    //separated by commas!
    // 1st Parameter - Plugin Name
    // 2nd Parameter - Version
    // 3rd Parameter - Author of the plugin
    
    
register_clcmd("say /hello""cmd_hello"); // We register a command to call the function that prints out the msg
    // 1st Parameter - Command
    // 2nd Parameter - Function called by the command
}

public 
cmd_hello(id// This is the function that is called when a player types /hello in chat
{
    
client_print(idprint_chat"[AMXX] Hello World!!!"); // This prints out the message
    // 1st Parameter - Index (If set to "id". the msg will print out to the player who typed /hello
    // If set to "0", the msg will print out to everyone online
    // 2nd Parameter - Message type (print_chat - print in chat | print_console - in console | print_center - like terrorists win)
    // 3rd Parameter - The message (Make sure the message you want to print out is quoted!!


To compile it, You can do it with your local compiler, but I use a web compiler, you can search or here's this one. It's on polish language, but I can understand few things.
http://amxx.pl/kompilator/

Upload your .sma, or paste the code, then click "Kompiluj"
If it compiles without errors, you can download it by clicking "POBIERZ"

Arkshine 10-30-2015 09:03

Re: Language for creating plugins on cs
 
Any text editor is fine.
Check the tutorial section.

CrazY. 10-31-2015 10:03

Re: Language for creating plugins on cs
 
I use the Sublime Text, simple and easy interface to handle, each with their preference.


All times are GMT -4. The time now is 18:09.

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