Raised This Month: $ Target: $400
 0% 

help with plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GamerXR72
New Member
Join Date: Nov 2004
Location: With Avalanches Mom
Old 11-09-2004 , 19:16   help with plugin
Reply With Quote #1

Im not sure exactly what wrong with it, but then again this is the first plugin Ive tried to make. I eventually plan to have the user define the amount of cash to be deposited, but Im not sure how. I also havent written a withdraw command yet.

Code:
/* AMXMODX Script
*
*  Counter-Strike Bank
*  by GamerXR72 / [STATE]Jacob
*
*  Thanks to:
*  devicenull (for his tutorials at http://www.amxmodx.org/forums)
*  AMXMODX Team, for their exceptional work.  Keep it up!
*/

#include <amxmodx>
#include <cstrike>
#include <vault>

// AMXX plugin information
public plugin_init () {	
	
	// plugin name, version, author
	register_plugin ("csbank","0.1","GamerXR72") 
	
	// registers the deposite command
	register_concmd ("deposite","desposite",ADMIN_USER," deposites money into your account")
}

// creates a bank account on connect
public client_connect(id) {
	
	// declaring variables
	new bank = 0
	new authid[32]
	new name[32]	
	
	// getting player information
	get_user_name(id,name,31)
	get_user_authid(id,authid,31)
	
	// determines wether or not an account exists and obtains account data
	if (vaultdata_exists(authid)) {
		get_vaultdata(authid,name,bank)
		client_print(id,"[AMXX] Account Exists."
		return PLUGIN_HANDLED
	}
	
	// saving player information to vault
	set_vaultdata(authid,name,bank)
	client_print(id,"[AMXX] Bank account created,  Bank will be deleted on disconnect if empty."}
	return PLUGIN_HANDLED
}

//deposites $1000
funnction deposite(id,bank) {
	
	// declaring variables
	new current_cash
	
	// getting player information
	cs_get_user_money(current_cash)
	
	// checks if player has enough cash and puts it in bank
	if (current_cash > 1000) {
		add(bank,1000)
		subtract(current_cash,1000)
		cs_set_user_money(current_cash)
		
		// if the player doesnt have enough cash, stops the plugin
		else if (current_cash < 1000) {
			client_print(id,"[AMXX] Not enough cash.")
			client_printhud(id,"[AMXX] Not enough cash.")
			return PLUGIN_HANDLED
		}
	}
	return PLUGIN_HANDLED
}
GamerXR72 is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-09-2004 , 20:55  
Reply With Quote #2

And...?
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
johnjg75
Veteran Member
Join Date: Mar 2004
Location: Delaware
Old 11-09-2004 , 21:18  
Reply With Quote #3

u dont need to include vault, its already included with amxmodx

o man man man, i see soo many errors
__________________
johnjg75 is offline
Send a message via AIM to johnjg75 Send a message via MSN to johnjg75 Send a message via Yahoo to johnjg75
GamerXR72
New Member
Join Date: Nov 2004
Location: With Avalanches Mom
Old 11-10-2004 , 00:42  
Reply With Quote #4

Quote:
Originally Posted by XxAvalanchexX
And...?
And... this is the scripting help forum, so blow me. Don't even post here if that is all you are going to say.
GamerXR72 is offline
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 11-10-2004 , 01:49  
Reply With Quote #5

1. Check the usage of your functions.
2. You can't save numbers to the vault you have to use num_to_str and str_to_num to save numbers to the vault.
3. Make sure you are closing all your paranthesis correctly.
4. I would use client_putinserver instead of client_connect but even then they probably wont see the message you tried to print.
5. You can't just add parameters to a function that is concmd/clcmd...you have to use read_argv/read_args
6. Add and subtract are non-existant functions(at least the way you're trying to use them)...you're goning to have to write to the vault go read up on the vault functions on the front page.
7. client_printhud isn't a valid function either...

Go read up here....http://www.amxmodx.org/funcwiki.php...and next time a specific question would be nice or else you are going to get what you got from everyone else. I was in a good mood...
__________________
twistedeuphoria is offline
GamerXR72
New Member
Join Date: Nov 2004
Location: With Avalanches Mom
Old 11-10-2004 , 12:30   hrm
Reply With Quote #6

I was unaware that I couldn't save numbers too the vault.

I believe all my paranthesis are closed. Im using JEdit, and if they werent closed all the text following it turns a different color.

Im not sure what you mean by "You can't just add parameters to a function that is concmd". Is a "parameter" just the word you used or is there terminology behind it?

concerning client_printhud, I was browsing through the warcraft3ft.sma file when I saw it and thought that was the command to display text in the middle of the HUD.
GamerXR72 is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-10-2004 , 15:21  
Reply With Quote #7

Quote:
Originally Posted by GamerXR72
And... this is the scripting help forum, so blow me. Don't even post here if that is all you are going to say.


You didn't tell us anything to help you with. You just said, "My plugin has problems."
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 11-10-2004 , 18:21  
Reply With Quote #8

Code:
client_print(id,"[AMXX] Account Exists."
Code:
   client_print(id,"[AMXX] Bank account created,  Bank will be deleted on disconnect if empty."}

warcraft3.sma may have the function but look for it declared in the file so you will have to write the function yourself to use it in yours(or copy it and credit them).

-_-...A parameter is information you send to a function...ex..
Code:
register_plugin("Blah","blah",ADMIN_BLAH,"BLAH blah")
All the stuff in the paranthesis are parameters you are sending to the function register_plugin. What I said is you cannot just add a new parameter in the function declaration..ie.
Code:
public newfunction()
that doesn't exist. There are certain parameters passed to a concmd/clcmd and "bank" is not one of them. If "bank" is a piece of data you want the user to enter you have to use read_args/read_argv....

Oh yes, and also it's not nice to insult people especially when you're trying to get help...you might look like an ass.
__________________
twistedeuphoria is offline
GamerXR72
New Member
Join Date: Nov 2004
Location: With Avalanches Mom
Old 11-10-2004 , 19:26  
Reply With Quote #9

Quote:
Originally Posted by twistedeuphoria
Oh yes, and also it's not nice to insult people especially when you're trying to get help...you might look like an ass.
You've been very helpful. Im going to write some training scripts to get familiar with Small before I continue the CS-Bank plugin.

That being said, I realize that it may make me look like an ass. Im a newbie to these boards but Im not a newbie to forums. I always respond in kind. That being said, at the risk of looking like an ass:

Quote:
Originally Posted by XxAvalanchexX
You didn't tell us anything to help you with. You just said, "My plugin has problems."
blah blah blah... Just stfu. Dont post anymore of your garbage in my thread.
GamerXR72 is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-10-2004 , 23:41  
Reply With Quote #10

Quote:
Originally Posted by GamerXR72
blah blah blah... Just stfu.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX 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 16:26.


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