Raised This Month: $ Target: $400
 0% 

some newbie questions :o


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
blaah
Member
Join Date: Jun 2004
Location: germany
Old 07-04-2004 , 15:44   some newbie questions :o
Reply With Quote #1

hi,
i want to write a little, useless plugin, that allows to spend each other 1$.
as i don't have written any other plugins before i tryed to put some code together and to get it running.
now i have some questions:
- how can i put a counter in there, to check how often someone spends money
- how can i change the concmd so that there must be at least 2 arguments instead of 3

Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

public plugin_init(){
	register_plugin("Spendmoney","0.1","Jens")
	//register_clcmd("say a", "give")
	register_concmd("amx_spend","give", ADMIN_LEVEL_A,"<nick> OR <#userid>")
}

public give(id,level,cl){
	if (!cmd_access(id,level,cl,3)){
        	return PLUGIN_HANDLED
	}
	new frst[32], name2[32], name[32]
	read_argv(1,frst,31)

	new player = cmd_target(id,frst)
	if (!player) return PLUGIN_HANDLED
	
   	get_user_name(id,name,31)
	get_user_name(player,name2,31)
        cs_set_user_money(player,cs_get_user_money(player)+1,1)
	set_hudmessage(6,13,28,0.05,0.86,2, 3.0, 2.0, 0.2, 3.0, 1)
	show_hudmessage(0, "%s spendet %s $1,00..", name, name2)
 	client_print(id,print_chat,"Yeah! Du hast %s $1,00 gespendet..",name2)
	return PLUGIN_HANDLED
}
beginnig is always hard
__________________
blaah is offline
Send a message via ICQ to blaah
Downtown1
Veteran Member
Join Date: Mar 2004
Old 07-04-2004 , 15:49  
Reply With Quote #2

Code:
   if (!cmd_access(id,level,cl,3)){            return PLUGIN_HANDLED    }

The 3 there is how many arguments AMXX wants you to have before it lets you use the command, so change it to '2' and people will be able to have 2 arguments provided the rest of your plugin reads the second argument.

So use this:
Code:
   if (!cmd_access(id,level,cl,2)){            return PLUGIN_HANDLED    }
Downtown1 is offline
blaah
Member
Join Date: Jun 2004
Location: germany
Old 07-04-2004 , 16:08  
Reply With Quote #3

ah, okay.. thaaanks!
__________________
blaah is offline
Send a message via ICQ to blaah
blaah
Member
Join Date: Jun 2004
Location: germany
Old 07-05-2004 , 13:37  
Reply With Quote #4

new day - new plugins - news question *g*
how can i choose a randoom player?

i tryed to make a small plugin to test an idea.. but it doesent realy works
Code:
	new rnd = 0;
	new res = 0;
	while(res == 0){
		rnd = random(15);
		new hp = get_user_health(rnd)
		if (!hp){
			client_print(0,print_chat,"%d %d exsists not",rnd, player);
		}else{
			res = rnd;
			client_print(0,print_chat,"%d %d exists",rnd, player);
		}
	}
__________________
blaah is offline
Send a message via ICQ to blaah
Reply


Thread Tools
Display Modes

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 14:48.


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