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

Annotation of /no_water.sma

Parent Directory Parent Directory | Revision Log Revision Log


Revision 25 - (view) (download)

1 : ian 1 /*
2 :     No Water Draw
3 :     Copyright (C) 2007 Ian (Juan) Cammarata
4 :    
5 : ian 25 This program is free software: you can redistribute it and/or modify
6 :     it under the terms of the GNU Affero General Public License as
7 :     published by the Free Software Foundation, either version 3 of the
8 :     License, or (at your option) any later version.
9 : ian 1
10 : ian 25 This program is distributed in the hope that it will be useful,
11 :     but WITHOUT ANY WARRANTY; without even the implied warranty of
12 :     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 :     GNU Affero General Public License for more details.
14 : ian 1
15 : ian 25 You should have received a copy of the GNU Affero General Public License
16 :     along with this program. If not, see <http://www.gnu.org/licenses/>.
17 : ian 1 --------------------------------------------------------------------------------
18 : ian 25 http://ian.cammarata.us
19 :    
20 : ian 1 Server cvars:
21 :    
22 :     // Enabled/Disables the plugin
23 :     // 0 = disabled
24 :     // 1 = enabled
25 :     nowater_draw "1"
26 :    
27 :     Greets to:
28 :    
29 : ian 9 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.
30 : ian 1
31 :     */
32 :     #include <amxmodx>
33 :     #include <amxmisc>
34 :     #include <engine>
35 :    
36 :     #define PLUGIN "No Water Draw"
37 :     #define VERSION "1.0"
38 :     #define AUTHOR "Ian Cammarata"
39 :    
40 :    
41 :     new nowater_draw
42 :    
43 :    
44 :     public plugin_init()
45 :     {
46 :     register_plugin(PLUGIN, VERSION, AUTHOR)
47 :    
48 :     nowater_draw = register_cvar("nowater_draw","1")
49 :     set_task( 5.0, "check_cvars", _, _, _, "b" )
50 :     }
51 :     public plugin_cfg()
52 :     {
53 :     new ent
54 :    
55 :     //If Cvar set, set func_water ents to no draw, helps many peoples FPS
56 :     if( get_pcvar_num( nowater_draw ) )
57 :     {
58 :     ent = find_ent_by_class( -1, "func_water" )
59 :     while( ent > 0 )
60 :     {
61 :     set_entity_visibility( ent, 0 )
62 :     ent=find_ent_by_class( ent, "func_water" )
63 :     }
64 :     }
65 :     }
66 :    
67 :     public check_cvars()
68 :     {
69 :     static bool:nodraw
70 :     if( get_pcvar_num( nowater_draw ) && !nodraw )
71 :     {
72 :     new ent = find_ent_by_class( -1, "func_water" )
73 :     while( ent > 0 )
74 :     {
75 :     set_entity_visibility( ent, 0 )
76 :     ent = find_ent_by_class( ent, "func_water" )
77 :     }
78 :     nodraw = true
79 :     }
80 :     else if( !get_pcvar_num( nowater_draw ) && nodraw )
81 :     {
82 :     new ent = find_ent_by_class( -1, "func_water" )
83 :     while( ent > 0 )
84 :     {
85 :     set_entity_visibility( ent, 1 )
86 :     ent = find_ent_by_class( ent, "func_water" )
87 :     }
88 :     nodraw = false
89 :     }
90 :     }

Contact
ViewVC Help
Powered by ViewVC 1.0.4