AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help pls (https://forums.alliedmods.net/showthread.php?t=171701)

horcrux 11-09-2011 12:38

Help pls
 
Hi friends,

I am very new to scripting.I am a totally beginner to this plugin scripting and all.But its my passion to learn how to make a plugin.Please can ne 1 tell me from begining how to make plugin in easy language.Thank you.

~ Ho[R]cRuX :mrgreen:

kramesa 11-09-2011 12:57

Re: Help pls
 
This is a very simple plugin, look:

PHP Code:

#include <amxmodx>  
#include <amxmisc>

#define PLUGIN "Simple Plugin"  
#define VERSION "1.0"  
#define AUTHOR "kramesa"  

public plugin_init()   
{  
    
register_plugin(PLUGINVERSIONAUTHOR
    
register_cmd("say /buyawp""Awp"
}  

public 
Awp(id

    
give_item(id"weapon_awp")


View this forum: http://forums.alliedmods.net/forumdisplay.php?f=83

horcrux 11-17-2011 06:10

Re: Help pls
 
tell me how to make more plugins with lil bit description pls

Napoleon_be 11-17-2011 06:48

Re: Help pls
 
PHP Code:

#include <amxmodx>
#include <colorchat>

#define VERSION "1.0" //Only define our Version to optimize the plugin.

public plugin_init() {
    
register_plugin("Say Hello!"VERSION"NapoleoN#"// Register out plugin.
    
register_clcmd("say /hi""Handle_Say")
}

public 
Handle_Say(id) {
    if(
is_user_connected(id)) {
        
ColorChat(idGREEN"[Hello]^X01 Welcome to the server!"// Prints our message when you are connected.
    
}



drekes 11-17-2011 07:42

Re: Help pls
 
Quote:

Originally Posted by Napoleon_be (Post 1598005)
PHP Code:

#include <amxmodx>
#include <colorchat>

#define VERSION "1.0" //Only define our Version to optimize the plugin.

public plugin_init() {
    
register_plugin("Say Hello!"VERSION"NapoleoN#"// Register out plugin.
    
register_clcmd("say /hi""Handle_Say")
}

public 
Handle_Say(id) {
    if(
is_user_connected(id)) {
        
ColorChat(idGREEN"[Hello]^X01 Welcome to the server!"// Prints our message when you are connected.
    
}



You don't have to check if the user is connected.
He can't say anything if he isn't connected.

Napoleon_be 11-17-2011 10:29

Re: Help pls
 
Quote:

Originally Posted by drekes (Post 1598020)
You don't have to check if the user is connected.
He can't say anything if he isn't connected.

A server could slowhack some binds into his config wich can contain the command "quit". This is just to be sure.

Ex1ne 11-17-2011 11:18

Re: Help pls
 
Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <hamsandwich>
#include <fun>

#define PLUGIN "VIP Idea"
#define VERSION "1.0"
#define AUTHOR "Ex1ne^"
//Add a cvar
new pcvar_hpammount

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
//Add a cvar command
pcvar_hpammount = register_cvar("amx_viphealth", "120")
RegisterHam(Ham_Spawn, "player", "VIPIdea", 1)
}
//Now the user flags for the cvar
public VIPIdea(id) {
if(get_user_flags(id) & ADMIN_CFG) {
set_user_health(id, get_pcvar_num(pcvar_hpammount))
}
}

Just for fun realy, but can be used for a VIP plugin.

drekes 11-17-2011 11:43

Re: Help pls
 
Quote:

Originally Posted by Napoleon_be (Post 1598084)
A server could slowhack some binds into his config wich can contain the command "quit". This is just to be sure.

I still think it's useless.

I've never done it in the 2 years i'm working with amxx and never got any problems or errors my way.

horcrux 11-18-2011 05:47

Re: Help pls
 
why we write (id) in bracket can sum1 tell
and from where i can get all the commands like if(user_is_connected) etc.

drekes 11-18-2011 06:02

Re: Help pls
 
Quote:

Originally Posted by horcrux (Post 1598463)
why we write (id) in bracket can sum1 tell

It's a parameter from that function / forward.
It can be named whatever you want but most people use id because it holds the id of the player.

Quote:

Originally Posted by horcrux (Post 1598463)
and from where i can get all the commands like if(user_is_connected) etc.

The includes & the funcwiki.


All times are GMT -4. The time now is 14:22.

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