Raised This Month: $7 Target: $400
 1% 

New message started when msg '66' has not been sent yet


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DoPe
Member
Join Date: Feb 2017
Old 02-18-2018 , 13:59   New message started when msg '66' has not been sent yet
Reply With Quote #1

My server keeps crashing when i kill someone while im dueling... I am using Last Request by nikhilgupta, and i don't know why it crashes... I hope someone can help me, here is the code.

Code:
/*
*
*		Jailbreak Last Request
*			
*		H3avY Ra1n (AKA nikhilgupta345)
*
*		Description
*		-----------
*
*			This is a Last Request plugin for jailbreak mod, where 
*			the last terrorists can type /lr and is presented with a 
*			menu, which has numerous options to choose from that interact 
*			with the Counter-Terrorists.
*
*		Last Request Options
*		--------------------
*
*			Knife Battle 	- Fight with knives 1v1
*			Shot for Shot	- Take turns shooting a deagle
*			Deagle Toss		- See who can throw the deagle the farthest
*			Shotgun Battle	- Fight with shotguns 1v1
*			Scout Battle	- Fight with scouts 1v1
*			Grenade Toss	- See who can throw the grenade the farthest
*			Race			- Race across a certain part of the map
*			Spray Contest	- See who can spray closest to the top or bottom border
*			of a wall. Prisoner decides.
*
*
*		Client Commands
*		---------------
*	
*			say/say_team	/lr 			- Opens Last Request Menu
*							!lr
*							/lastrequest
*							!lastrequest
*
*
*		Installation
*		------------
*
*			- Compile this plugin locally
*			- Place jb_lastrequest.amxx in addons/amxmodx/plugins/ folder
*			- Open addons/amxmodx/configs/plugins.ini
*			- Add the line 'jb_lastrequest.amxx' at the bottom
*			- Restart server or change map
*			
*
*		Changelog
*		---------
*		
*			February 15, 2011 	- v1.0 - 	Initial Release
*			February 24, 2011	- v1.0.1 - 	Removed teleporting back to cell
*			March 05, 2011		- v1.1 -	Changed way of allowing a Last Request
*			March 26, 2011		- v1.2 - 	Added Multi-Lingual support.
*			August 10, 2011		- v2.0 -	Completely rewrote plugin
*
*		
*		Credits
*		-------
*		
*			Pastout		-	Used his thread as a layout for mine
*
*		
*		Plugin Thread: http://forums.alliedmods.net/showthread.php?p=1416279
*
*/

// Includes
////////////

#include < amxmodx >
#include < cstrike >
#include < fun >
#include < fakemeta >
#include < fakemeta_util >
#include < hamsandwich >

// Enums
/////////

enum
{
	LR_NONE=-1,
	LR_S4S,
	LR_SPRAY,
	LR_RACE,
	LR_GUNTOSS,
	LR_KNIFE,
	LR_NADETOSS,
	LR_SCOUT,
	LR_SHOTGUN,
	
	MAX_GAMES
};

enum
{
	GREY = 0,
	RED,
	BLUE,
	NORMAL
};

enum
{
	ALIVE, 
	DEAD, 
	ALL	
};

enum
{
	LR_PRISONER,
	LR_GUARD
};

enum ( += 100 )
{
	TASK_BEACON,
	TASK_ENDLR
};

// Consts
//////////

new const g_szPrefix[ ] = "!g[Jailbreak]!n";

new const g_szBeaconSound[ ] = "buttons/blip1.wav";
new const g_szBeaconSprite[ ] = "sprites/white.spr";

new const g_szGameNames[ MAX_GAMES ][ ] = 
{
	"Shot 4 Shot",
	"Spray Contest",
	"Race",
	"Gun Toss",
	"Knife Battle",
	"Grenade Toss",
	"Scout Battle",
	"Shotgun Battle"
};

new const g_szDescription[ MAX_GAMES ][ ] = 
{
	"Take turns shooting a deagle.",
	"Both players spray on a wall, highest or lowest.",
	"Both players race across a part of the map.",
	"See who can throw the deagle the farthest.",
	"Battle it out with knives.",
	"See who can throw the grenade the farthest from a point in the map.",
	"Battle it out with scouts.",
	"Battle it out with shotguns."
};

new const g_szTeamName[ ][ ] = 
{
	"",
	"TERRORIST",
	"CT",
	"SPECTATOR"
};

new const g_szPlugin[ ] = "Jailbreak Last Request";
new const g_szVersion[ ] = "2.0";
new const g_szAuthor[ ] = "H3avY Ra1n";

// Integers
////////////

new g_iCurrentGame = LR_NONE;
new g_iLastRequest[ 2 ];
new g_iCurrentPage[ 33 ];
new g_iChosenGame[ 33 ];

new g_iSprite;

new g_iMaxPlayers;

// Booleans
///////////

new bool:g_bAlive[ 33 ];
new bool:g_bConnected[ 33 ];

new bool:g_bLastRequestAllowed;

// Messages
////////////

new g_msgTeamInfo;
new g_msgSayText;

public plugin_precache()
{
	precache_sound( g_szBeaconSound );
	
	g_iSprite = precache_model( g_szBeaconSprite );
}

public plugin_init()
{
	register_plugin( g_szPlugin, g_szVersion, g_szAuthor );
	
	register_clcmd( "say /lr", 					"Cmd_LastRequest" );
	register_clcmd( "say !lr", 					"Cmd_LastRequest" );
	register_clcmd( "say /lastrequest", 		"Cmd_LastRequest" );
	register_clcmd( "say !lastrequest", 		"Cmd_LastRequest" );
	
	register_clcmd( "say_team /lr", 			"Cmd_LastRequest" );
	register_clcmd( "say_team !lr", 			"Cmd_LastRequest" );
	register_clcmd( "say_team /lastrequest", 	"Cmd_LastRequest" );
	register_clcmd( "say_team !lastrequest", 	"Cmd_LastRequest" );
	
	register_event( "HLTV", 	"Event_RoundStart", "a", "1=0", "2=0" );
	
	register_logevent( "Logevent_RoundStart", 2, "1=Round_Start" );
	
	RegisterHam( Ham_Spawn, 				"player", 			"Ham_PlayerSpawn_Post", 	1 );
	RegisterHam( Ham_Weapon_PrimaryAttack, 	"weapon_deagle", 	"Ham_DeagleFire_Post", 		1 );
	RegisterHam( Ham_Killed,				"player",			"Ham_PlayerKilled_Post",	1 );
	RegisterHam( Ham_TakeDamage,			"player",			"Ham_TakeDamage_Pre",		0 );
	
	register_forward( FM_Think, "Forward_EntityThink_Pre", 0 );
	
	register_message( get_user_msgid( "TextMsg" ), "Message_TextMsg" );
	
	g_msgTeamInfo 	= get_user_msgid( "TeamInfo" );
	g_msgSayText 	= get_user_msgid( "SayText" );
	
	g_iMaxPlayers 	= get_maxplayers();
	
	set_task( 2.0, "StartBeacon", .flags="b" );
	
	set_task( 300.0, "Task_Advertise", .flags="b" );
}

public client_putinserver( id )
{
	g_iCurrentPage[ id ] = 0;
	
	g_bConnected[ id ] = true;
}

public client_disconnected( id )
{
	g_bConnected[ id ] = false;
	
	if( g_bAlive[ id ] )
		g_bAlive[ id ] = false;
		
	if( id == g_iLastRequest[ LR_PRISONER ] || id == g_iLastRequest[ LR_GUARD ] )
	{
		EndLastRequest( id == g_iLastRequest[ LR_PRISONER ] ? g_iLastRequest[ LR_GUARD ] : g_iLastRequest[ LR_PRISONER ], id );
	}
	
	remove_task( id + TASK_ENDLR );
}

public Ham_PlayerSpawn_Post( id )
{
	if( !is_user_alive( id ) )
		return HAM_IGNORED;
		
	g_bAlive[ id ] = true;
	
	return HAM_IGNORED;
}

public Ham_PlayerKilled_Post( iVictim, iKiller, iShouldGib )
{	
	g_bAlive[ iVictim ] = false;
	
	if( iVictim == g_iLastRequest[ LR_PRISONER ] )
	{
		EndLastRequest( g_iLastRequest[ LR_GUARD ], iVictim );
	}
	
	else if( iVictim == g_iLastRequest[ LR_GUARD ] )
	{
		EndLastRequest( g_iLastRequest[ LR_PRISONER ], iVictim );
	}
	
	if( !g_bLastRequestAllowed && cs_get_user_team( iVictim ) == CS_TEAM_T )
	{
		if( get_playercount( CS_TEAM_T, ALIVE ) == 1 )
		{
			ColorChat( 0, NORMAL, "%s !gLast Request!n sega e pozvolen. Napishete!g /lr!n za da otvorite menu-to.", g_szPrefix );
			g_bLastRequestAllowed = true;
		}
	}
}

public Ham_DeagleFire_Post( iEnt )
{
	if( g_iCurrentGame != LR_S4S )
	{
		return;
	}
	
	new id = pev( iEnt, pev_owner );
	new iOpponentEnt;
	
	if( cs_get_weapon_ammo( iEnt ) == 0 )
	{
		if( id == g_iLastRequest[ LR_PRISONER ] )
		{
			iOpponentEnt = fm_find_ent_by_owner( -1, "weapon_deagle", g_iLastRequest[ LR_GUARD ] );
			
			if( pev_valid( iOpponentEnt ) )
				cs_set_weapon_ammo( iOpponentEnt, 1 );
		}
		
		else if( id == g_iLastRequest[ LR_GUARD ] )
		{
			iOpponentEnt = fm_find_ent_by_owner( -1, "weapon_deagle", g_iLastRequest[ LR_PRISONER ] );
			
			if( pev_valid( iOpponentEnt ) )
				cs_set_weapon_ammo( iOpponentEnt, 1 );
		}
	}
}

public Ham_TakeDamage_Pre( iVictim, iInflictor, iAttacker, Float:flDamage, iBits )
{
	if( !( 1 <= iAttacker <= g_iMaxPlayers ) )
		return HAM_IGNORED;
	
	new bool:g_bVictimLR = iVictim == g_iLastRequest[ LR_PRISONER ] || iVictim == g_iLastRequest[ LR_GUARD ];
	new bool:g_bAttackerLR = iAttacker == g_iLastRequest[ LR_PRISONER ] || iAttacker == g_iLastRequest[ LR_GUARD ];
	
	if( g_bVictimLR && !g_bAttackerLR )
	{
		return HAM_SUPERCEDE;
	}
	
	else if( !g_bVictimLR && g_bAttackerLR )
	{
		return HAM_SUPERCEDE;
	}
	
	return HAM_IGNORED;
}

public Event_RoundStart()
{
	g_bLastRequestAllowed = false;
	g_iCurrentGame = LR_NONE;
}



public Logevent_RoundStart()
{
	if( !g_bLastRequestAllowed && get_playercount( CS_TEAM_T, ALIVE ) == 1 )
	{
		g_bLastRequestAllowed = true;
		ColorChat( 0, NORMAL, "%s !gLast Request!n is now allowed. Type!g /lr", g_szPrefix );
	}
}

public Forward_EntityThink_Pre( iEnt )
{
	if( !pev_valid( iEnt ) || g_iCurrentGame != LR_NADETOSS )
		return FMRES_IGNORED;
	
	new id = pev( iEnt, pev_owner );
	
	if( id != g_iLastRequest[ LR_PRISONER ] && id != g_iLastRequest[ LR_GUARD ] )
		return FMRES_IGNORED;
		
	new szModel[ 32 ];
	
	pev( iEnt, pev_model, szModel, charsmax( szModel ) );
	
	if( equal( szModel, "models/w_smokegrenade.mdl" ) )
	{
		set_pev( iEnt, pev_renderfx, kRenderFxGlowShell );
		set_pev( iEnt, pev_renderamt, 125.0 );
		set_pev( iEnt, pev_rendermode, kRenderTransAlpha );
		
		set_pev( iEnt, pev_rendercolor, id == g_iLastRequest[ LR_GUARD ] ? { 0.0, 0.0, 255.0 } : { 255.0, 0.0, 0.0 } );
		
		return FMRES_SUPERCEDE;
	}	
	
	return FMRES_IGNORED;
}	



public Message_TextMsg()
{
	if( g_iCurrentGame == LR_NONE )
	{
		return PLUGIN_CONTINUE;
	}
	
	static szText[ 25 ];
	get_msg_arg_string( 2, szText, charsmax( szText ) );
	
	if( equal( szText, "#Round_Draw" ) || equal( szText, "#Game_will_restart_in" ) || equal( szText, "#Game_Commencing" ) )
	{
		g_iCurrentGame = LR_NONE;
		
		strip_user_weapons( g_iLastRequest[ LR_PRISONER ] );
		strip_user_weapons( g_iLastRequest[ LR_GUARD ] );
		
		GiveWeapons( g_iLastRequest[ LR_GUARD ] );
		
		g_iLastRequest[ LR_PRISONER ] = 0;
		g_iLastRequest[ LR_GUARD ] = 0;
	}
	
	return PLUGIN_CONTINUE;
}

public Cmd_LastRequest( id )
{
	if( !g_bAlive[ id ] )
	{
		ColorChat( id, NORMAL, "%s You must be !talive!n to have a !gLast Request!n.", g_szPrefix );
		return PLUGIN_HANDLED;
	}
	
	else if( cs_get_user_team( id ) != CS_TEAM_T )
	{
		ColorChat( id, NORMAL, "%s You must be a !tprisoner!n to have a !gLast Request!n.", g_szPrefix );
		return PLUGIN_HANDLED;
	}
	
	else if( !g_bLastRequestAllowed )
	{
		ColorChat( id, NORMAL, "%s There are too many !tprisoners!n remaining to have a !gLast Request!n.", g_szPrefix );
		return PLUGIN_HANDLED;
	}
	
	else if( g_iCurrentGame != LR_NONE )
	{
		ColorChat( id, NORMAL, "%s There's a !gLast Request!n already in progress!", g_szPrefix );
		return PLUGIN_HANDLED;
	}
	
	else LastRequestMenu( id );
	
	return PLUGIN_HANDLED;
}

public LastRequestMenu( id )
{
	new hMenu = menu_create( "\yChoose a Game:", "LastRequestMenu_Handler" );
	
	new szInfo[ 6 ];
	
	for( new i = 0; i < MAX_GAMES; i++ )
	{
		num_to_str( i, szInfo, charsmax( szInfo ) );
		
		menu_additem( hMenu, g_szGameNames[ i ], szInfo );
	}
	
	menu_setprop( hMenu, MPROP_NEXTNAME, "Next Page" );
	menu_setprop( hMenu, MPROP_BACKNAME, "Previous Page" );
	
	menu_display( id, hMenu, 0 );
}

public LastRequestMenu_Handler( id, hMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		menu_destroy( hMenu );
		return PLUGIN_HANDLED;
	}
	
	new szData[ 6 ];
	new iAccess, hCallback;
	menu_item_getinfo( hMenu, iItem, iAccess, szData, charsmax( szData ), _, _, hCallback );
	
	g_iChosenGame[ id ] = str_to_num( szData );
	
	if( g_iCurrentGame != LR_NONE )
	{
		menu_destroy( hMenu );
		g_iChosenGame[ id ] = LR_NONE;
		ColorChat( id, NORMAL, "%s There's already a !gLast Request!n in progress.", g_szPrefix );
		return PLUGIN_HANDLED;
	}
	
	ShowPlayerMenu( id );
	
	menu_destroy( hMenu );
	return PLUGIN_HANDLED;
}
	
	
public ShowPlayerMenu( id )
{
	new hMenu = menu_create( "\yChoose an Opponent:", "PlayerMenu_Handler" );
	
	new szPlayerName[ 32 ], szInfo[ 6 ];
	
	for( new i = 1; i < g_iMaxPlayers; i++ )
	{
		if( !g_bAlive[ i ] || cs_get_user_team( i ) != CS_TEAM_CT )
			continue;
		
		get_user_name( i, szPlayerName, charsmax( szPlayerName ) );
		
		num_to_str( i, szInfo, charsmax( szInfo ) );
		
		menu_additem( hMenu, szPlayerName, szInfo );
	}
	
	menu_setprop( hMenu, MPROP_NEXTNAME, "Next Page" );
	menu_setprop( hMenu, MPROP_BACKNAME, "Previous Page" );
	
	menu_display( id, hMenu, 0 );
}

public PlayerMenu_Handler( id, hMenu, iItem )
{	
	if( iItem == MENU_EXIT || !g_bAlive[ id ] || !g_bLastRequestAllowed || g_iCurrentGame != LR_NONE )
	{
		g_iChosenGame[ id ] = LR_NONE;
		
		menu_destroy( hMenu );
		return PLUGIN_HANDLED;
	}
	
	new szData[ 6 ], szPlayerName[ 64 ];
	new iAccess, hCallback;
	
	menu_item_getinfo( hMenu, iItem, iAccess, szData, charsmax( szData ), szPlayerName, charsmax( szPlayerName ), hCallback );
	
	new iGuard = str_to_num( szData );
	
	if( !g_bAlive[ iGuard ] || cs_get_user_team( iGuard ) != CS_TEAM_CT )
	{
		ColorChat( id, NORMAL, "%s That player is no longer available for !gLast Request!n.", g_szPrefix );
		menu_destroy( hMenu );
		
		ShowPlayerMenu( id );
		return PLUGIN_HANDLED;
	}
	
	StartGame( g_iChosenGame[ id ], id, iGuard );
	
	menu_destroy( hMenu );
	return PLUGIN_HANDLED;
}

public StartGame( iGame, iPrisoner, iGuard )
{
	g_iCurrentGame = iGame;
	
	g_iLastRequest[ LR_PRISONER ] = iPrisoner;
	g_iLastRequest[ LR_GUARD ] = iGuard;
	
	new szPrisonerName[ 32 ], szGuardName[ 32 ];
	
	get_user_name( iPrisoner, szPrisonerName, charsmax( szPrisonerName ) );
	get_user_name( iGuard, szGuardName, charsmax( szGuardName ) );
	
	ColorChat( 0, NORMAL, "%s !t%s!n against !t%s!n in a !g%s!n!", g_szPrefix, szPrisonerName, szGuardName, g_szGameNames[ iGame ] );
	
	strip_user_weapons( iPrisoner );
	strip_user_weapons( iGuard );
	
	set_user_health( iPrisoner, 100 );
	set_user_health( iGuard, 100 );
	
	set_user_armor( iPrisoner, 0 );
	set_user_armor( iGuard, 0 );
	
	StartBeacon();
	
	ColorChat( iPrisoner, NORMAL, "%s !tObjective: %s", g_szPrefix, g_szDescription[ iGame ] );
	ColorChat( iGuard, NORMAL, "%s !tObjective: %s", g_szPrefix, g_szDescription[ iGame ] );
	
	switch( iGame )
	{	
		case LR_S4S:
		{
			LR_Shot4Shot( iPrisoner );
			LR_Shot4Shot( iGuard );
		}
		
		case LR_RACE:
		{
			LR_Race( iPrisoner );
			LR_Race( iGuard );
		}
		
		case LR_KNIFE:
		{
			LR_Knife( iPrisoner );
			LR_Knife( iGuard );
		}
		
		case LR_SPRAY:
		{
			LR_Spray( iPrisoner );
			LR_Spray( iGuard );
		}
		
		case LR_GUNTOSS:
		{
			LR_GunToss( iPrisoner );
			LR_GunToss( iGuard );
		}
		
		case LR_NADETOSS:
		{
			LR_NadeToss( iPrisoner );
			LR_NadeToss( iGuard );
		}
		
		case LR_SCOUT:
		{
			LR_Scout( iPrisoner );
			LR_Scout( iGuard );
		}
		
		case LR_SHOTGUN:
		{
			LR_Shotgun( iPrisoner );
			LR_Shotgun( iGuard );
		}
	}
}

public StartBeacon()
{
	if( g_iCurrentGame == LR_NONE )
	{
		return;
	}
	
	new id;
	
	for( new i = 0; i < 2; i++ )
	{
		id = g_iLastRequest[ i ];
		
		static origin[3]
		emit_sound( id, CHAN_ITEM, g_szBeaconSound, 1.0, ATTN_NORM, 0, PITCH_NORM )
		
		get_user_origin( id, origin )
		message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
		write_byte( TE_BEAMCYLINDER )
		write_coord( origin[0] )	//position.x
		write_coord( origin[1] )	//position.y
		write_coord( origin[2]-20 )	//position.z
		write_coord( origin[0] )    	//axis.x
		write_coord( origin[1] )    	//axis.y
		write_coord( origin[2]+200 )	//axis.z
		write_short( g_iSprite )	//sprite index
		write_byte( 0 )       	//starting frame
		write_byte( 1 )       	//frame rate in 0.1's
		write_byte( 6 )        	//life in 0.1's
		write_byte( 10 )        	//line width in 0.1's
		write_byte( 1 )        	//noise amplitude in 0.01's
		
		switch( cs_get_user_team( id ) )
		{
			case CS_TEAM_CT:
			{
				write_byte( 0 );
				write_byte( 0 );
				write_byte( 255 );
			}
			
			case CS_TEAM_T:
			{
				write_byte( 255 );
				write_byte( 0 );
				write_byte( 0 );
			}
		}
		
		write_byte( 255 );			// brightness
		write_byte( 0 );			// scroll speed in 0.1's
		message_end();
	}
}
	
public EndLastRequest( iWinner, iLoser )
{
	new szWinnerName[ 32 ], szLoserName[ 32 ];
	
	get_user_name( iWinner, szWinnerName, 31 );
	get_user_name( iLoser, szLoserName, 31 );
	
	ColorChat( 0, NORMAL, "%s !t%s!n beat !t%s!n in the !gLast Request!n.", g_szPrefix, szWinnerName, szLoserName );
	
	strip_user_weapons( iLoser );

	g_iCurrentGame = LR_NONE;
	
	g_iLastRequest[ LR_PRISONER ] = 0;
	g_iLastRequest[ LR_GUARD ] = 0;
	
	set_task( 0.1, "Task_EndLR", TASK_ENDLR + iWinner );
}

public Task_EndLR( iTaskID )
{
	new id = iTaskID - TASK_ENDLR;

	strip_user_weapons( id );
	set_user_health( id, 100 );
	
	if( cs_get_user_team( id ) == CS_TEAM_CT )
		GiveWeapons( id );
}

//////////////////////////////
//			LR Games		//
//////////////////////////////

LR_Knife( id )
{
	new szMapName[ 32 ], iCTOrigin[ 3 ], iTOrigin[ 3 ];
	
	give_item( id, "weapon_knife" );
	
	get_mapname( szMapName, charsmax( szMapName ) );
	
	if( equali( szMapName, "some1s_jailbreak" ) )
	{
		iCTOrigin = { -759, 1047, 100 };
		iTOrigin = { -585, 867, 100 };
		
		if( id == g_iLastRequest[ LR_PRISONER ] )
			set_user_origin( id, iTOrigin );
		
		else
			set_user_origin( id, iCTOrigin );
	}
}

LR_Shotgun( id )
{
	give_item( id, "weapon_m3" );
	cs_set_user_bpammo( id, CSW_M3, 28 );
}

LR_Scout( id )
{
	new szMapName[ 32 ], iCTOrigin[ 3 ], iTOrigin[ 3 ];

	give_item( id, "weapon_scout" );
	cs_set_user_bpammo( id, CSW_SCOUT, 90 );
	
	get_mapname( szMapName, charsmax( szMapName ) );
	
	if( equali( szMapName, "some1s_jailbreak" ) )
	{
		iCTOrigin = { -2898, -2040, 37 };
		iTOrigin = { -2908, 905, 37 };
		
		if( id == g_iLastRequest[ LR_PRISONER ] )
			set_user_origin( id, iTOrigin );
		
		else
			set_user_origin( id, iCTOrigin );
	}
}

LR_Shot4Shot( id )
{
	new szMapName[ 32 ], iCTOrigin[ 3 ], iTOrigin[ 3 ];
	
	if( id == g_iLastRequest[ LR_PRISONER ] )
	{
		cs_set_weapon_ammo( give_item( id, "weapon_deagle" ), 1 );
	}
	
	else cs_set_weapon_ammo( give_item( id, "weapon_deagle" ), 0 );
	
	get_mapname( szMapName, charsmax( szMapName ) );
	
	if( equali( szMapName, "some1s_jailbreak" ) )
	{
		iCTOrigin = { -1352, 271, 38 };
		iTOrigin = { -1338, -782, 38 };
		
		if( id == g_iLastRequest[ LR_PRISONER ] )
			set_user_origin( id, iTOrigin );
		
		else
			set_user_origin( id, iCTOrigin );
	}
}

LR_Race( id )
{
	give_item( id, "weapon_knife" );
}

LR_Spray( id )
{
	give_item( id, "weapon_knife" );
}

LR_GunToss( id )
{
	give_item( id, "weapon_knife" );
	cs_set_weapon_ammo( give_item( id, "weapon_deagle" ), 0 );
}

LR_NadeToss( id )
{
	give_item( id, "weapon_knife" );
	give_item( id, "weapon_smokegrenade" );
	ColorChat( id, NORMAL, "%s Do not throw the nade until you are doing the toss!", g_szPrefix );
}

public Task_Advertise()
{
	//ColorChat( 0, NORMAL, "%s This server is running !tLast Request v%s !nby !tH3avY Ra1n!n.", g_szPrefix, g_szVersion );
}

GiveWeapons( id )
{
	give_item( id, "weapon_m4a1" );
	give_item( id, "weapon_deagle" );
	give_item( id, "weapon_smokegrenade" );
	
	cs_set_user_bpammo( id, CSW_M4A1, 90 );
	cs_set_user_bpammo( id, CSW_DEAGLE, 120 );
}

ColorChat( id, colour, const text[], any:... )
{
	if( !get_playersnum() )
	{
		return;
	}
	
	static message[192];
	
	message[0] = 0x01;
	vformat(message[1], sizeof(message) - 1, text, 4);
	
	replace_all(message, sizeof(message) - 1, "!g", "^x04");
	replace_all(message, sizeof(message) - 1, "!n", "^x01");
	replace_all(message, sizeof(message) - 1, "!t", "^x03");
	
	static index, MSG_Type;
	
	if( !id )
	{
		static i;
		for(i = 1; i <= g_iMaxPlayers; i++)
		{
			if( g_bConnected[i] )
			{
				index = i;
				break;
			}
		}
		
		MSG_Type = MSG_ALL;
	}
	else
	{
		MSG_Type = MSG_ONE;
		index = id;
	}
	
	static bool:bChanged;
	if( colour == GREY || colour == RED || colour == BLUE )
	{
		message_begin(MSG_Type, g_msgTeamInfo, _, index);
		write_byte(index);
		write_string(g_szTeamName[colour]);
		message_end();
		
		bChanged = true;
	}
	
	message_begin(MSG_Type, g_msgSayText, _, index);
	write_byte(index);
	write_string(message);
	message_end();
	
	if( bChanged )
	{
		message_begin(MSG_Type, g_msgTeamInfo, _, index);
		write_byte(index);
		write_string(g_szTeamName[_:cs_get_user_team(index)]);
		message_end();
	}
}

get_playercount( CsTeams:iTeam, iStatus )
{
	new iPlayerCount;
	
	for( new i = 1; i <= g_iMaxPlayers; i++ )
	{
		if( !g_bConnected[ i ] || cs_get_user_team( i ) != iTeam ) continue;
		
		switch( iStatus )
		{
			case DEAD: if( g_bAlive[ i ] ) continue;
			case ALIVE: if( !g_bAlive[ i ] ) continue;
		}
		
		iPlayerCount++;
	}
	
	return iPlayerCount;
}
DoPe is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-18-2018 , 14:26   Re: New message started when msg '66' has not been sent yet
Reply With Quote #2

Do some debugging and identify what part of the code is causing the crash. It should be related to a message being sent(message_begin).
This is not a section where you come and ask "do this for me". If you have no idea how to debug plugins or how to code then this is not the right section for you and you should post in suggestions/requests section.
__________________
HamletEagle is offline
DoPe
Member
Join Date: Feb 2017
Old 02-18-2018 , 15:24   Re: New message started when msg '66' has not been sent yet
Reply With Quote #3

Yeah i dont know... Please delete this thread and check my new one.
DoPe is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-18-2018 , 16:08   Re: New message started when msg '66' has not been sent yet
Reply With Quote #4

DoPe, please do not post the same topic twice. The thread in Suggestions/Requests has been deleted.
__________________
Bugsy is offline
DoPe
Member
Join Date: Feb 2017
Old 02-18-2018 , 16:19   Re: New message started when msg '66' has not been sent yet
Reply With Quote #5

Okay then help me here pleaseeeee
DoPe is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-18-2018 , 23:07   Re: New message started when msg '66' has not been sent yet
Reply With Quote #6

Hamleteagle already told you do debugging
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
DoPe
Member
Join Date: Feb 2017
Old 02-19-2018 , 07:03   Re: New message started when msg '66' has not been sent yet
Reply With Quote #7

I am not a pawner and i don't know what is debugging, so please fix it and paste the code here so i can just put it in my server, i posted a topic in requests and suggiestions but it got deleted, so the current topic is my chance.. Please, i just need that only.
DoPe is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 02-19-2018 , 07:44   Re: New message started when msg '66' has not been sent yet
Reply With Quote #8

All the messages sent by this plugin has a message_end() that the plugin has no way of skipping.
If this is the plugin causing the error you should have another error in your console, halting the code before it could reach message_end().
It's also possible there's another plugin setting up a message and not finishing, basically preparing to crash. This code may be fine.

Post your logs.
cstrike\logs
cstrike\addons\amxmodx\logs
Black Rose is offline
DoPe
Member
Join Date: Feb 2017
Old 02-19-2018 , 08:18   Re: New message started when msg '66' has not been sent yet
Reply With Quote #9

There is not error log, and yes, this plugin is causing the crash, i removed it and all is fine... But when i back it, i choose any duel, and when i kill the CT server crashes... The only error i got is that from the console, which is in the topic title.
DoPe is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 02-19-2018 , 15:14   Re: New message started when msg '66' has not been sent yet
Reply With Quote #10

Come back with the output when the crash occurs. Make sure it's the right output.

Code:
public Ham_PlayerKilled_Post( iVictim, iKiller, iShouldGib ) {        log_amx("Ham_PlayerKilled_Post(%d, %d, %d) called", iVictim, iKiller, iShouldGib);     log_amx("g_iLastRequest[LR_PRISONER]: %d", g_iLastRequest[LR_PRISONER]);     log_amx("g_iLastRequest[LR_GUARD]: %d", g_iLastRequest[LR_GUARD]);     log_amx("g_bLastRequestAllowed: %s", g_bLastRequestAllowed ? "true" : "false");     log_amx("cs_get_user_team(iVictim): %s", cs_get_user_team(iVictim) == CS_TEAM_T ? "TERRORIST" : cs_get_user_team(iVictim) == CS_TEAM_CT ? "CT" : "OTHER");     log_amx("get_playercount(CS_TEAM_T, ALIVE): %d", get_playercount(CS_TEAM_T, ALIVE));     g_bAlive[ iVictim ] = false;         if( iVictim == g_iLastRequest[ LR_PRISONER ] )     {         log_amx("EndLastRequest 1 - Pre");         EndLastRequest( g_iLastRequest[ LR_GUARD ], iVictim );         log_amx("EndLastRequest 1 - Post");     }         else if( iVictim == g_iLastRequest[ LR_GUARD ] )     {         log_amx("EndLastRequest 2 - Pre");         EndLastRequest( g_iLastRequest[ LR_PRISONER ], iVictim );         log_amx("EndLastRequest 2 - Post");     }         if( !g_bLastRequestAllowed && cs_get_user_team( iVictim ) == CS_TEAM_T )     {         if( get_playercount( CS_TEAM_T, ALIVE ) == 1 )         {             log_amx("ColorChat - Pre");             ColorChat( 0, NORMAL, "%s !gLast Request!n sega e pozvolen. Napishete!g /lr!n za da otvorite menu-to.", g_szPrefix );             log_amx("ColorChat - Post");             g_bLastRequestAllowed = true;         }     }     log_amx("Ham_PlayerKilled_Post() end"); }
Black Rose 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 00:57.


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