AlliedModders

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

dt_torres 10-03-2007 20:24

Stomach Ache
 
This is my first plugin, I'm just starting it, it is my first plugin

the point of this plugin is to kill only in the stomach (im doing this coz its easy)

this is what ive got, tell me if Im on the right track plz

PHP Code:

 #include <amxmodx>
#include <fun>

new PLUGIN[]="Stomach Ache"
new AUTHOR[]="DT_TORRES"
new VERSION[]="BETA"

public plugin_init()

{
register_plugin(PLUGINVERSIONAUTHOR)
register_concmd("amx_stomachache""HIT_STOMACH 3"ADMIN_SLAY,"<target>")



btw:plz gimme karma im working a lot learning scrpting, i deserver it


ty m4a1 for help

M249-M4A1 10-03-2007 20:32

Re: Stomach Ache
 
2 things:

1) "HIT_STOMACH 3" needs to be the name of a public function. Meaning, you need to create another procedure called HIT_STOMACH 3. Infact, that can't even be done. HIT_STOMACH 3 needs to be one phrase (this is the name of the function, and name doesn't matter - you create it). I'll post an example of how it should work.

You will also want to consider #include <amxmisc>, as it contains some good stuff (like checking if the user has ADMIN_SLAY to use the command)

And getting back to the HIT_STOMACH 3 deal, look what I put in place of that:
PHP Code:

register_concmd("amx_stomachache""setStomachAche"ADMIN_SLAY"<target>"

PHP Code:

public setStomachAche() {



That means that the command "amx_stomachache" will do the public function called "setStomachAche"

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>

#define PLUGIN "Stomach Ache"
#define VERSION "DT_TORRES"
#define AUTHOR "BETA"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_concmd("amx_stomachache""setStomachAche"ADMIN_SLAY"<target>")
}

public 
setStomachAche() {
    
// Check if the user has access
    // Read in parameters
    // Set a target based on parameters
    // Set hitboxes


2) Wrap your code around [php] tags, this is how get code to look like the above.

dt_torres 10-03-2007 20:37

Re: Stomach Ache
 
u r starting to be my best Amx Friend xD

ty very much

+karma as possible

dt_torres 10-03-2007 20:44

Re: Stomach Ache
 
but if u need to put the function.. why is the function StomachAche if it doesnt even exist?

M249-M4A1 10-03-2007 20:46

Re: Stomach Ache
 
What do you mean?

dt_torres 10-03-2007 20:47

Re: Stomach Ache
 
you arent supposed to put the function u r using?

M249-M4A1 10-03-2007 20:51

Re: Stomach Ache
 
Take a look at this line:
PHP Code:

register_concmd("amx_stomachache""setStomachAche"ADMIN_SLAY"<target>"

The second parameter: "setStomachAche" is the name of the function that will run when someone does amx_stomachache.

Now look at this:
PHP Code:

public setStomachAche() { 
    
// Check if the user has access 
    // Read in parameters 
    // Set a target based on parameters 
    // Set hitboxes 


This actually creates the fucntion called setStomachAche. The amx_stomachache will run the above procedure. You put whatever necessary code in there.

dt_torres 10-03-2007 20:58

Re: Stomach Ache
 
ok


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

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