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

Round Draw, Freeze Player & Fadescreen


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HaXX0r
Junior Member
Join Date: Apr 2017
Old 04-24-2017 , 02:08   Round Draw, Freeze Player & Fadescreen
Reply With Quote #1

Hey bros,
My situation is like this.
When you join my server you automatic join T only. There is NO CT on my server ever.
The problem is that when you play and a player win the round, it isn't "Terrorists Win" but "Round Draw". This code should Freeze the player who wins, and the screen should fade to almost black.
The problem is that it only freeze player but does not fade screen?

- Thanks

Code:
#include <amxmodx>
#include <fakemeta>

// Message IDs vars
new g_msgScreenFade;

// Others
new ForwardPreThink = 0;	// ID C??? ????????

// Offsets
#define m_Activity 	73
#define ACT_IDLE	(0x1)
#define m_iTeam	114
#define CBASEMONSTER_LINUX_XTRA_OFF	5

/*===============================================================================================================================================
																		[Plugin Init]
================================================================================================================================================*/
public plugin_init() 
{
	register_plugin("Round End TerBlock", "Ver 1.0", "cs 1.6");

	// Events
	register_event("HLTV", "Event_Round_Start", "a", "1=0", "2=0");

	// Message hooks
	register_message(get_user_msgid("TextMsg"), "Message_TextMsg");

	// Message IDs
	g_msgScreenFade = get_user_msgid("ScreenFade");
}

/*===============================================================================================================================================
																		[Message TextMsg]
================================================================================================================================================*/
public Message_TextMsg(msg_id, msg_dest, id)	// ????????? ??????? ? ????? ?????? ? ?????????? ?????????? ???????
{
	// ?????? ??????????
	new textmsg[22];
	
	// ??????? ?????
	get_msg_arg_string(2, textmsg, charsmax(textmsg));

	// ???? ??????? ?????? ?? ????????
	if(!equal(textmsg, "#Terrorists_Win")&& !equal(textmsg, "#Round_Draw"))
		return PLUGIN_CONTINUE;

	// ???? ??????? ?? ???????????????
	if(!ForwardPreThink)
		ForwardPreThink = register_forward(FM_PlayerPreThink, "fw_PlayerPreThink_Pre", 0);	// ???????????? ??????? ? ?????????? ??? ID

	// ?????? ??????????
	new iPlayersNum, Players[32] , id;

	// ????????? ???????, ???? ????? ?????? ? HLTV
	get_players(Players, iPlayersNum, "aeh", "TERRORIST");

	// ???? ?? ???????
	for (new i=0; i < iPlayersNum; i++) 
	{
		// ??????? ID ??????
		id = Players[i];

		// ???? ????? ????????? ?? ?? ???????????
		set_pev(id, pev_gravity, (pev(id, pev_flags) & FL_ONGROUND) ? 999999.9 : 0.000001);	 // ????????? ??????????

		// ?????? IDLE ?????
		set_pdata_int(id, m_Activity, ACT_IDLE, CBASEMONSTER_LINUX_XTRA_OFF);

		// ????????? ?????
		Create_ScreenFade(id, 5000, 26480, 0x0001, 0, 0, 0, 200);
	}

	return PLUGIN_CONTINUE;
}

/*===============================================================================================================================================
																		[Event Round Start]
================================================================================================================================================*/
public Event_Round_Start()
{
	// ???? id ???????????? ????????
	if(ForwardPreThink)
		unregister_forward(FM_PlayerPreThink, ForwardPreThink);	// ?????????? ?????? ????????
	
	// ???????? ID ????????
	ForwardPreThink = 0;
}

/*===============================================================================================================================================
 																	[Player PreThink Pre]
================================================================================================================================================*/
public fw_PlayerPreThink_Pre(id)
{
	// ???? ????? ?? ?????
	if(!is_user_alive(id))
		return FMRES_IGNORED;

	// ???? ????? ?? ?? ??????? ??????
	if(get_pdata_int(id, m_iTeam, CBASEMONSTER_LINUX_XTRA_OFF) != 1)
		return FMRES_IGNORED;

	// ????????? ????????? ??????
	set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.1});

	// ????????? ???????????? ??????
	set_pev(id, pev_maxspeed, 0.1);

	// ????????? ??????????
	set_pev(id, pev_oldbuttons, pev(id, pev_oldbuttons)|IN_DUCK);

	return FMRES_IGNORED;
}

/*===============================================================================================================================================
 																	[Stock]
================================================================================================================================================*/
stock Create_ScreenFade(id, duration, holdtime, flags, r, g, b, alpha)
{
	message_begin(MSG_ONE, g_msgScreenFade, _, id);
	write_short(duration); 	// ????? ??????????
	write_short(holdtime);	 // ????? ???????? ???????????? ??????
	write_short(flags);		// ?????? ??????????
	write_byte (r);	// ColorR
	write_byte (g);	// ColorG
	write_byte (b);	// ColorB
	write_byte (alpha);	// Alpha
	message_end();
}
HaXX0r is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 04-24-2017 , 10:23   Re: Round Draw, Freeze Player & Fadescreen
Reply With Quote #2

R, G, B = 0 ?

You cannot can do that, is the same thing as showing the invisible man..
__________________








CrazY. is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-24-2017 , 13:05   Re: Round Draw, Freeze Player & Fadescreen
Reply With Quote #3

Why not? 0 0 0 is pure black and totally correct when using screen fade. I tested the fade code and it works just fine:



You may have some other plugin that removes the screen fade right when it should happen.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 04-24-2017 , 13:19   Re: Round Draw, Freeze Player & Fadescreen
Reply With Quote #4

Um, well, I've tested but dont worked with me.
__________________








CrazY. is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 04-24-2017 , 13:30   Re: Round Draw, Freeze Player & Fadescreen
Reply With Quote #5

These Russians, only with plugins poorly coded.

PHP Code:
public Message_TextMsg(msg_idmsg_destid)
{
    new 
textmsg[22];
    
get_msg_arg_string(2textmsgcharsmax(textmsg))

    if((
equal(textmsg"#Terrorists_Win")) || (equal(textmsg"#Round_Draw")))
    {
        if(!
ForwardPreThink)
            
ForwardPreThink register_forward(FM_PlayerPreThink"fw_PlayerPreThink_Pre"0);

        new 
iPlayersNumPlayers[32] , id;
        
get_players(PlayersiPlayersNum"aeh""TERRORIST");

        for (new 
iiPlayersNumi++) 
        {
            
id Players[i];

            
set_pev(idpev_gravity, (pev(idpev_flags) & FL_ONGROUND) ? 999999.9 0.000001);    
            
set_pdata_int(idm_ActivityACT_IDLECBASEMONSTER_LINUX_XTRA_OFF);
        }

        
message_begin(MSG_BROADCASTg_msgScreenFade);
        
write_short((1<<10));     
        
write_short((1<<10));
        
write_short((1<<10));        
        
write_byte (0);    
        
write_byte (0);    
        
write_byte (0);    
        
write_byte (200);    
        
message_end();
    }

I don't tested I just removed the stock.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 04-24-2017 at 13:38.
EFFx is offline
Reply


Thread Tools
Display Modes

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 07:59.


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