Jump to content

Recommended Posts

Posted

Lets beggin to make an Plugin [AMXX]

 

 

 

Ok , in this Tutorial i will explain you step by step , everything to make creat an simple Plugin  . If you dosnt make any plugin till now and you dosnt know how a plugin is made , follow this tutorial , you will learn now :)

 

The Plugins , as you have seen already (if you take a look in any .sma) , the are maded from publics and stocks (You will it later , now lets learn the publics)

 

Creat an .txt file, and modify the .sma extension . Lets say we creat the plugin.sma file. Open it with notepad (You can use also and others programs,wich help you in scripting but i dont recomend it,its ok and that) .

 

Beggin with some includes. What mean an include ? The includes are some commands lines wich show to the amxmodx wich of them will be used in this Plugin . For beggin , we use amxmodx:

 

 

CODE
#include <amxmodx>

 

 

The includes list can continue , but we should leave that . You will learn a little later and about another includes .

 

Then , register the Plugin , through a specific public , called public plugin_init() . So, press enter and add :

 

 

CODE
public plugin_init()

{

}

 

 

between the two brackets ( { and } ) , we will add the public code . These braces represent the beggin and the end of an part / the entire public . Later we will learn and the part with many parts of the public , but for this moment this is enought. between parenthesis , add register_plugin("The name of the Plugin","the version"the author"  :) . Register_plugin is an function of the above include  (amxmodx) ,and the rest are arguments  . We will have :

 

 

CODE
#include <amxmodx>



public plugin_init()

{

register_plugin("name", "version", "author"  :)

}

 

 

Atention ! The space from the register_plugin is absolutly necesary ,if it isnt right the plugin will dosnt run right ! Leave the space with TAB keyboard not with SPACE. Also in plugins NEVER use the SPACE keyboard (only in arguments) ! Change the name with the name of the plugin,the version with the version,the author with the plugin author (Your Name) . Atention ! Dont delete the quotes ""ghilimelele ! Modify only the texts.

Also in plugin_init , we will could to register and some comands . Lets register one . The Function is this :

 

CODE
register_concmd("comand","public",admin right,"Mesage wich apear you when you give amx_help"

 :)

 

 

To "admin right" , you can put those:

 

 

CODE
ADMIN_RESERVATION

ADMIN_IMMUNITY

ADMIN_KICK

ADMIN_BAN

ADMIN_SLAY

ADMIN_MAP

ADMIN_CVAR

ADMIN_CFG

ADMIN_CHAT

ADMIN_VOTE

ADMIN_PASSWORD

ADMIN_RCON

ADMIN_LEVEL_A

ADMIN_LEVEL_B

ADMIN_LEVEL_C

ADMIN_LEVEL_D

ADMIN_LEVEL_E

ADMIN_LEVEL_F

ADMIN_LEVEL_G

ADMIN_LEVEL_H

 

So , add in .sma :

 

 

CODE
register_concmd("amx_ss","admin_ss",ADMIN_LEVEL_C,"Take a snapshot to selected player"

 

To the amx_ss command , the public admin_ss will start , only if the admin wich execute the command letter "C" in acces.

 

Ok , now make the public .

 

Add :

 

 

CODE
public admin_ss(id)

{

}

 

 

As you seen , i added an id on this public . This id represent the index wich will be the command executed.

Between { and } , we will should to add the public codec.Usually is an combination between some functions . For example , if we wanna to make an snapshot to an player , we weill add between { and } the next functions :

 

CODE
client_cmd(id, "snapshot"

 

 

Client_cmd represent the function for execute a comand on an client , but the id represent to who to execute the command. Snapshot represent the command .

Add some tabs to well-ordered the codec. Ok , till now we should have the next:

 

CODE
#include <amxmodx>



public plugin_init()

{

register_plugin("nume", "versiune", "autor"Wink

register_concmd("amx_ss","admin_ss",ADMIN_LEVEL_C,"It takes a snapshot to the specified Player ."Wink

}



public admin_ss(id)

{

client_cmd(id, "snapshot"

}

 

 

Save the file , and then compile it .After move it to the server . When you will run the amx_ss command <Player> , it will makes ss to the specified player.

Well , thats all. If you follow the all steps from above CONGRATZ ! You made an plugin.

 

Best Regards.

 

Credits:Me & Mut2nt.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   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.



×
×
  • Create New...