Quantcast
Jump to content

Welcome to HeLLsGamers

We’re happy to have you on our forums. To become a part of our community, please register for an account. By doing so, you’ll gain access to:

  • Start and reply to forum topics
  • Subscribe to topics and forums to get email updates
  • Customize your own profile page to your liking
  • Manage a friends list
  • Send private messages to other members

Login  - OR - Create Account

Sign in to follow this  
  • entry
    1
  • comments
    0
  • views
    1,293

Sourcemod Scripting tutorial [part #1]

Sign in to follow this  
Priceless

1,492 views

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']

Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy