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();
}