Welcome to The Forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads

  • entry
    1
  • comments
    0
  • views
    9738

Sourcemod Scripting tutorial [part #1]


Priceless

2127 views

 Share

Hello' date=' I will show the basics of sourcemod scripting in this tutorial.

 

I will post more tutorials, I need to start somewhere.

 

example : #include

 

Includes the file located in sourcemod/scripting/include sourcemod.inc file. (You can download sourcemod from sourcemod.net to see what the file includes).

 

okay, here's an basic example how to make a plugin and make it personal (includes : author, version, plugin-name, url to your website and stuff like this).

 

#define (example : #define PLUGIN_VERSION "1.0" then you can use this in a ConVar you will make for this plugin and stuff like this, coming back to this later in the tutorials)

 

Let's start the code.

 

// <-- means that you can type any information for them who reads the script, etc what the function does or something like that.
/* if you need multiply lines do
like
this
*/

#include 

#define PLUGIN_VERSION "1.0"

public Plugin:myinfo =
{
	name = "name of your plugin",
	author = "You",
	description = "w/e your plugin does",
	version = PLUGIN_VERSION, //you can allso remove the #define and add "1.0" here. but if you use cvar its kinda cool to use.
	url = "http://hellsgamers.com"
};


//lets add the plugin to use a command for w/e you want your plugin to do
public OnPluginStart()
{
	RegAdminCmd("sm_mycommand", Command_MyCommand, ADMFLAG_CUSTOM1);
//RedAdminCmd makes to admins can use the command, ADMFLAG_ is the flag required to use this command
	RegConsoleCmd("sm_my2command", Command_My2Command);
//RegConsoleCmd makes the command public so anyone is able to use this "command". 
}


/*this plugin does NOT work, because there is more you need to include to finish up your plugin.
I will post more tutorials later, but im kinda busy with new job and stuff*/

[/quote']

 Share

0 Comments


Recommended Comments

There are no comments to display.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.