#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Water Freeze"
#define VERSION "1.1"
#define AUTHOR "Anakin"

new toggle,shake;

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_forward(FM_PlayerPreThink,"PreThink");
	toggle = register_cvar("water_shake","1")
	shake = get_user_msgid("ScreenShake")
}

public PreThink(id){
	
	if(get_pcvar_num(toggle) == 1 && is_user_alive(id)) {
		
		if (pev(id,pev_flags) & FL_INWATER){
			
			message_begin(MSG_ONE,shake,{0,0,0},id);
			write_short(1<<13);
			write_short(1<<13);
			write_short(1<<13);
			message_end();
		}
	}
}
