Raised This Month: $ Target: $400
 0% 

Newbie Scripter - First Plugin - Need Help don't Laugh :)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eXist
Member
Join Date: Apr 2005
Old 04-16-2005 , 20:30   Newbie Scripter - First Plugin - Need Help don't Laugh :)
Reply With Quote #1

I'm a first timer, and after studying up on the small language, I decided to write my first plugin in order to become better and gain more experience.
My first Plugin is desiged to stack a User upon the admin that sent the command. I haven't been able to test my plugin yet because of a compling error.

(Line 38 ) Compiling Error 017 : Undefined Symbol "set_user_origin"

I've read up on the error, and I have been unable to understand the problem. I've looked at other "Stack" Plugins and they haven't help much either.

If someone could help me with this problem it would be very much appriciated.

I apologize if my code is completely falty in the long run, I'm trying.

Code:
#include <amxmodx> #define PLUGIN_NAME "Stack X" #define PLUGIN_VERSION "1.0" #define PLUGIN_AUTHOR "eXist`" public plugin_init()     {         register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)         register_concmd("amx_stackx", "stack_x", ADMIN_KICK, "user Define a Player to be stacked upon yourself.")     }     public stack_x(id)     {         if (get_user_flags(id) != ADMIN_KICK)             {                 console_print(id, "[AMXX] You have no access to that command!")                 return PLUGIN_HANDLED             }         if (read_argc() == 0)             {                 console_print(id, "[AMXX] Please Specify a User")                 return PLUGIN_HANDLED             }         new user[32], uid         read_argv(1,user,32)         uid = find_player("bh",user)         if (uid == 0)             {                   console_print(id,"[AMXX] Invalid User Id")                 return PLUGIN_HANDLED             }         new origin[3]         if (uid == 1)             {                 get_user_origin(id, origin, 0)                 origin[2] = origin[2] + 50                 set_user_origin(uid, origin)                 return PLUGIN_HANDLED             }     }
eXist is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-16-2005 , 20:36  
Reply With Quote #2

No need to laugh.

Code:
#include <fun> // Fun module is required for set_user_origin()

Also, before the last } put: return PLUGIN_HANDLED

--

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN_NAME "Stack X" #define PLUGIN_VERSION "1.0" #define PLUGIN_AUTHOR "eXist`" public plugin_init() {     register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)     register_concmd("amx_stackx", "stack_x", ADMIN_KICK, "user Define a Player to be stacked upon yourself.") } public stack_x(id,level,cid) {     if (!cmd_access(id,level,cid,1)) {         //console_print(id, "[AMXX] You have no access to that command!")         // Not needed because it will already be printed!         return PLUGIN_HANDLED     }     new user[33]     read_argv(1,user,32)     new player = cmd_target(id,user,1+2)     if(!is_user_connected(player) || !is_user_alive(player)) {         return PLUGIN_HANDLED     }     new origin[3]     get_user_origin(id, origin, 0)     origin[2] = origin[2] + 50     set_user_origin(player, origin)     return PLUGIN_HANDLED }

(Sorry about editing like post like 10 times!)
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
eXist
Member
Join Date: Apr 2005
Old 04-16-2005 , 20:55   Thanks
Reply With Quote #3

*Bows to the Scripting God*

Permision to laugh granted

Thanks very much for the extremly fast reply, amazing
6 minutes later thats some kind of god you must be. I like you already Vex: Your a very helpful guy, thanks.

I had a feeling it might be a problem with the includes.

Yea it was funny i saw the post constanly changing

Can you help me understand these lines

Code:
    new player = cmd_target(id,user,1+2)     if(!is_user_connected(player) || !is_user_alive(player)) {         return PLUGIN_HANDLED
eXist is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-16-2005 , 21:01  
Reply With Quote #4

Scripting God? Ha!

Code:
new player = cmd_target(id,user,1+2)
cmd_target() locates a player's id. The 1+2 part means "obey immunity + allow immune admin to perform on self".
Quote:
Flags:
1 - obey immunity
2 - allow yourself
4 - must be alive
8 - can't be bot
Code:
if(!is_user_connected(player) || !is_user_alive(player))
Well, let's make this simple.. If the user isn't connected OR the user isn't alive, stop the rest of the function from being executed.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
eXist
Member
Join Date: Apr 2005
Old 04-16-2005 , 21:06  
Reply With Quote #5

Yea sorry i got antsy, asking before i tried to figure it out.
I got it after like 2 seconds after i posted, sorry for wasting you time.
It definatly compiles now, thanks.

One more question.

I had read an ealier post of yours that says to ignore the:
Compile warming 217: loose intention.
I was wondering if there is a way to fix this (beacuse my plugin has 3) or if it may cause problems if i dont fix it.
eXist is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-16-2005 , 21:09  
Reply With Quote #6

It means you didn't make the proper indentations. Everything must be consistent. Hell, if you don't feel like indenting your code, stick it in the online-indenter (I recommend unchecking the box)!

I prefer using tabs, some people prefer using spaces. It's really just personal preference.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
eXist
Member
Join Date: Apr 2005
Old 04-16-2005 , 21:11  
Reply With Quote #7

Thanks ill try it out.

Also, can i keep this piece of code? or is it a worthless dumb

Code:
if (read_argc() == 0)             {                 console_print(id, "[AMXX] Please Specify a User")                 return PLUGIN_HANDLED
eXist is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-16-2005 , 21:14  
Reply With Quote #8

Worthless indeed.

I replaced that with that other if() statement (checking if the user is connected/alive).
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
eXist
Member
Join Date: Apr 2005
Old 04-16-2005 , 21:20  
Reply With Quote #9

Thanks for all your help. Complied Perfect, no errors intened.

Sorry to bother for one last time, but i need some for help figuring out these lines, i looked them up but im still troubled, also embarassed for being so nub

Code:
public stack_x(id,level,cid) {     if (!cmd_access(id,level,cid,1))

I just dont understand the (id,level,cid) and the (id,level,cid,1).
Sorry bout that
eXist is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-16-2005 , 21:27  
Reply With Quote #10

Not sure how to explain it.

Code:
if(!cmd_access(id,level,cid,1))
It grabs the access level from the command, in this case it's "ADMIN_KICK". 1 means only 1 argument when called. If it returns false (0), the stuff inside the curly brackets will execute.
Quote:
The last parameter (num) is the number of arguments.
Note that the first parameter is the command name so if you expect one param set it to 2.
Sorry if I confused you..
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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