[Half-Life AMXX] / no_water.sma Repository:
ViewVC logotype

View of /no_water.sma

Parent Directory Parent Directory | Revision Log Revision Log


Revision 25 - (download) (annotate)
Tue Nov 20 22:36:56 2007 UTC (16 years, 4 months ago) by ian
File size: 2387 byte(s)
Applied AGPLv3 license.
/*
No Water Draw
Copyright (C) 2007 Ian (Juan) Cammarata

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------------
http://ian.cammarata.us

	Server cvars:

	// Enabled/Disables the plugin
	// 0 = disabled
	// 1 = enabled
	nowater_draw "1"

	Greets to:
	
	VipKiller who took an exact unmodified copy of code from my plugin and tried to take credit for writing it (oh, they did change the cvar, but doesn't count as an original work, it's still my code).  Read the GPL2 and copyright law.
	
*/
#include <amxmodx>
#include <amxmisc>
#include <engine>

#define PLUGIN "No Water Draw"
#define VERSION "1.0"
#define AUTHOR "Ian Cammarata"


new nowater_draw


public plugin_init()
{	
	register_plugin(PLUGIN, VERSION, AUTHOR)

	nowater_draw = register_cvar("nowater_draw","1") 
	set_task( 5.0, "check_cvars", _, _, _, "b" )
}
public plugin_cfg()
{
	new ent
	
	//If Cvar set, set func_water ents to no draw, helps many peoples FPS
	if( get_pcvar_num( nowater_draw ) )
	{
		ent = find_ent_by_class( -1, "func_water" ) 
		while( ent > 0 ) 
		{
			set_entity_visibility( ent, 0 ) 
			ent=find_ent_by_class( ent, "func_water" )
		}
	}
}

public check_cvars()
{
	static bool:nodraw
	if( get_pcvar_num( nowater_draw ) && !nodraw )
	{
		new ent = find_ent_by_class( -1, "func_water" )
		while( ent > 0 )
		{
			set_entity_visibility( ent, 0 ) 
			ent = find_ent_by_class( ent, "func_water" )
		}
		nodraw = true
	}
	else if( !get_pcvar_num( nowater_draw ) && nodraw )
	{
		new ent = find_ent_by_class( -1, "func_water" )
		while( ent > 0 )
		{
			set_entity_visibility( ent, 1 ) 
			ent = find_ent_by_class( ent, "func_water" )
		}
		nodraw = false
	}
}

Contact
ViewVC Help
Powered by ViewVC 1.0.4