Raised This Month: $32 Target: $400
 8% 

Looking For /lr fix


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
UaExFanTasY
Senior Member
Join Date: Mar 2013
Location: UAE
Old 05-26-2019 , 07:53   Looking For /lr fix
Reply With Quote #1

hi to community

i have this problem (Check the Video)

https://www.youtube.com/watch?v=PMyIBt6PbR0


after the new round start the light effect from /lr is still showing up

( im useing jailbreak Extreme by joropito)

and BigHorn_LastRequest.amxx ( by hornet)




Code:
	/*
		<^>
	
		Author 	: hornet
		Plugin 	: JailBreak Final Generation: Last Request
		Version : 0.0.1
		
		<^>
		
		This plugin is free software; you can redistribute it and/or modify it
		under the terms of the GNU General Public License as published by the
		Free Software Foundation; either version 2 of the License, or (at
		your option) any later version.
		
		This plugin is distributed in the hope that it will be useful, but
		WITHOUT ANY WARRANTY; without even the implied warranty of
		MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
		General Public License for more details.
		
		You should have received a copy of the GNU General Public License
		along with this plugin; if not, write to the Free Software Foundation,
		Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
		
		<^>
	*/

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>
#include <engine>
#include <fun>
#include <csx>

#include <colour_print>

#define PLUGIN_INDEPENDANT	0

#include <jailbreak_fg>


#define VERSION			"0.0.1"

#define XO_WEAPON		4
#define m_flNextSecondaryAttack	47
#define m_iClip			51
#define m_pActiveItem		373

#define FBitSet(%0,%1)		( %0 |= ( 1 << ( %1 & 31 ) ) )
#define FBitClear(%0,%1)	( %0 &= ~( 1 << ( %1 & 31 ) ) )
#define FBitGet(%0,%1)		( %0 & ( 1 << ( %1 & 31 ) ) )

new IsInLr;

#define TASK_LASTREQUESTINFO	3001
#define TASK_COUNTDOWN		3002
#define TASK_KILLOPPONENT	3003

enum( += 32 )
{
	TASK_RESETGRENADE =	3050,
	TASK_BEACON
}

#define LR_COUNTDOWN_TIME	7
new const g_szSndCountDown[] = "JailBreak_FG/countdown.wav";

enum
{
	WEAPON_NONE,
	WEAPON_STANDARD,
	WEAPON_SNIPER,
	WEAPON_TOSS
}

enum _:WeaponsData
{
	WeaponName[ 32 ],
	WeaponFlags
}
	
new const g_mWeaponsData[][ WeaponsData ] = 
{
	{ "", 1<<WEAPON_NONE },
	{ "P228", 1<<WEAPON_STANDARD },
	{ "", 1<<WEAPON_NONE },
	{ "Scout", 1<<WEAPON_STANDARD | 1<<WEAPON_SNIPER },
	{ "", 1<<WEAPON_NONE },
	{ "XM1014", 1<<WEAPON_STANDARD },
	{ "", 1<<WEAPON_NONE },
	{ "MAC 10",1<<WEAPON_STANDARD },
	{ "AUG", 1<<WEAPON_STANDARD },
	{ "Smoke Grenade", 1<<WEAPON_TOSS },
	{ "Dual Elites", 1<<WEAPON_STANDARD },
	{ "Five Seven", 1<<WEAPON_STANDARD },
	{ "UMP 45", 1<<WEAPON_STANDARD },
	{ "SG550", 1<<WEAPON_STANDARD | 1<<WEAPON_SNIPER },
	{ "Galil", 1<<WEAPON_STANDARD },
	{ "Famas", 1<<WEAPON_STANDARD },
	{ "USP", 1<<WEAPON_STANDARD },
	{ "Glock 18", 1<<WEAPON_STANDARD },
	{ "AWP", 1<<WEAPON_STANDARD | 1<<WEAPON_SNIPER },
	{ "MP5 Navy", 1<<WEAPON_STANDARD },
	{ "M249", 1<<WEAPON_STANDARD },
	{ "M3", 1<<WEAPON_STANDARD },
	{ "M4A1", 1<<WEAPON_STANDARD },
	{ "TMP", 1<<WEAPON_STANDARD },
	{ "G3SG1", 1<<WEAPON_STANDARD | 1<<WEAPON_SNIPER },
	{ "", 1<<WEAPON_NONE },
	{ "Desert Eagle", 1<<WEAPON_STANDARD | 1<<WEAPON_TOSS },
	{ "SG552", 1<<WEAPON_STANDARD },
	{ "AK47", 1<<WEAPON_STANDARD },
	{ "", 1<<WEAPON_NONE },
	{ "P90", 1<<WEAPON_STANDARD }
}

enum _:LastRequestData
{
	_szName[ 32 ],
	_szFunc[ 32 ],
	bool:_bWeaponMenu,
	_iIndex
}

#define MAX_STANDARD_LASTREQUEST	sizeof( g_mLastRequest )

new const g_mLastRequest[][ LastRequestData ] = 
{
	{ "", "", false, 0 },
	{ "Shot 4 Shot", "LR_Shot4Shot", true, 1 },
	{ "Knife Fight", "LR_KnifeFight", false, 2 },
	{ "Grenade Battle", "LR_GrenadeBattle", false, 3 },
	{ "Weapon Toss", "LR_WeaponToss", true, 4 },
	{ "Classic Shootout", "LR_Shootout", true, 5 },
	{ "Scoutzknivez Duel", "LR_ScoutKnive", false, 6 },
	{ "No Scopers", "LR_NoScopers", true, 7 },
	{ "Maths Challenge", "LR_MathsChallenge", false, 8 }
}

enum
{
	LRGAME_NONE,
	LRGAME_SHOT4SHOT,
	LRGAME_KNIFEFIGHT,
	LRGAME_GRENADEBATTLE,
	LRGAME_WEAPONTOSS,
	LRGAME_SHOOTOUT,
	LRGAME_SCOUTKNIVE,
	LRGAME_NOSCOPERS,
	LRGAME_MATHSCHALLENGE
}

enum
{
	LASTREQUEST_INACTIVE,
	LASTREQUEST_MENU,
	LASTREQUEST_STARTING,
	LASTREQUEST_ACTIVE
}

enum
{
	LR_PRISONER	=	1,
	LR_GUARD
}

enum
{
	TOSS_START,
	TOSS_END
}

enum _:MathQuestion
{
	_iNum[ 2 ],
	bool:_bAdd,
	_iAnswer,
	_szQuestion[ 16 ]
}

	/*
		<^> Cvars.
	*/
	
new g_pLrWait;

	/*
		<^> Forward pointers.
	*/

new HamHook:_CWeaponBox_Touch, HamHook:_CArmoury_Touch, HamHook:_CBasePlayer_TakeDamage, 
	HamHook:_CBasePlayerWeapon_PrimaryAttack;
new _pfnClientKill, _pfnClientDisconnect, _pfnSetModel;

	/*
		<^> Custom Forward Pointers.
	*/
	
new ForwardHandle_LastRequestStart,  ForwardHandle_LastRequestEnd, ForwardHandle_PlayerAttempLastRequest;	

	/*
		<^> Arrays.
	*/
	
new Array:g_aLastRequestData, Array:g_aLastRequestGames, Array:g_aLastRequestMusic;

	/*
		<^> Game Vars.
		
			Note: 	g_iLrGame is reference to game by array.
				g_iLrIndex is reference to the static data set and enum.
	*/

new g_iHudSync[ 4 ], g_iMenuLastRequest, g_iMenuWeapons, g_iMenuSnipers, g_iMenuToss, g_iPrevMenu;
new g_iMsgSayText, _iMsgSayText, g_iMsgCurWeapon, _iMsgCurWeapon;

new g_iLrStatus, g_iLrIndex, g_iLrGame, g_iLrPlayer[ 3 ], g_iCountDown, g_iWeapon, Float:g_flTossDist[ 3 ][ 2 ][ 3 ],
	g_MathQuestion[ MathQuestion ], g_iMaxPlayers;

new Float:g_flRoundStart;

new g_iSpriteWhite;

public plugin_precache()
{
	/*
		<^> Precache sounds.
	*/
	
	precache_sound( g_szSndCountDown );
	
	/*
		<^> Precache sprites.
	*/
	
	g_iSpriteWhite = precache_model( "sprites/white.spr" );
	
	/*
		<^> Precache Last Request music.
	*/
	
	g_aLastRequestMusic = ArrayCreate( 64 );
	
	new szFile[ 64 ];
	get_configsdir( szFile, charsmax( szFile ) );
	
	format( szFile, charsmax( szFile ), "%s/JailBreak FG/Last Request.cfg", szFile );
	
	new iFile = fopen( szFile, "r" );
	
	if( !iFile )
	{
		log_amx( "Failed to find file 'configs/JailBreak FG/Last Request.cfg" );
		return;
	}
	
	new szText[ 64 ];
	
	new bool:bListing;
	
	while( !feof( iFile ) )
	{
		fgets( iFile, szText, charsmax( szText ) );
		trim( szText );
		remove_quotes( szText );
		
		if( szText[ 0 ] == ';' || szText[ 0 ] == '/' || !strlen( szText ) )
			continue;
		
		/*
			<^> Determine which part we're interpreting.
		*/
		
		if( szText[ 0 ] == '[' )
		{
			replace( szText, charsmax( szText ), "[", "" );
			replace( szText, charsmax( szText ), "]", "" );
			
			if( !equal( szText, "Soundtracks" ) )
				bListing = true;
			else	bListing = false;
			
			continue;
		}
		
		/*
			<^> Read the music.
		*/
		
		if( !bListing )
		{
			format( szText, charsmax( szText ), "sound/%s", szText );
			
			if( file_exists( szText ) )
			{
				replace( szText, charsmax( szText ), "sound/", "" );
				ArrayPushString( g_aLastRequestMusic, szText );
				precache_sound( szText );
			}
			else	log_amx( "Failed to load sound %s . Check your Last Request.cfg file.", szText );
		}
	}
	
	fclose( iFile );
}

public plugin_init() 
{
	register_plugin( "JailBreak FG : Last Request", VERSION, "hornet" );
	register_dictionary( "jailbreak_fg.txt" );
	
	g_aLastRequestData = ArrayCreate( LastRequestData );
	g_aLastRequestGames = ArrayCreate( LastRequestData );
	
	for( new i ; i < 4 ; i ++ )
	{
		#if defined PLUGIN_INDEPENDANT
		g_iHudSync[ i ] = CreateHudSyncObj();
		#else
		g_iHudSync[ i ] = HJB_GetHudSyncObject( i );
		#endif
	}
	
	g_pLrWait		= register_cvar( "hjb_lr_wait", "10" );
	
	g_iMsgSayText 		= get_user_msgid( "SayText" );
	g_iMsgCurWeapon 	= get_user_msgid( "CurWeapon" );
	
	g_iMaxPlayers 		= get_maxplayers();
	
	register_logevent( "LogEvent_RoundStart", 2, "1=Round_Start" );
	
	DisableHamForward( _CWeaponBox_Touch = RegisterHam( Ham_Touch, "weaponbox", "CBaseEntity_Touch" ) );
	DisableHamForward( _CArmoury_Touch = RegisterHam( Ham_Touch, "armoury_entity", "CBaseEntity_Touch" ) );
	DisableHamForward( _CBasePlayer_TakeDamage = RegisterHam( Ham_TakeDamage, "player", "CBasePlayer_TakeDamage" ) );
	
	register_touch( "worldspawn", "weaponbox", "CWeaponBox_Touch" );
	register_touch( "worldspawn", "grenade", "CWeaponBox_Touch" );
	
	register_clcmd( "drop", "ClientCommand_Drop" );
	register_clcmd( "say /lr", "ClientCommand_LastRequest" );
	
	ForwardHandle_LastRequestStart = CreateMultiForward( "OnHJB_LastRequestStart", ET_STOP, FP_CELL );
	ForwardHandle_LastRequestEnd = CreateMultiForward( "OnHJB_LastRequestEnd", ET_STOP, FP_CELL );
	ForwardHandle_PlayerAttempLastRequest = CreateMultiForward( "OnHJB_PlayerAttemptLastRequest", ET_STOP, FP_CELL );
	
	set_task( 2.0, "ConfigureLastRequest" );
	set_task( 3.0, "BuildLastRequestMenu" );
	
	BuildWeaponMenus();
}

	/*---------------------------------|
	|	Configurations	 	   |
	|---------------------------------*/

public ConfigureLastRequest()
{
	/*
		<^> Reads the Last Request configuration file.
	*/
	
	new szFile[ 64 ];
	get_configsdir( szFile, charsmax( szFile ) );
	
	formatex( szFile, charsmax( szFile ), "%s/JailBreak FG/Last Request.cfg", szFile );
	
	new iFile = fopen( szFile, "r" );
	
	if( !iFile )
	{
		log_amx( "Failed to find file 'configs/JailBreak FG/Last Request.cfg" );
		return;
	}
	
	new ArrayData[ LastRequestData ];
	
	new szText[ 32 ], iSize;
	
	iSize = ArraySize( g_aLastRequestData );
	
	new bool:bListing;
	
	while( !feof( iFile ) )
	{
		fgets( iFile, szText, charsmax( szText ) );
		trim( szText );
		
		if( szText[ 0 ] == ';' || szText[ 0 ] == '/' || !strlen( szText ) )
			continue;
		
		/*
			<^> Determine which part we're interpreting.
		*/
		
		if( szText[ 0 ] == '[' )
		{
			/*
				<^> Obtain the day of the week.
			*/
			
			replace( szText, charsmax( szText ), "[", "" );
			replace( szText, charsmax( szText ), "]", "" );
			
			if( !strlen( szText ) )
				bListing = true;
			else	bListing = false;
			
			continue;
		}
		
		/*
			<^> Search default data for Last Request.
		*/
		
		if( bListing )
		{
			for( new i ; i < sizeof g_mLastRequest ; i ++ )
			{
				if( equal( szText, g_mLastRequest[ i ][ _szName ] ) )
				{
					ArrayData[ _szName ] = szText;
					copy( ArrayData[ _szFunc ], charsmax( ArrayData[ _szFunc ] ), g_mLastRequest[ i ][ _szFunc ] );
					ArrayData[ _bWeaponMenu ] = g_mLastRequest[ i ][ _bWeaponMenu ];
					ArrayData[ _iIndex ] = g_mLastRequest[ i ][ _iIndex ];
					ArrayPushArray( g_aLastRequestGames, ArrayData );
					
					goto Next;
				}
			}
			
			/*
				<^> Search custom data for Last Request.
			*/
			
			for( new i ; i < iSize ; i ++ )
			{
				ArrayGetArray( g_aLastRequestData, i, ArrayData );
				
				if( equal( szText, ArrayData[ _szName ] ) )
				{
					ArrayPushArray( g_aLastRequestGames, ArrayData );
					
					goto Next;
				}
			}
			
			log_amx( "Failed to load Last Request item %s . Check your Last Request.cfg file.", szText );
			
			Next:
			{
				//
			}
		}
	}
	
	fclose( iFile );
	
	/*
		<^> We're finished with this one so destroy it.
	*/
	
	ArrayDestroy( g_aLastRequestData );
}

public BuildLastRequestMenu()
{
	/*
		<^> Build the Last Request menu. Only once and then use it as many times as we like.
	*/
	
	new szMenu[ 64 ];
	formatex( szMenu, charsmax( szMenu ), "\y%s%L", MENU_TITLE, LANG_SERVER, "MENU_LASTREQUEST" );
	
	g_iMenuLastRequest = menu_create( szMenu, "MenuHandle_LastRequest" );
	
	new ArrayData[ LastRequestData ];
	new szInfo[ 4 ];
	new iSize;
	
	iSize = ArraySize( g_aLastRequestGames );
	
	for( new i ; i < iSize ; i ++ )
	{
		ArrayGetArray( g_aLastRequestGames, i, ArrayData );
		
		num_to_str( ArrayData[ _iIndex ], szInfo, charsmax( szInfo ) );
		menu_additem( g_iMenuLastRequest, ArrayData[ _szName ], szInfo );
	}
}

BuildWeaponMenus()
{
	/*
		<^> Here set up all weapon menus so they are only built once. The data structure
			setup will make this very easy.
	*/
	
	new iSize = sizeof g_mWeaponsData;
	
	new szMenu[ 32 ];
	
	formatex( szMenu, charsmax( szMenu ), "\y%s%L", MENU_TITLE, LANG_SERVER, "MENU_WEAPONS" );
	g_iMenuWeapons = menu_create( szMenu, "MenuHandle_Weapons" );
	
	formatex( szMenu, charsmax( szMenu ), "\y%s%L", MENU_TITLE, LANG_SERVER, "MENU_SNIPERS" );
	g_iMenuSnipers = menu_create( szMenu, "MenuHandle_Weapons" );
	
	formatex( szMenu, charsmax( szMenu ), "\y%s%L", MENU_TITLE, LANG_SERVER, "MENU_TOSS" );
	g_iMenuToss = menu_create( szMenu, "MenuHandle_Weapons" );
	
	new Flags, szName[ 32 ], szInfo[ 4 ];
	
	for( new i = 1 ; i < iSize ; i ++ )
	{
		Flags = g_mWeaponsData[ i ][ WeaponFlags ];
		copy( szName, charsmax( szName ), g_mWeaponsData[ i ][ WeaponName ] );
		
		num_to_str( i, szInfo, charsmax( szInfo ) );
	
		if( Flags & 1<<WEAPON_STANDARD )
			menu_additem( g_iMenuWeapons, szName, szInfo );
			
		if( Flags & 1<<WEAPON_SNIPER )
			menu_additem( g_iMenuSnipers, szName, szInfo );
			
		if( Flags & 1<<WEAPON_TOSS )
			menu_additem( g_iMenuToss, szName, szInfo );
	}
	
	menu_setprop( g_iMenuWeapons, MPROP_EXITNAME, "Previous" );
	menu_setprop( g_iMenuSnipers, MPROP_EXITNAME, "Previous" );
	menu_setprop( g_iMenuToss, MPROP_EXITNAME, "Previous" );
}

	/*---------------------------------|
	|		Events	 	   |
	|---------------------------------*/
	
public LogEvent_RoundStart()
{
	g_flRoundStart = get_gametime() + 3.0;
	
	g_iLrStatus = LASTREQUEST_INACTIVE;
}

	/*---------------------------------|
	|		Messages	   |
	|---------------------------------*/
	
public Message_SayText( msgId, iDest, id )
{
	if( FBitGet( IsInLr, id ) )
	{
		new szText[ 6 ];
		get_msg_arg_string( 4, szText, charsmax( szText ) );
		
		if( str_to_num( szText ) == g_MathQuestion[ _iAnswer ] )
		{
			/*
				<^> Unregister the message and set a task to kill opponent
					otherwise the server will crash due to sending messages
					in between other messages.
			*/
			
			set_task( 0.1, "Task_KillOpponent", id + TASK_KILLOPPONENT );
			
			unregister_message( g_iMsgSayText, _iMsgSayText );
		}
	}
}

public Message_CurWeapon( msgId, iDest, id )
{
	if( FBitGet( IsInLr, id ) )
	{
		new iEnt = get_pdata_cbase( id, m_pActiveItem );
		
		if( pev_valid( iEnt ) )
			set_pdata_float( iEnt, m_flNextSecondaryAttack, get_gametime() + 9999.0, XO_WEAPON );
	}
}


	/*---------------------------------|
	|	HJB Forwards		   |
	|---------------------------------*/
	
public OnHJB_PlayerKilled( id )
{
	if( FBitGet( IsInLr, id ) && g_iLrStatus != LASTREQUEST_INACTIVE )
	{
		/*
			<^> Not going to use iKiller param here because the challenger may have
				died some way other than been killed by his opponent.
		*/
		
		new iOp = GetLrOpponent( id );
		
		if( g_iLrIndex == LRGAME_SCOUTKNIVE )
			set_user_gravity( iOp, 1.0 );
		
		/*
			<^> If the guard died then reset weapons for the prisoner.
		*/
		
		if( cs_get_user_team( id ) == CS_TEAM_CT )
		{
			strip_user_weapons( iOp );
			give_item( iOp, "weapon_knife" );
		}
		
		/*
			<^> Handle all other things.
		*/
		
		LastRequestEnd();
	}
}
	
public OnHJB_UseItem( id, iItemIndex )
{
	/*
		<^> This forward is only relevant if your using my Items handling plugin.
	*/
	
	/*
		<^> This will disallow players to use an item if they are currently
			taking part in Last Request.
	*/
	
	if( FBitGet( IsInLr, id ) )
		return PLUGIN_HANDLED;
		
	return PLUGIN_CONTINUE;
}

public OnHJB_ResetMaxSpeed( id )
{
	/*
		<^> This forward is only relevant if your using my Items handling plugin.
	*/
	
	/*
		<^> This will disallow players speed to be changed if they are currently
			taking part in Last Request.
	*/
	
	if( FBitGet( IsInLr, id ) )
		return PLUGIN_HANDLED;
		
	return PLUGIN_CONTINUE;
}
	
public OnHJB_DeployKnife( id )
{
	if( FBitGet( IsInLr, id ) )
		return PLUGIN_HANDLED;
		
	return PLUGIN_CONTINUE;
}
	
public OnHJB_ItemInteraction( id )
{
	/*
		<^> This forward is only relevant if your using my Items handling plugin.
	*/
	
	if( FBitGet( IsInLr, id ) )
		return PLUGIN_HANDLED;
		
	return PLUGIN_CONTINUE;
}

public OnHJB_PlayerMenuOpened( id )
{
	/*
		<^> Prevent players from using player related menus.
	*/
	
	if( FBitGet( IsInLr, id ) )
		return PLUGIN_HANDLED;
		
	return PLUGIN_CONTINUE;
}

	/*---------------------------------|
	|	Fakemeta Forwards	   |
	|---------------------------------*/ 
	
public pfnClientKill( id )
{
	/*
		<^> Here we will prevent players from killing themself during Last Request.
			Otherwise they WILL try just to see if they can find an exploit.
					*Aint gonna happen*
	*/
	
	if( FBitGet( IsInLr, id ) && g_iLrStatus != LASTREQUEST_ACTIVE )
	{
		console_print( id, "%L", LANG_SERVER, "LASTREQUEST_NO_SUICIDE" );
		
		return FMRES_SUPERCEDE;
	}
	
	return FMRES_IGNORED;
}

public CBasePlayerWeapon_PrimaryAttack( iEnt )
{
	if( pev_valid( iEnt ) )
	{
		new id = pev( iEnt, pev_owner );
		{
			if( FBitGet( IsInLr, id ) )
			{
				if( cs_get_weapon_ammo( get_pdata_cbase( id, m_pActiveItem ) ) )
				{
					new iOp = GetLrOpponent( id )
					
					cs_set_weapon_ammo( get_pdata_cbase( iOp, m_pActiveItem ), 1 );
					UTIL_SendWeaponAnim( iOp, 0 );
				}
			}
		}
	}
}

public pfnClientDisconnect( id )
{
	/*
		<^> Enable our own disconnect forward to control Last Request ending if a player
			leaves the server when in the middle of a Last Request Game.
	*/
	
	if( FBitGet( IsInLr, id ) )
	{
		new iOp =  GetLrOpponent( id );
		
		strip_user_weapons( iOp );
		give_item( iOp, "weapon_knife" );
		
		set_user_godmode( iOp, 0 );
		set_user_gravity( iOp, 1.0 );
		
		LastRequestEnd();
	}
}

public pfnSetModel( iEnt, szModel[] )
{
	if( pev_valid( iEnt ) )
	{
		new id = pev( iEnt, pev_owner );
		
		if( FBitGet( IsInLr, id ) && g_iLrStatus == LASTREQUEST_ACTIVE )
		{
			switch( g_iLrIndex )
			{
				case LRGAME_GRENADEBATTLE:
				{
					/*
						<^> Detect when a HE grenade is thrown so we can 
							then give another one back to the player
							during Grenade Battle game.
					*/
					
					if( equal( szModel, "models/w_hegrenade.mdl" ) )
						set_task( 3.0, "Task_ResetGrenade", id + TASK_RESETGRENADE );
				}
			}					
		}
	}
}

	/*---------------------------------|
	|	Ham Forwards		   |
	|---------------------------------*/
	
public CBaseEntity_Touch( iEnt, id )
{
	/*
		<^> Blocks all weapon pickups for Last Request players.
	*/
	
	if( FBitGet( IsInLr, id ) )
	{
		return HAM_SUPERCEDE;
	}
	
	return HAM_IGNORED;
}

public CWeaponBox_Touch( iTouched, iEnt )
{
	/*
		<^> This engine forward will only be called once each time a player drops his weapon
			or when a grenade hits a wall. So it is acceptable to use this instead of 
			Ham / FM where we could disable / unregister it.
	*/

	new id = pev( iEnt, pev_owner );
	
	if( FBitGet( IsInLr, id ) && g_iLrStatus == LASTREQUEST_ACTIVE && g_iLrIndex == LRGAME_WEAPONTOSS && !pev( iEnt, pev_iuser1 ) )
	{	
		set_pev( iEnt, pev_iuser1, 1 );
		
		new iTeam = get_user_team( id );
		
		pev( iEnt, pev_origin, g_flTossDist[ iTeam ][ TOSS_END ] );
			
		/*
			<^> Remove vertical distance from calculation.
		*/
			
		g_flTossDist[ iTeam ][ TOSS_END ][ 2 ] = g_flTossDist[ iTeam ][ TOSS_START ][ 2 ];
			
		/* 
			<^>
		*/
			
		new Float:flDistance = vector_distance( g_flTossDist[ iTeam ][ TOSS_START ], g_flTossDist[ iTeam ][ TOSS_END ] );
		
		Print( 0, iTeam, "%L", LANG_SERVER, "LRGAME_TOSS_SCORE", GetUserName( id ), floatround( flDistance ) );
		
		/*
			<^> Check to see if the opponent has made a score yet.
		*/
		
		new iOp = GetLrOpponent( id );
		new iOpTeam = get_user_team( iOp );
		
		if( g_flTossDist[ iOpTeam ][ TOSS_END ][ 0 ] )
		{
			/*
				<^> Compare scores and determine the winner.
					The loser can be killed and all other Last Request vars
					will be handled in Killed().
			*/
			
			new Float:flOpDistance = vector_distance( g_flTossDist[ iOpTeam ][ TOSS_START ], g_flTossDist[ iOpTeam ][ TOSS_END ] );
			
			new iWinner;
			
			if( flDistance > flOpDistance )
				iWinner = id;
			else	iWinner = iOp;
			
			ExecuteHamB( Ham_Killed, GetLrOpponent( iWinner ), iWinner, 0 );
		}
	}
}
	
public CBasePlayer_TakeDamage( iVictim, iEnt, iAttacker, Float:flDamage, Bits )
{
	if( 1 <= iAttacker <= g_iMaxPlayers )
	{
		switch( g_iLrStatus )
		{
			case LASTREQUEST_MENU:
			{
				/*
					<^> End LR if the choosing player attacks a Guard.
				*/
				
				if( cs_get_user_team( iVictim ) == CS_TEAM_CT && cs_get_user_team( iAttacker ) == CS_TEAM_T )
				{
					menu_cancel( iAttacker );
					show_menu( iAttacker, 0, "^n" );
					
					client_cmd( 0, "stopsound" );
					LastRequestEnd();
				}
			}
			
			case LASTREQUEST_ACTIVE:
			{
				/*
					<^> Prevent damage from LR challenger and vice versa.
				*/
				
				if( ( FBitGet( IsInLr, iAttacker ) && !FBitGet( IsInLr, iVictim ) ) || ( !FBitGet( IsInLr, iAttacker ) && FBitGet( IsInLr, iVictim ) ) )
					return HAM_SUPERCEDE;
			}
		}
	}
	
	return HAM_IGNORED;
}
	
	/*---------------------------------|
	|	Client Commands		   |
	|---------------------------------*/
	
public ClientCommand_Drop( id )
{
	/* 
		<^> Prevent Last Request players from dropping their weapons unless they are
			in weapon toss game.
	*/
	
	if( FBitGet( IsInLr, id ) )
	{
		if( g_iLrIndex == LRGAME_WEAPONTOSS && g_iLrStatus == LASTREQUEST_ACTIVE )
		{
			pev( id, pev_origin, g_flTossDist[ get_user_team( id ) ][ TOSS_START ] );
		}
		else 	return PLUGIN_HANDLED;
	}
		
	return PLUGIN_CONTINUE;
}
	
public ClientCommand_LastRequest( id )
{
	/*
		<^> Basic conditions in which a player can or cannot use the Last Request command.
	*/
	
	if( !is_user_alive( id ) )
	{
		Print( id, RED, "!t%L", id, "LASTREQUEST_MUST_BE_ALIVE" );
		return;
	}
	
	if( g_iLrStatus != LASTREQUEST_MENU && g_iLrStatus != LASTREQUEST_INACTIVE ) 
	{
		Print( id, RED, "!t%L", id, "LASTREQUEST_ALREADY_ACTIVE" );
		return;
	}
	
	if( cs_get_user_team( id ) != CS_TEAM_T )
	{
		Print( id, RED, "!t%L", id, "LASTREQUEST_MUST_BE_PRISONER" );
		return;
	}
	
	if( GetRoundTime() < get_pcvar_float( g_pLrWait ) )
	{
		Print( id, RED, "!t%L", id, "LASTREQUEST_MUST_WAIT" );
		return;
	}
		
	new Players[ 32 ], iNum;
	get_players( Players, iNum, "ae", "TERRORIST" );
	
	if( iNum > 1 )
	{
		Print( id, RED, "%L", id, "LASTREQUEST_NOT_LAST_PRISONER" );
		return;
	}
		
	get_players( Players, iNum, "ae", "CT" );
	
	if( !iNum )
	{
		Print( id, BLUE, "%L", id, "LASTREQUEST_NO_GUARDS_PRESENT" );
		return;
	}
	
	new iReturn;
	ExecuteForward( ForwardHandle_PlayerAttempLastRequest, iReturn, id );
	
	/*
		<^> Allow other plugins to prevent use of Last Request.
	*/
	
	if( iReturn )
		return;
	
	if( g_iLrStatus != LASTREQUEST_MENU )
	{
		/*
			<^> This will occur when a player brings up Last Request Menu.
		*/
		
		g_iLrStatus = LASTREQUEST_MENU;
	
		g_iLrPlayer[ LR_PRISONER ] = id;
		FBitSet( IsInLr, id );
	
		_pfnClientKill = register_forward( FM_ClientKill, "pfnClientKill" );
		_pfnClientDisconnect = register_forward( FM_ClientDisconnect, "pfnClientDisconnect" );
	
		Task_LastRequestInfo();
		
		/*
			<^> Play Last Request music.
		*/
		
		new iSize = ArraySize( g_aLastRequestMusic );
		
		if( iSize )
		{
			new szSound[ 64 ];
			ArrayGetString( g_aLastRequestMusic, random_num( 0, iSize - 1 ), szSound, charsmax( szSound ) );
			
			client_cmd( 0, "speak ^"%s^"", szSound );
		}
	}
	
	EnableHamForward( _CBasePlayer_TakeDamage );
	
	/*
		<^> However this will occur if the user tries to bring up the Last Request Menu
			again because it may disappear for some other reason such as votemap etc.
	*/
	
	menu_setprop( g_iMenuLastRequest, MPROP_EXIT, MEXIT_NEVER );
	menu_display( id, g_iMenuLastRequest );
}

	/*---------------------------------|
	|		Tasks		   |
	|---------------------------------*/
	
public Task_LastRequestInfo()
{
	static szMsg[ 128 ], ArrayData[ LastRequestData ];
	
	switch( g_iLrStatus )
	{
		case LASTREQUEST_INACTIVE:
		{
			return;
		}
		
		case LASTREQUEST_MENU:
		{
			formatex( szMsg, charsmax( szMsg ), "%L", LANG_SERVER, "LASTREQUEST_CHOOSING", GetUserName( g_iLrPlayer[ LR_PRISONER ] ) );
		}
		
		case LASTREQUEST_STARTING:
		{
			ArrayGetArray( g_aLastRequestGames, g_iLrIndex - 1, ArrayData );
			formatex( szMsg, charsmax( szMsg ), "%L", LANG_SERVER, "LASTREQUEST_STARTING", ArrayData[ _szName ], GetUserName( g_iLrPlayer[ LR_PRISONER ] ), GetUserName( g_iLrPlayer[ LR_GUARD ] ), g_iCountDown );
		}
		
		case LASTREQUEST_ACTIVE:
		{
			ArrayGetArray( g_aLastRequestGames, g_iLrIndex - 1, ArrayData );
			formatex( szMsg, charsmax( szMsg ), "%L", LANG_SERVER, "LASTREQUEST_ACTIVE", ArrayData[ _szName ], GetUserName( g_iLrPlayer[ LR_PRISONER ] ), GetUserName( g_iLrPlayer[ LR_GUARD ] ) );
		
			if( g_iLrIndex == LRGAME_MATHSCHALLENGE )
			{
				formatex( szMsg, charsmax( szMsg ), "%s^n^n%s", szMsg, g_MathQuestion[ _szQuestion ] );
			}
		}
	}
	
	set_hudmessage( 255, 128, 0, -1.0, 0.2, 0, 0.01, 0.6 );
	ShowSyncHudMsg( 0, g_iHudSync[ HS_MESSAGE ], szMsg );
	
	set_task( 0.5, "Task_LastRequestInfo", TASK_LASTREQUESTINFO );
}

public Task_ResetGrenade( id )
{
	/*
		<^> Gives a grenade back to the player in Grenade Battle game.
	*/
	
	id -= TASK_RESETGRENADE;
	
	if( FBitGet( IsInLr, id ) )
	{
		strip_user_weapons( id );
		
		give_item( id, "weapon_hegrenade" );
	}
}

public Task_KillOpponent( id )
{
	/*
		<^> Kills the opponent during Maths Challenge game.
	*/
	
	id -= TASK_KILLOPPONENT;
	
	ExecuteHamB( Ham_Killed, id, GetLrOpponent( id ), 0 );
}

public Task_Beacon( id )
{
	id -= TASK_BEACON;
	
	if( is_user_alive( id ) )
	{
		emit_sound( id, CHAN_AUTO, "buttons/blip2.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
		
		switch( cs_get_user_team( id ) )
		{
			case CS_TEAM_T: 	UTIL_BeamCylinder( id, g_iSpriteWhite, 1, 6, 10, 1, 255, 0, 0, 255, 0 );
			case CS_TEAM_CT:	UTIL_BeamCylinder( id, g_iSpriteWhite, 1, 6, 10, 1, 0, 128, 255, 255, 0 );
		}
	}
}

	/*---------------------------------|
	|		Menus		   |
	|---------------------------------*/
	
public MenuHandle_LastRequest( id, iMenu, iItem, bool:JumpToPlayersMenu )
{
	/*
		<^> Retrieve the real array index for the Last Request Game chosen because the
			server admin may have some games disabled.
	*/
	
	if( iItem == MENU_EXIT )
		return;
	
	if( JumpToPlayersMenu )
		goto PlayersMenu;
	
	g_iPrevMenu = iMenu;
	
	new ArrayData[ LastRequestData ];
	ArrayGetArray( g_aLastRequestGames, iItem, ArrayData );
	
	g_iLrGame = iItem;
	g_iLrIndex = ArrayData[ _iIndex ];
	
	if( ArrayData[ _bWeaponMenu ] )
	{
		/*
			<^> Display our submenu here.
		*/
		
		switch( g_iLrIndex )
		{
			case LRGAME_SHOT4SHOT, LRGAME_SHOOTOUT:
			{
				menu_display( id, g_iMenuWeapons );
			}
			
			case LRGAME_NOSCOPERS:	
			{
				
				menu_display( id, g_iMenuSnipers );
			}
			
			case LRGAME_WEAPONTOSS:	
			{	
				menu_display( id, g_iMenuToss );
			}
		}
	}
	else
	{
		/*
			<^> This chunk is setup like so to not require its own public function
		*/
		
		PlayersMenu:
		
		/*
			<^> If no submenu is to be shown then bring up the players menu.
		*/
		
		new Players[ 32 ], iNum, iPlayer;

		get_players( Players, iNum, "ae", "CT" );
		
		new szMenu[ 32 ], szInfo[ 4 ];
		formatex( szMenu, charsmax( szMenu ), "\y%s%L", MENU_TITLE, LANG_SERVER, "MENU_OPPONENT" );
		
		iMenu = menu_create( szMenu, "MenuHandle_Opponent" );
		
		for( new i ; i < iNum ; i ++ )
		{
			iPlayer = Players[ i ];
			
			num_to_str( get_user_userid( iPlayer ), szInfo, charsmax( szInfo ) );
			menu_additem( iMenu, GetUserName( iPlayer ), szInfo );
		}
		
		menu_setprop( iMenu, MPROP_EXITNAME, "Previous" );
		menu_display( id, iMenu );
	}
}

public MenuHandle_Weapons( id, iMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		menu_display( id, g_iMenuLastRequest );
		return;
	}
	
	g_iPrevMenu = iMenu;
	
	new szInfo[ 4 ];
	new _access, _callback;
	
	menu_item_getinfo( iMenu, iItem, _access, szInfo, charsmax( szInfo ), _, _, _callback );
	
	g_iWeapon = str_to_num( szInfo );
	
	/*
		<^> This is setup so we can bring up the players menu directly from that function
	*/
	
	MenuHandle_LastRequest( id, 0, 0, true );
}

public MenuHandle_Opponent( id, iMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		menu_display( id, g_iPrevMenu );
		return;
	}
	
	/*
		<^> Find our opponent by userid. Don't use player index because during the time
			that the player is choosing someone, the opponent could disconnect and 
			someone else take his place by mistake.
	*/
	
	new szInfo[ 6 ];
	new _access, _callback;
	
	menu_item_getinfo( iMenu, iItem, _access, szInfo, charsmax( szInfo ), _, _, _callback );
	
	new iTarget = find_player( "k", str_to_num( szInfo ) );
	
	if( !iTarget )
	{
		client_print( id, print_center, "%L", LANG_SERVER, "PLAYER_HAS_DISCONNECTED" );
		MenuHandle_LastRequest( id, 0, 0, true );
		
		return;
	}
	
	/*
		<^> Prepare player ids and countdown.
	*/
	
	set_user_godmode( id, 1 );
	set_user_godmode( iTarget, 1 );
	
	set_user_health( id, 100 );
	set_user_health( iTarget, 100 );
	
	FBitSet( IsInLr, iTarget );
	
	g_iLrPlayer[ LR_PRISONER ] = id;
	g_iLrPlayer[ LR_GUARD ] = iTarget;
	
	g_iLrStatus = LASTREQUEST_STARTING;
	g_iCountDown = LR_COUNTDOWN_TIME;
	
	set_task( 1.0, "CountDown", TASK_COUNTDOWN, _, _, "b" );
	
	client_cmd( 0, "stopsound" );
	client_cmd( 0, "spk %s", g_szSndCountDown );
	
	/*
		<^> Enable all forwards that we require to run Last Request. They have been
			left disabled until now to save cpu.
	*/
		
	EnableHamForward( _CWeaponBox_Touch );
	EnableHamForward( _CArmoury_Touch );
}

	/*	COUNTDOWN	*/
	
public CountDown()
{
	g_iCountDown --;
	
	if( g_iCountDown <= 0 )
	{
		g_iLrStatus = LASTREQUEST_ACTIVE;
		
		/*
			<^> Users in Last Request will have godmode during starting period
				until now.
		*/
		
		set_user_godmode( g_iLrPlayer[ LR_PRISONER ], 0 );
		set_user_godmode( g_iLrPlayer[ LR_GUARD ], 0 );
		
		/*
			<^> Each Last Request game's specific function does everything but strip
				the player's weapons.
		*/
		
		strip_user_weapons( g_iLrPlayer[ LR_PRISONER ] );
		strip_user_weapons( g_iLrPlayer[ LR_GUARD ] );
		
		/*
			<^> Reset the player's speed.
		*/
		
		ExecuteHam( Ham_CS_Player_ResetMaxSpeed, g_iLrPlayer[ LR_PRISONER ] );
		ExecuteHam( Ham_CS_Player_ResetMaxSpeed, g_iLrPlayer[ LR_GUARD ] );
		
		/*
			<^> Execute the function specific to the Last Request game.
				Also remove the countdown task.
		*/
		
		new ArrayData[ LastRequestData ];
		ArrayGetArray( g_aLastRequestGames, g_iLrGame, ArrayData );
		
		new iReturn;
		ExecuteForward( ForwardHandle_LastRequestStart, iReturn, ArrayData[ _iIndex ] );
		
		if( strlen( ArrayData[ _szFunc ] ) )
			set_task( 0.1, ArrayData[ _szFunc ] );
		
		remove_task( TASK_COUNTDOWN );
		
		set_task( 3.0, "Task_Beacon", g_iLrPlayer[ LR_PRISONER ] + TASK_BEACON, _, _, "b" );
		set_task( 3.0, "Task_Beacon", g_iLrPlayer[ LR_GUARD ]  + TASK_BEACON, _, _, "b" );
	}
}

	/*---------------------------------|
	|	Last Request Games	   |
	|---------------------------------*/
	
public LR_Shot4Shot()
{
	new szWeapon[ 32 ];
	get_weaponname( g_iWeapon, szWeapon, charsmax( szWeapon ) );
	
	cs_set_weapon_ammo( give_item( g_iLrPlayer[ LR_PRISONER ], szWeapon ), 1 );
	cs_set_weapon_ammo( give_item( g_iLrPlayer[ LR_GUARD ], szWeapon ), 0 );
	
	_CBasePlayerWeapon_PrimaryAttack = RegisterHam( Ham_Weapon_PrimaryAttack, szWeapon, "CBasePlayerWeapon_PrimaryAttack" );
}

public LR_KnifeFight()
{
	give_item( g_iLrPlayer[ LR_PRISONER ], "weapon_knife" );
	give_item( g_iLrPlayer[ LR_GUARD ], "weapon_knife" );
}

public LR_GrenadeBattle()
{
	give_item( g_iLrPlayer[ LR_PRISONER ], "weapon_hegrenade" );
	give_item( g_iLrPlayer[ LR_GUARD ], "weapon_hegrenade" );
	
	_pfnSetModel = register_forward( FM_SetModel,"pfnSetModel" );
}

public LR_WeaponToss()
{
	/*
		<^> Keep a loose approach here, so the thrown gun can be changed to some other gun.
	*/
	
	if( g_iWeapon == CSW_SMOKEGRENADE )
	{
		give_item( g_iLrPlayer[ LR_PRISONER ], "weapon_smokegrenade" );
		give_item( g_iLrPlayer[ LR_GUARD ], "weapon_smokegrenade" );
	}
	else
	{
		new szWeapon[ 32 ];
		get_weaponname( g_iWeapon, szWeapon, charsmax( szWeapon ) );
		
		cs_set_weapon_ammo( give_item( g_iLrPlayer[ LR_PRISONER ], szWeapon ), 0 );
		cs_set_weapon_ammo( give_item( g_iLrPlayer[ LR_GUARD ], szWeapon ), 0 );
	}
	
	/*
		<^> Remove owned entities so they don't interfer.
	*/
	
	new iEnt, iOwner;
	
	while( ( iEnt = find_ent_by_class( iEnt, "weaponbox" ) ) )
	{
		iOwner = pev( iEnt, pev_owner );
		
		if( iOwner == g_iLrPlayer[ LR_GUARD ] || iOwner == g_iLrPlayer[ LR_PRISONER ] )
			remove_entity( iEnt );
	}
	
	/*
		<^> Reset toss array.
	*/
	
	for( new i = 1 ; i < 3 ; i ++ )
	{
		for( new j ; j < 3 ; j ++ )
		{
			g_flTossDist[ i ][ TOSS_START ][ j ] = 0.0;
			g_flTossDist[ i ][ TOSS_END ][ j ] = 0.0;
		}
	}
}

public LR_Shootout()
{
	new szWeapon[ 32 ];
	get_weaponname( g_iWeapon, szWeapon, charsmax( szWeapon ) );
	
	give_item( g_iLrPlayer[ LR_PRISONER ], szWeapon );
	give_item( g_iLrPlayer[ LR_GUARD ], szWeapon );
	
	cs_set_user_bpammo( g_iLrPlayer[ LR_PRISONER ], g_iWeapon, 999 );
	cs_set_user_bpammo( g_iLrPlayer[ LR_GUARD ], g_iWeapon, 999 );
}

public LR_ScoutKnive()
{
	give_item( g_iLrPlayer[ LR_PRISONER ], "weapon_knife" );
	give_item( g_iLrPlayer[ LR_GUARD ], "weapon_knife" );
	
	give_item( g_iLrPlayer[ LR_PRISONER ], "weapon_scout" );
	give_item( g_iLrPlayer[ LR_GUARD ], "weapon_scout" );
	
	cs_set_user_bpammo( g_iLrPlayer[ LR_PRISONER ], CSW_SCOUT, 90 );
	cs_set_user_bpammo( g_iLrPlayer[ LR_GUARD ], CSW_SCOUT, 90 );
	
	set_user_gravity( g_iLrPlayer[ LR_PRISONER ], 0.3125 );	//FIX ?
	set_user_gravity( g_iLrPlayer[ LR_GUARD], 0.3125 );
}

public LR_NoScopers()
{
	new szWeapon[ 32 ];
	get_weaponname( g_iWeapon, szWeapon, charsmax( szWeapon ) );
	
	new iEnt;
	
	/*
		<^> Prevent scoping.
	*/
	
	iEnt = give_item( g_iLrPlayer[ LR_PRISONER ], szWeapon );
	set_pdata_float( iEnt, m_flNextSecondaryAttack, get_gametime() + 9999.0, XO_WEAPON );
	
	iEnt = give_item( g_iLrPlayer[ LR_GUARD ], szWeapon );
	set_pdata_float( iEnt, m_flNextSecondaryAttack, get_gametime() + 9999.0, XO_WEAPON );
	
	/*
		<^>
	*/
	
	cs_set_user_bpammo( g_iLrPlayer[ LR_PRISONER ], g_iWeapon, 999 );
	cs_set_user_bpammo( g_iLrPlayer[ LR_GUARD ], g_iWeapon, 999 );
	
	_iMsgCurWeapon = register_message( g_iMsgCurWeapon, "Message_CurWeapon" );
}

public LR_MathsChallenge()
{
	g_MathQuestion[ _iNum ][ 0 ] = random_num( 50, 100 );
	g_MathQuestion[ _iNum ][ 1 ] = random_num( 1, 50 );
	g_MathQuestion[ _bAdd ] = random_num( 0, 1 ) ? true : false;
	g_MathQuestion[ _iAnswer ] = g_MathQuestion[ _bAdd ] ? g_MathQuestion[ _iNum ][ 0 ] + g_MathQuestion[ _iNum ][ 1 ] : g_MathQuestion[ _iNum ][ 0 ] - g_MathQuestion[ _iNum ][ 1 ];
	
	formatex( g_MathQuestion[ _szQuestion ], charsmax( g_MathQuestion[ _szQuestion ] ), "%i %s %i = ?", g_MathQuestion[ _iNum ][ 0 ], g_MathQuestion[ _bAdd ] ? "+" : "-", g_MathQuestion[ _iNum ][ 1 ] );
	
	_iMsgSayText = register_message( g_iMsgSayText, "Message_SayText" );
}

	/*---------------------------------|
	|		Stocks		   |
	|---------------------------------*/
	
Float:GetRoundTime()
{
	return get_gametime() - g_flRoundStart;
}

GetLrOpponent( id )
{
	return ( id == g_iLrPlayer[ LR_PRISONER ] ? g_iLrPlayer[ LR_GUARD ] : g_iLrPlayer[ LR_PRISONER ] );
}

GetLrWinner()
{
	return ( is_user_alive( g_iLrPlayer[ LR_PRISONER ] ) ? g_iLrPlayer[ LR_PRISONER ] : g_iLrPlayer[ LR_GUARD ] );
}

GetUserName( id )
{
	static szName[ 32 ];
	get_user_name( id, szName, charsmax( szName ) );
	
	return szName;
}
	
LastRequestEnd()
{
	/*
		<^> This will be called when one of our Last Request challengers is killed. It will
			take care of everything from here, apart from removing the IsInLr Bit.
	*/
	
	DisableHamForward( _CWeaponBox_Touch );
	DisableHamForward( _CArmoury_Touch );
	DisableHamForward( _CBasePlayer_TakeDamage );
	
	remove_task( TASK_COUNTDOWN );
	
	switch( g_iLrIndex )
	{
		case LRGAME_SHOT4SHOT:
		{
			DisableHamForward( _CBasePlayerWeapon_PrimaryAttack );
		}
			
		case LRGAME_GRENADEBATTLE:
		{
			unregister_forward( FM_SetModel, _pfnSetModel );
			
			remove_task( TASK_RESETGRENADE + g_iLrPlayer[ LR_PRISONER ] );
			remove_task( TASK_RESETGRENADE + g_iLrPlayer[ LR_GUARD ] );
			
			/*
				<^> Remove any grenades that may still be active to prevent guards
					from getting hurt after Last Request game is over.
			*/
			
			new iEnt, szModel[ 32 ];
			
			while( ( iEnt = find_ent_by_class( iEnt, "weapon_hegrenade" ) ) )
			{
				if( FBitGet( IsInLr, pev( iEnt, pev_owner ) ) )
				{
					pev( iEnt, pev_model, szModel, charsmax( szModel ) );
					
					if( equal( szModel, "models/w_hegrenade.mdl" ) )
						remove_entity( iEnt );
				}
			}
		}
		
		case LRGAME_NOSCOPERS:
		{
			unregister_message( g_iMsgCurWeapon, _iMsgCurWeapon );
		}
	}
	
	/*
		<^> Show win message.
	*/
	
	
	new iWinner = GetLrWinner();
	new iLoser = GetLrOpponent( iWinner );
	
	if( is_user_connected( iLoser ) )
	{
		new szName[ 2 ][ 32 ];
		get_user_name( iWinner, szName[ 0 ], charsmax( szName[] ) );
		get_user_name( iLoser, szName[ 1 ], charsmax( szName[] ) );
		
		Print( 0, get_user_team( iWinner ), "%L", LANG_SERVER, "LASTREQUEST_PLAYER_DEFEATED", szName[ 0 ], szName[ 1 ] );
	}
	
	/*
		<^> Clear Bits and reset the global vars.
	*/
	
	remove_task( g_iLrPlayer[ LR_PRISONER ] + TASK_BEACON );
	remove_task( g_iLrPlayer[ LR_GUARD ] + TASK_BEACON );
	
	FBitClear( IsInLr, g_iLrPlayer[ LR_PRISONER ] );
	FBitClear( IsInLr, g_iLrPlayer[ LR_GUARD ] );
	
	g_iLrPlayer[ LR_PRISONER ] = 0;
	g_iLrPlayer[ LR_GUARD ] = 0;
	
	g_iLrGame = LRGAME_NONE;
	g_iLrIndex = LRGAME_NONE;
	g_iLrStatus = LASTREQUEST_INACTIVE;
	
	/*
		<^> Disable and unregister all forwards that are always used for Last Request.
	*/
	
	unregister_forward( FM_ClientKill, _pfnClientKill );
	unregister_forward( FM_ClientDisconnect, _pfnClientDisconnect );
	
	/*
		<^> Notify all plugins that Last Request has ended.
	*/
	
	new iReturn;
	ExecuteForward( ForwardHandle_LastRequestEnd, iReturn, iReturn );
}
	
UTIL_BeamCylinder( iEnt, iSprite, iFramerate, iLife, iWidth, iAmplitude, iRed, iGreen, iBlue, iBright, iSpeed )
{
	new Float:vOrigin[ 3 ];
	pev( iEnt, pev_origin, vOrigin );
	
	message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
	write_byte( TE_BEAMCYLINDER );
	engfunc( EngFunc_WriteCoord, vOrigin[ 0 ] );
	engfunc( EngFunc_WriteCoord, vOrigin[ 1 ] );
	engfunc( EngFunc_WriteCoord, vOrigin[ 2 ] + 8 );
	engfunc( EngFunc_WriteCoord, vOrigin[ 0 ] + 150 );
	engfunc( EngFunc_WriteCoord, vOrigin[ 1 ] + 100 );
	engfunc( EngFunc_WriteCoord, vOrigin[ 2 ] + 100 );
	write_short( iSprite );
	write_byte( 0 );
	write_byte( iFramerate );
	write_byte( iLife );
	write_byte( iWidth );
	write_byte( iAmplitude );
	write_byte( iRed );
	write_byte( iGreen );
	write_byte( iBlue );
	write_byte( iBright );
	write_byte( iSpeed );
	message_end();
}
	
UTIL_SendWeaponAnim( id, iAnim )
{	
	set_pev( id, pev_weaponanim, iAnim );

	message_begin( MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, _, id );
	write_byte( iAnim );
	write_byte( 0 );
	message_end();
}

	/*---------------------------------|
	|		Natives		   |
	|---------------------------------*/
	
public plugin_natives()
{
	register_native( "HJB_IsUserInLastRequest", "_HJB_IsUserInLastRequest" );
	register_native( "HJB_RegisterLastRequest", "_HJB_RegisterLastRequest" );
}

public _HJB_IsUserInLastRequest()
{
	return FBitGet( IsInLr, get_param( 1 ) );
}

public _HJB_RegisterLastRequest()
{
	new ArrayData[ LastRequestData ];
	get_string( 1, ArrayData[ _szName ], charsmax( ArrayData[ _szName ] ) );
	
	new iSize = ArraySize( g_aLastRequestData );
	
	ArrayData[ _iIndex ] = iSize + MAX_STANDARD_LASTREQUEST + 1;
	
	ArrayInsertArrayAfter( g_aLastRequestData, iSize - 1, ArrayData );
	
	return iSize + MAX_STANDARD_LASTREQUEST;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
__________________

Last edited by UaExFanTasY; 05-26-2019 at 07:58. Reason: fixing
UaExFanTasY is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 05-27-2019 , 11:57   Re: Looking For /lr fix
Reply With Quote #2

I don't think this is the right section.
__________________








CrazY. is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 05-28-2019 , 02:20   Re: Looking For /lr fix
Reply With Quote #3

Wrong section, but you have to check LR in newround (make sure is disable)
Code:
public LogEvent_RoundStart()
{
	g_flRoundStart = get_gametime() + 3.0;
	
	g_iLrStatus = LASTREQUEST_INACTIVE;
}

Last edited by Fuck For Fun; 05-28-2019 at 02:20.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
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 01:59.


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