Raised This Month: $51 Target: $400
 12% 

Problem anti_scroll_fadeblack help fix!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
strigl10
Member
Join Date: Oct 2012
Old 05-05-2020 , 05:34   Problem anti_scroll_fadeblack help fix!
Reply With Quote #1

Hello, I have a problem with this plugin, it does its job but it happens to me that when I do a quick or double Duck often I take it as if it were scroll ... could it be fixed?


HTML Code:
/* 
/////////////// Anti-Scroll Fade To Black //////////////////////////////////

Espero que este plugin le pueda enseñar a la gente a no usar la rueda!

Changelog:
///////////
1.0 - 
*Publicación del Plugin.

1.1 - 
*Agregado: cvar para habilitar/deshabilitar el Fade Screen.
*Mejora: Mejorado el metodo de deteccion de Scroll.

1.2 -
*Fix: Subido el Alpha del Fade Screen a 255, para evitar ventajas bugueando la flashbang.
*Fix: Problemas de transparencias con el Fade Screen.
*Fix: Bajado el tiempo de duracion del Fade Screen a 5 segundos.
*Reemplazado: El stock del chatcolor anterior, por uno mas eficiente.
*Corregido: Nombre Autor, y nombre del Plugin.
*Mejora: Pequeñas mejoras en el código en general.
*Nuevo: Un hud con cuenta regresiva hasta que se vaya el screen fade.

//////////////////

*/

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#include "screenfade_util.inc" //

#define PLUGIN "Anti-Scroll "
#define VERSION "1.2"
#define AUTHOR 

#define TASK_C 3323
#define ID_TASK (taskid - TASK_C)

//Scroll Vars
new last_stand[33],Float:duck_start_time[33],Float:last_origin[33][3];

//Habilitar/Deshabilitar Plugin Var
new scroll_enabled;

//Fade Screen Vars
new screenfade_enabled;
new g_pCvarType;

//Spawn bool Var
new bool:FirstSpawn[33];

//Segs hud var
new segs[33];

public plugin_init() 
{

	

	register_forward(FM_CmdStart, "pfw_CmdStart", 1);
	
	scroll_enabled = register_cvar("anti_scroll", "1"); //cualquier valor distinto a 1, apaga el plugin!
	
	g_pCvarType = register_cvar("color_type", "0 000 0") //cvar de color del Screen Fade
	
	screenfade_enabled = register_cvar("screen_fade", "1"); //cualquier valor distinto a 1, desactiva el Screen Fade!
	
	// Registro Ham
	RegisterHam(Ham_Spawn,"player","HamSpawnPlayer",1);

}

public pfw_CmdStart(id, pUC, seed)
{
	if( get_pcvar_num(scroll_enabled) != 1 )
		return PLUGIN_CONTINUE;
	
//Empower Code...........
	new iButtons = get_uc(pUC, UC_Buttons);
	
	// just ducked
	if( iButtons & IN_DUCK )
	{
		if( last_stand[id] )
		{
			pev(id,pev_origin,last_origin[id]);
			
			duck_start_time[id] = get_gametime();
			last_stand[id] = false;
		}
		
	}
	// just got up
	else
	{
		if( !last_stand[id] )
		{
			new Float:fGameTime = get_gametime();
			
			// menos tiempo tarda en volver arriba.. mas seguro que sea scroll. <- by empower
			if( (fGameTime-duck_start_time[id]) < 0.015 )
			{
				engfunc(EngFunc_SetOrigin, id, last_origin[id]);
				set_pev(id, pev_bInDuck, false);
				set_pev(id, pev_velocity, 0); //seteamos la velocidad del player en 0
				
				client_print(id, print_center, "Scroll (Ruedita) Detectado!"); // <- deja el scroll!!
				
				FadeScroll(id); //inyectamos el "pantallazo".
			}
		}
		last_stand[id] = true;
	}
	return PLUGIN_HANDLED //<- esto soluciono la baja de fps.. wiii!
}

//Stock definir color de Fade Screen.
stock get_cvar_color( g_pCvar )
{

    new Color[3]

    new szColor[12] // "RRR GGG BBB"
    get_pcvar_string(g_pCvar, szColor, charsmax(szColor))

    new szRed[4], szGreen[4], szBlue[4]
    parse(szColor, szRed, charsmax(szRed), szGreen, charsmax(szGreen), szBlue, charsmax(szBlue))
    Color[0] = clamp(str_to_num(szRed), 0, 255)
    Color[1] = clamp(str_to_num(szGreen), 0, 255)
    Color[2] = clamp(str_to_num(szBlue), 0, 255)

    return Color
}

//Funcion Inyectar Fade Screen.
public FadeScroll(id)
{
	if( get_pcvar_num(screenfade_enabled) != 1 )
		return;
	
	UTIL_ScreenFade(id, get_cvar_color(g_pCvarType), 5.0, 5.0, 255);
	segs[id] = 5;
	
	if( !task_exists(id+TASK_C) ) 
	{
		set_task( 0.1, "FadeHUD", id+TASK_C);
	}
	else
	{
		remove_task(id+TASK_C)
		set_task( 0.1, "FadeHUD", id+TASK_C);
	}
}

//HUD de 5 segundos.
public FadeHUD(taskid)
{
	if ( segs[ID_TASK] < 1 )
		return;

	else
	{
		set_hudmessage(255, 0, 0, 0.48, 0.41, 0, 1.0, 1.0, 0.1, 0.0);
		show_hudmessage(ID_TASK, "[ %i ]", segs[ID_TASK]);
		segs[ID_TASK]--
		set_task( 1.0, "FadeHUD", ID_TASK+TASK_C);
	}
}

//Siempre on, con amx_off!
public plugin_cfg()
{
	//No pausa
	if( is_plugin_loaded("Pause Plugins") != -1 )
		server_cmd("amx_pausecfg add ^"%s^"", PLUGIN);
}

//Spawn Mensaje
//Seteo la variable en true
public client_putinserver(id)
{
	FirstSpawn[id] = true;
}

//Mensaje.. con pequeños creditos. Gracias a Empower por tomar prestado el algoritmo del scroll.	
public HamSpawnPlayer(id)
{
	if( get_pcvar_num(scroll_enabled) == 1 && FirstSpawn[id] )
	{
		FirstSpawn[id] = false;
	}
	
}

/***** Chat Color Stock *****/
	
// CHATCOLOR CODE
stock chatcolor(id, const input[], any:...)
{
    static szMsg[191], msgSayText;
    
    if (!msgSayText)
        msgSayText = get_user_msgid("SayText");
    
    vformat(szMsg, 190, input, 3);

    replace_all(szMsg, 190, "!g", "^4");
    replace_all(szMsg, 190, "!n", "^1");
    replace_all(szMsg, 190, "!t", "^3");
    
    message_begin(id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, msgSayText, .player = id);
    write_byte(id ? id : 33);
    write_string(szMsg);
    message_end();
} 
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2058\\ f0\\ fs16 \n\\ par }
*/

Last edited by strigl10; 05-05-2020 at 05:36.
strigl10 is offline
Reply



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 17:26.


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