Raised This Month: $ Target: $400
 0% 

First Plug. Need Help. Be Gentle.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
smdobay
Member
Join Date: Feb 2005
Old 02-18-2005 , 00:03   First Plug. Need Help. Be Gentle.
Reply With Quote #1

So then, I recently switched over my cs server from AMX mod to AMXX. However, some of the old plugs I used to have weren't available for amxx, and since I like a challenge, I decided to write some of them myself rather than converting them (which I don't know how to do anyway ).

The first plugin I was trying to make was an amx_money command for admins of level h. Example:

amx_money Player 16000 ;Entered into the console.

So I read a bunch of stickes (this is my first small coding, but by no means my first time coding) and a few tutorials and came up with this:

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> public plugin_init() {    register_plugin("AmxxMoney","0.1","smdobay")    register_concmd("amx_money","money",ADMIN_LEVEL_H,"amx_money") } public money(id,level,cid) {      if (!cmd_access(id, level, cid, 0)) {       if (read_argc() < 2) {             console_print(id,"[AMXX] You must specify a user")             return PLUGIN_HANDLED           }       new user[32], amount, uid       read_argv(1,user,32)      read_argv(2,amount)       uid = find_player("bh",user)       if (uid == 0) {           console_print(id,"[AMXX] Invalid User Id")           return PLUGIN_HANDLED       }       client_cmd(id,"echo Player Granted Funds")                   cs_set_user_money(id,amount)           return PLUGIN_HANDLED      }       }

(In the preview my indentations aren't correct, but they are in the .sma file. I'm not that sloppy )

However, when I compiled it (no errors, just a warning about not returning a value), the server doesn't recognize amx_money as a command. And yes, before you ask, I did put it into my plugins.ini.

Thoughts? Help? Suggestions?

P.S. Rather than simply setting their money, it would be cool if I could set it to add on, but I don't know the funtion for returning a player's funds.
smdobay is offline
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 02-18-2005 , 00:09  
Reply With Quote #2

Try using this:

Code:
new target = cmd_target(id,user,31)

Oops and also, amount needs to be indexed. Use amount[5].
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
smdobay
Member
Join Date: Feb 2005
Old 02-18-2005 , 00:16  
Reply With Quote #3

I feel a little stupid. Use that line in place of what?
smdobay is offline
smdobay
Member
Join Date: Feb 2005
Old 02-18-2005 , 00:25  
Reply With Quote #4

I feel a little stupid. Use that line in place of what?
[Edit] For some reason this posted twice....[/edit]
smdobay is offline
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 02-18-2005 , 00:25   Here
Reply With Quote #5

Take a look at my code.
Attached Files
File Type: sma Get Plugin or Get Source (amx_money.sma - 632 views - 960 Bytes)
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
smdobay
Member
Join Date: Feb 2005
Old 02-18-2005 , 00:27  
Reply With Quote #6

Ah, I see now. Many thanks.
smdobay is offline
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 02-18-2005 , 00:28   NP
Reply With Quote #7

No problem, if you need any more help with anything, just post it
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
smdobay
Member
Join Date: Feb 2005
Old 02-18-2005 , 00:44  
Reply With Quote #8

Heh. It's still not registering the command, but I don't think it's a code issue. All you need to do is put the amxx file in plugins, and add it to plugins.ini, right?
smdobay is offline
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 02-18-2005 , 00:57  
Reply With Quote #9

lol yes do that, but I just realized, change this line:

Code:
if (!cmd_access(id, level, cid, 0)) {

to this:

Code:
if (cmd_access(id, level, cid, 0)) {

the ! says if the don't have access let them use the command... lol sorry
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
smdobay
Member
Join Date: Feb 2005
Old 02-18-2005 , 01:12  
Reply With Quote #10

You da man, it recognizes the command

I hope by now I'm not being a bother, but somethin's still wrong. It can never find the player.

Since I don't 100% understand the code you gave me, I can't tell whether I need to input a name or ID number. But I tried it both ways with and without quotes. Still no ID found.

I'm assuming that this:
Code:
new target_id = cmd_target(id, user, 32)
is a boolean function that returns whether the user exists or something along those lines, considering the !target usage, but then why would you use it like an integer later if that were the case

*Needs to Brush Up on his Small*
smdobay 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 19:21.


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