Raised This Month: $ Target: $400
 0% 

Language for creating plugins on cs


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 10-30-2015 , 08:48   Re: Language for creating plugins on cs
Reply With Quote #1

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"
redivcram 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:09.


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