Raised This Month: $ Target: $400
 0% 

Problem with agrument reading


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
vbSteve
Junior Member
Join Date: Jun 2006
Old 06-05-2007 , 06:09   Problem with agrument reading
Reply With Quote #1

Hi,

I'm making a plugin that will work as a clan chat (a private chat system for clan members only)

I'm having problems with reading the first argument of the command amx_clansay <Message>, which I bound to "messagemode amx_clansay". Everytime I use it, it keeps resulting in the same error:
Usage: amx_clansay <Message>

I'm desperate (Ive been looking for hours and hours), and I can't find where I'm wrong; maybe you guys can find it. I'm guessing it's something to do with "read_argv(1, argSay, 255);"

Here's a the part of the code that needs attention:

Code:
#include <amxmodx>

#define ADM_LEVEL ADMIN_LEVEL_H
#define msgPrefix "[Clan]"
#define Color "^x04" 		// Green

public plugin_init(){
	register_plugin("Clan Chat", "1.0.7", "mCoDev Systems");
	
	register_concmd("amx_clansay", "do_clansay", ADM_LEVEL, " <Message>");

	return PLUGIN_HANDLED;
}

public do_clansay(id, level, cid){
	new argSay[256];  // Hold command argument
	new tMsg[256];   // Hold Message
	new pName[33];    // Hold playername
	new p = get_maxplayers(); // Max players.
	new pid;  // Hold player id

	read_argv(1, argSay, 255);
	
	if (!cmd_access(id, level, cid, 3)) return PLUGIN_HANDLED;
	
	get_user_name(id, pName, 32);
	format(tMsg, 255, "%s %s %s: %s", Color, msgPrefix, pName, argSay);
	
	for(pid=1; pid <= p; ++pid){
		if(get_user_flags(pid) & ADM_LEVEL){
			if(is_user_connected(pid)){
				print_message(pid, tMsg); // Subroutine print_message.
			}
		}
	}
	
	return PLUGIN_HANDLED;
}


Many thanks in advance.
Steve
vbSteve is offline
 



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 10:33.


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