AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Teach me how to make a custom item [TSRP] =] (https://forums.alliedmods.net/showthread.php?t=29705)

keVn 06-10-2006 19:52

Teach me how to make a custom item [TSRP] =]
 
Hey
Can someone give me a guide or explain how I make a custom item
With a function? I want the item to be like using a hamburger.
But instead of restoring your hunger, it announces that your going to do a hit in a special chat.
Like how they have (CNN) (Advert) I want it to be (Hit).
Can someone show me how to do that?

Des12 06-10-2006 20:16

5 parts:

Code:
//1: a server command in the init function public plugin_init() {    register_srvcmd("item_hit","item_hit"); } //2: a public function for the item public item_hit() { //3: reading arg to get id    new arg[32];    read_argv(1, arg, 31);    new id = str_to_num(arg);    new name[32];    get_user_name(id, name, 31); //4: printing it out (0 = to everyone, %s = their name)    client_print(0,print_chat,"[Hit] %s is going to do a Hit!",name);    return PLUGIN_HANDLED; }

5: In the sql, make an item, and have the command be:
item_hit <id>

keVn 06-10-2006 20:44

Alright thanks. Wait where do I put the stuff in.. sorry I'm a real noob.

syke 06-10-2006 21:01

i think u put it in a notepad then save as "all file types" .sma so like firstplugin.sma and then use the compiler on the website but im not 100% correct

keVn 06-10-2006 21:11

Ok I'll try what you said, if it doesn't work I'll just keep posting :P

syke 06-10-2006 21:12

Ok :D if it works you could give me some Karma :) 8)

keVn 06-10-2006 21:14

Lol uh oh. It doesn't work.. well I don't know if I did anything wrong with the compiler but it gave me this error
Quote:

/home/users/amxmodx/tmp3/textj4ZM3l.sma(4) : error 017: undefined symbol "register_srvcmd"
/home/users/amxmodx/tmp3/textj4ZM3l.sma(13) : error 017: undefined symbol "read_argv"
/home/users/amxmodx/tmp3/textj4ZM3l.sma(14) : error 017: undefined symbol "str_to_num"
/home/users/amxmodx/tmp3/textj4ZM3l.sma(17) : error 017: undefined symbol "get_user_name"
/home/users/amxmodx/tmp3/textj4ZM3l.sma(20) : error 017: undefined symbol "client_print"
/home/users/amxmodx/tmp3/textj4ZM3l.sma(20) : warning 215: expression has no effect
/home/users/amxmodx/tmp3/textj4ZM3l.sma(20) : warning 215: expression has no effect
/home/users/amxmodx/tmp3/textj4ZM3l.sma(20) : error 001: expected token: ";", but found ")"
/home/users/amxmodx/tmp3/textj4ZM3l.sma(20) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp3/textj4ZM3l.sma(20) : fatal error 107: too many error messages on one line

Compilation aborted.
8 Errors.
Could not locate output file /home/groups/amxmodx/public_html/websc3/textj4ZM3l.amx (compile failed).
Do you know how to fix it :O

Drak 06-10-2006 21:27

It looks like you forgot to add includes and messed up on some of your indents or something.
Code:
#include <amxmodx> #include <amxmisc> //1: a server command in the init function public plugin_init() {    register_srvcmd("item_hit","item_hit"); } //2: a public function for the item public item_hit() { //3: reading arg to get id    new arg[32];    read_argv(1, arg, 31);    new id = str_to_num(arg);    new name[32];    get_user_name(id, name, 31); //4: printing it out (0 = to everyone, %s = their name)    client_print(0,print_chat,"[Hit] %s is going to do a Hit!",name);    return PLUGIN_HANDLED; }

Peli 06-10-2006 21:28

You should look up the sticky about "Helpful Scripting Links" and there's a guide for making a weapon.

keVn 06-10-2006 21:31

Whoot that works. Thanks Six


All times are GMT -4. The time now is 07:55.

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