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

Round Draw, Freeze Player & Fadescreen


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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 04:42.


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