Raised This Month: $ Target: $400
 0% 

optimize the code ?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
lqlqlq
Senior Member
Join Date: Jan 2008
Old 04-21-2011 , 13:59   optimize the code ?
Reply With Quote #1

Give this code here because I think that because it gets segmentation fault error in my server and I think he needs optimization, what do you think?
Code:
#include <amxmodx>
#include <cstrike>

new const VERSION[] = "1.0"

new gmsgTextMsg

public plugin_init()
{
	register_plugin("3 in 1", VERSION, "Dark_Style")
	
	register_clcmd("radio1", "cmd_block")
	register_clcmd("radio2", "cmd_block")
	register_clcmd("radio3", "cmd_block")
	register_clcmd("chooseteam", "cmd_block")
	register_clcmd("drop", "cmd_block")
	
	gmsgTextMsg = get_user_msgid("TextMsg")
	register_message(get_user_msgid("SendAudio"), "Message_SendAudio")
}

public cmd_block(id)
{
	return PLUGIN_HANDLED
}

public Message_SendAudio(iMsgId, iMsgDest, id)
{
	if(id)
	{
		new szRadioKey[19]
		static const MRAD_FIREINHOLE[] = "%!MRAD_FIREINHOLE"
		get_msg_arg_string(2, szRadioKey, charsmax(szRadioKey))
		
		if(equal(szRadioKey, MRAD_FIREINHOLE))
		{
			if(get_msg_block(gmsgTextMsg) != BLOCK_SET)
			{
				set_msg_block(gmsgTextMsg, BLOCK_ONCE)
			}
			return PLUGIN_HANDLED
		}
	}
	return PLUGIN_CONTINUE
}

public client_command(client)
{
	static const szJoinCommand[] = "jointeam"
	
	static szCommand[10]
	read_argv(0, szCommand, 9)
	
	if(equal(szCommand, szJoinCommand)
	&& CS_TEAM_T <= cs_get_user_team(client) <= CS_TEAM_CT)
	{
		console_print(client, "That command is blocked on this server")
		return PLUGIN_HANDLED
	}
	return PLUGIN_CONTINUE
}
lqlqlq 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 19:55.


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