probleme plugin gag

Discutii despre problemele aparute in jocul Counter-Strike.

Moderators: Moderatori ajutatori, Moderatori

Post Reply
N.A.S.A.
Membru, skill 0
Membru, skill 0
Posts: 99
Joined: 14 Feb 2018, 15:56
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

23 Apr 2018, 17:08

Salut de ficare daca cand vizitez Logos imi da eroarea aceasta dela pluginul de gag.

eroare:
| Afiseaza codul
L 04/23/2018 - 18:04:31: Start of error session.
L 04/23/2018 - 18:04:31: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20180423.log")
L 04/23/2018 - 18:04:31: [AMXX] Displaying debug trace (plugin "amx_gag.amxx")
L 04/23/2018 - 18:04:31: [AMXX] Run time error 4: index out of bounds 
L 04/23/2018 - 18:04:31: [AMXX]    [0] 9370k1fk.sma.p::CheckGag (line 268)
L 04/23/2018 - 18:04:34: [AMXX] Displaying debug trace (plugin "amx_gag.amxx")
L 04/23/2018 - 18:04:34: [AMXX] Run time error 4: index out of bounds 
L 04/23/2018 - 18:04:34: [AMXX]    [0] 9370k1fk.sma.p::CheckGag (line 268)
L 04/23/2018 - 18:04:44: [AMXX] Displaying debug trace (plugin "amx_gag.amxx")
L 04/23/2018 - 18:04:44: [AMXX] Run time error 4: index out of bounds 
L 04/23/2018 - 18:04:44: [AMXX]    [0] 9370k1fk.sma.p::CheckGag (line 268)
L 04/23/2018 - 18:04:46: [AMXX] Displaying debug trace (plugin "amx_gag.amxx")
L 04/23/2018 - 18:04:46: [AMXX] Run time error 4: index out of bounds 
L 04/23/2018 - 18:04:46: [AMXX]    [0] 9370k1fk.sma.p::CheckGag (line 268)
L 04/23/2018 - 18:04:50: [AMXX] Displaying debug trace (plugin "amx_gag.amxx")
L 04/23/2018 - 18:04:50: [AMXX] Run time error 4: index out of bounds 
L 04/23/2018 - 18:04:50: [AMXX]    [0] 9370k1fk.sma.p::CheckGag (line 268)
L 04/23/2018 - 18:04:57: [AMXX] Displaying debug trace (plugin "amx_gag.amxx")
L 04/23/2018 - 18:04:57: [AMXX] Run time error 4: index out of bounds 
L 04/23/2018 - 18:04:57: [AMXX]    [0] 9370k1fk.sma.p::CheckGag (line 268)
L 04/23/2018 - 18:04:58: [AMXX] Displaying debug trace (plugin "amx_gag.amxx")
L 04/23/2018 - 18:04:58: [AMXX] Run time error 4: index out of bounds 
L 04/23/2018 - 18:04:58: [AMXX]    [0] 9370k1fk.sma.p::CheckGag (line 268)
L 04/23/2018 - 18:05:01: [AMXX] Displaying debug trace (plugin "amx_gag.amxx")
L 04/23/2018 - 18:05:01: [AMXX] Run time error 4: index out of bounds 
L 04/23/2018 - 18:05:01: [AMXX]    [0] 9370k1fk.sma.p::CheckGag (line 268)
plugin:
| Afiseaza codul
#include < amxmodx >

#include < amxmisc >



#include < fakemeta >

#include < engine >

#include < nvault >



#define PLUGIN "Special Admin Gag"

#define VERSION "1.0"



#define COMMAND_ACCESS  	ADMIN_KICK // accesu adminilor pentru comanda

#define MAX_PLAYERS 		32 + 1



#define			SAVEDATA_FILE			"GagSaveDataFile"



enum {

	INFO_NAME

};



new const bars[ ] = "/";



new command[ ] [ ] =  {

	"/gag"

};



new Caccess[ ] =  {

	COMMAND_ACCESS,

	COMMAND_ACCESS

};



new const gGagFileName[ ] = "gag_words.ini";



new const gGagThinkerClassname[ ] = "GagThinker_";



new PlayerGagged[ MAX_PLAYERS ];

new PlayerGagTime[ MAX_PLAYERS ];

new JoinTime[ MAX_PLAYERS ];

new szName[ 33 ];



new g_Words[ 562 ] [ 32 ], g_Count;



new gCvarSwearGagTime;

new gCvarGagMinuteLimit;

new gCvarGagMinuteInSeconds;

new gCvarAdminGag;

new gCvarWords;



new gMaxPlayers;

new iVault;



new SaveDataFile [ 128 ];



public plugin_init( ) 

{

	register_plugin( PLUGIN, PLUGIN, "Cristi .C" );

	

	register_concmd( "amx_gag", "CommandGag" ); 

	register_concmd( "amx_ungag", "CommandUngag" );

	

	register_clcmd( "say", "CheckGag" );

	register_clcmd( "say_team", "CheckGag" );

	

	register_clcmd( "say", "command_chat" );

	

	GagThinker( );

	register_think( gGagThinkerClassname, "Forward_GagThinker" );

	

        gCvarSwearGagTime = register_cvar( "amx_autogag_time", "3" ); // minutele pentru gag cand ia autogag

        gCvarGagMinuteLimit = register_cvar( "amx_gag_minute_limit", "10" ); // limita maxima pentru gag minute

        gCvarGagMinuteInSeconds = register_cvar( "amx_gag_minute_in_seconds", "60" ); // minute in secunde

        gCvarAdminGag = register_cvar( "amx_admingag", "1" ); // poti da si la admini gag daca e egal cu 1, daca e 0 nu poti

        gCvarWords = register_cvar( "amx_maxwords", "900" ); // lista maxima de cuvinte in gag_words.ini

	

	iVault  =  nvault_open(  "GagSystem"  );

	

	if(  iVault  ==  INVALID_HANDLE  )

	{

		set_fail_state(  "nValut returned invalid handle!"  );

	}

	

	gMaxPlayers = get_maxplayers( );

	

	new DataDir [ 64 ];

	get_datadir ( DataDir, 63 );

	format ( SaveDataFile, 127, "%s/%s.dat", DataDir, SAVEDATA_FILE );

}



public plugin_cfg( ) 

{

	static szConfigDir[ 64 ], iFile[ 64 ];

	

	get_localinfo ( "amxx_configsdir", szConfigDir, 63 );

	formatex ( iFile , charsmax( iFile ) , "%s/%s" , szConfigDir, gGagFileName );

	

	if( !file_exists( iFile ) )

	{

		write_file( iFile, "# Pune aici cuvintele jignitoare sau reclamele", -1 );

	}

	

	new szBuffer[ 128 ];

	new szFile = fopen( iFile, "rt" );

	

	while( !feof( szFile ) )

	{

		fgets( szFile, szBuffer, charsmax( szBuffer ) );

		

		if( szBuffer[ 0 ] == '#' )

		{

			continue;

		}

		

		parse( szBuffer, g_Words[ g_Count ], sizeof g_Words[ ] - 1 );

		g_Count++;

		

		if( g_Count >= get_pcvar_num ( gCvarWords ) )

		{

			break;

		}

	}

	

	fclose( szFile );

}





public client_putinserver( id ) 

{ 

	if ( is_user_connected( id ) )

	{

		JoinTime[ id ] = get_systime( );

		Load ( id );

	}

}



public client_disconnect ( id ) {

	

	if ( PlayerGagged [ id ] )

		Save ( id );

}



public SaveData ( client ) {

	

	new Name [ 32 ];

	get_user_name ( client, Name, 31 );

	

	new _Gagged = PlayerGagged [ client ];

	new _GagTime = PlayerGagTime [ client ];

	

	new StrongData [ 1024 ];

	formatex ( StrongData, sizeof ( StrongData ) - 1, "^"%i^" ^"%i^"", _Gagged, _GagTime );

	

	new Save [ 1024 ];

	format ( Save, sizeof ( Save ) - 1, "^"%s^" %s", Name, StrongData );

	

	new Line [ 128 ], Linie, IsPlayer = false, Arg1 [ 32 ];

	

	new FileOpen = fopen ( SaveDataFile, "rt" );

	while ( !feof ( FileOpen ) ) {

		fgets ( FileOpen, Line, 127 );

		trim ( Line );

		

		parse ( Line, Arg1, 31 );

		

		if ( equali ( Arg1, Name ) ) {

			write_file ( SaveDataFile, Save, Linie );

			IsPlayer = true;

			break;

		}

		

		Linie++;

	}

	

	fclose ( FileOpen );

	if ( !IsPlayer )

		write_file ( SaveDataFile, Save, -1 );

}



public LoadData ( client ) {

	

	new Name [ 32 ];

	get_user_name ( client, Name, 31 );

	

	new Line [ 128 ], IsPlayer = false, Arg1 [ 32 ], Arg2 [ 32 ], Arg3 [ 32 ];

	new FileOpen = fopen ( SaveDataFile, "rt" );

	

	while ( !feof ( FileOpen ) ) {

		

		fgets ( FileOpen, Line, 127 );

		trim ( Line );

		

		parse ( Line, Arg1, 31, Arg2, 31, Arg3, 31 );

		

		if ( equali ( Arg1, Name ) ) {

			

			PlayerGagged [ client ] = str_to_num ( Arg2 );

			PlayerGagTime [ client ] = str_to_num ( Arg3 );

			

			IsPlayer = true;

			break;

		}

	}

	

	fclose ( FileOpen );

	

	if ( !IsPlayer ) {

		

		PlayerGagged [ client ] = 0;

		PlayerGagTime [ client ]  = 0;

		

		

	}

}



public command_chat( index )

{

	static szArg[ 192 ], command2[ 192 ];

	

	read_args( szArg, charsmax ( szArg ) );

	

	if( ! szArg [ 0 ] )

		return PLUGIN_CONTINUE;

	

	remove_quotes( szArg[0] );

	

	for( new x; x < sizeof command; x++ )

	{

		if ( equal ( szArg, command [ x ], strlen ( command [ x ] ) ) )

		{

			if ( get_user_flags ( index ) & Caccess [ x ] )

			{

				replace( szArg, charsmax ( szArg ), bars, "" );

				formatex( command2, charsmax(command2), "amx_%s", szArg );

				client_cmd( index, command2 );

			}	

			

			break;

		}

	}

	

	return PLUGIN_CONTINUE;

}



public CheckGag( id ) 

{

	new szSaid[ 300 ];

	

	read_args( szSaid, charsmax( szSaid ) );

	remove_quotes( szSaid );

	

	if( !UTIL_IsValidMessage( szSaid ) )

	{

		return PLUGIN_HANDLED;

	}

	

	if ( PlayerGagged[ id ] == 1 ) 

	{

		PlayerGagged[ id ] = 1;

		

		chat_color( id, "^4[FURY] ^1Ai primit ^4GAG ^1Pentru ^3LIMBAJ ^1sau ^3RECLAMA ^1Timp Ramas ^4%d ^1Minut(e)!", PlayerGagTime[ id ] );	

		

		return PLUGIN_HANDLED;

	}

	

	else

	{

		new i;

		for( i = 0; i < get_pcvar_num ( gCvarWords ); i++ )

		{

			if( containi( szSaid, g_Words[ i ] ) != -1 )

			{
				if( get_pcvar_num( gCvarAdminGag ) == 0 )

				{

					if ( is_user_admin ( id ) )

					{	

						return 1;

					}

				}

				

				PlayerGagged[ id ] = 1;

				PlayerGagTime[ id ] = get_pcvar_num ( gCvarSwearGagTime );

				set_speak( id, SPEAK_MUTED );

				

				chat_color( id, "^4[FURY] ^1Ai Primit ^4Auto-Gag ^1Pentru ^3LIMBAJ ^1sau ^3RECLAMA ^1Timp Ramas ^4%d ^1Minut(e)", PlayerGagTime[ id ] );

				

				//SaveGagedPlayers( id );

				return PLUGIN_HANDLED;

			}

		}

	}

	

	return PLUGIN_CONTINUE;

}



public CommandGag( id )  

{  

	if( !(get_user_flags( id ) & COMMAND_ACCESS ) )

	{

		client_cmd( id, "echo [FURIEN] Nu ai acces la aceasta comanda!" );

		return 1;

	}

	

	new szArg[ 32 ], szMinutes[ 32 ];

	

	read_argv( 1, szArg, charsmax ( szArg ) );

	

	if( equal( szArg, "" ) )

	{

		client_cmd( id, "echo amx_gag < nume > < minute >" );

		return 1;

	}

	

	new iPlayer = cmd_target( id, szArg, CMDTARGET_ALLOW_SELF );

	

	if( !iPlayer )

	{

		client_cmd( id, "echo [FURIEN] Jucatorul cu acel nume nu a fost gasit!" );

		return 1;

	}

	

	if ( get_pcvar_num( gCvarAdminGag ) == 0 )

	{

		if ( is_user_admin( iPlayer ) )

		{

			client_cmd( id, "echo [FURIEN] Nu poti da gag la Admini!" );

			return 1;

		}

	}

	

	read_argv( 2, szMinutes, charsmax ( szMinutes ) );

	

	new iMinutes = str_to_num( szMinutes );

	

	if ( iMinutes > get_pcvar_num ( gCvarGagMinuteLimit ) )

	{

		console_print( id, "Ai setat %d minute, iar limita maxima de minute este %d! Setare automata pe %d.", iMinutes, get_pcvar_float ( gCvarGagMinuteLimit ), get_pcvar_float ( gCvarGagMinuteLimit ) );

		iMinutes = get_pcvar_num( gCvarGagMinuteLimit ) ;

	}

	

	get_user_name( iPlayer, szName, sizeof ( szName ) -1 );

	

	if( PlayerGagged[ iPlayer ] == 1 ) 

	{

		client_cmd( id, "echo [FURIEN] Jucatorul %s are deja gag!", GetInfo( iPlayer, INFO_NAME ) );

		return 1;

	}

	

	PlayerGagged[ iPlayer ] = 1;

	PlayerGagTime[ iPlayer ] = iMinutes;

	set_speak( iPlayer, SPEAK_MUTED );

	

	chat_color(0, "^4[FURY] ^1Admin-ul ^4%s ^1i-a dat ^4GAG ^1Jucator-ului ^4%s ^1Pentru ^4%d ^1Minut(e)", GetInfo( id, INFO_NAME ), GetInfo( iPlayer, INFO_NAME ), iMinutes ); 

	chat_color(iPlayer, "^4[FURY] ^1Ai primit ^4GAG ^1pentru ^3LIMBAJ ^1sau ^3RECLAMA" ); 

	

	//SaveGagedPlayers( id );

	return PLUGIN_HANDLED;

}



public CommandUngag( id )  

{  

	if( !(get_user_flags( id ) & COMMAND_ACCESS ) )

	{

		client_cmd( id, "echo [FURIEN] Nu ai acces la aceasta comanda!" );

		return 1;

	}

	

	new szArg[ 32 ];

	

	read_argv( 1, szArg, charsmax( szArg ) );

	

	if( equal( szArg, "" ) )

	{

		client_cmd( id, "echo amx_ungag < nume > !" );

		return 1;

	}

	

	new iPlayer = cmd_target ( id, szArg, CMDTARGET_ALLOW_SELF );

	

	if( !iPlayer )

	{

		client_cmd(  id, "echo [FURIEN] Jucatorul cu acel nume nu a fost gasit!" );

		return 1;

	}

	

	if( PlayerGagged[ iPlayer ] == 0 ) 

	{

		console_print( id, "[FURIEN] Jucatorul %s nu are Gag!", GetInfo( iPlayer, INFO_NAME ) );

		return 1;

	}

	

	PlayerGagged[ iPlayer ] = 0;

	PlayerGagTime[ iPlayer ] = 0;

	set_speak( iPlayer, SPEAK_NORMAL );

	

	chat_color(0, "^4[FURY] ^1Admin-ul ^4%s ^1i-a dat ^4UnGag ^1Jucator-ului ^4%s", GetInfo( id, INFO_NAME ), GetInfo( iPlayer, INFO_NAME ) ); 

	

	Save( iPlayer );

	return PLUGIN_HANDLED;

}



public Forward_GagThinker( iEntity )

{

	if ( pev_valid( iEntity ) )

	{

		set_pev( iEntity, pev_nextthink, get_gametime( ) + 1.0 ) ;

		

		new id;

		for ( id = 1; id <= gMaxPlayers; id++ )

		{

			if ( is_user_connected ( id ) 	

			&& ! is_user_bot( id )

			&& PlayerGagged[ id ] == 1 

			&& PlayerGagTime[ id ] > 0

			&& ( ( get_systime( ) - JoinTime[ id ] ) >= get_pcvar_num ( gCvarGagMinuteInSeconds ) ) ) {

				JoinTime[ id ] = get_systime( );

				PlayerGagTime[ id ] -= 1;

				

				if ( PlayerGagTime[ id ] <= 0 )

				{

					PlayerGagTime[ id ] = 0;

					PlayerGagged[ id ] = 0;

					set_speak( id, SPEAK_NORMAL );

					Save(id)

				}

			}

		}

	}

}







stock GagThinker( )

{

	new iEntity = create_entity ( "info_target" );

	

	if( ! pev_valid ( iEntity ) )

	{

		return PLUGIN_HANDLED;

	}

	

	set_pev ( iEntity, pev_classname, gGagThinkerClassname );

	set_pev ( iEntity, pev_nextthink, get_gametime( ) + 1.0 );

	

	return PLUGIN_HANDLED;

}



stock GetInfo( id, const iInfo )

{

	new szInfoToReturn[ 64 ];

	

	switch( iInfo )

	{

		case INFO_NAME:

		{

			new szName[ 32 ];

			get_user_name( id, szName, sizeof ( szName ) -1 );

			

			copy( szInfoToReturn, sizeof ( szInfoToReturn ) -1, szName );

		}

	}

	

	return szInfoToReturn;

}



stock bool:UTIL_IsValidMessage( const szSaid[ ] )

{

	new iLen = strlen( szSaid );

	

	if( !iLen )

	{

		return false;

	}

	

	for( new i = 0; i < iLen; i++ )

	{

		if( szSaid[ i ] != ' ' )

		{

			return true;

		}

	}

	

	return false;

}



public Load( id )

{

	new szIp[ 40 ], szVaultKey[ 64 ], szVaultData[ 64 ];

	get_user_ip( id, szIp, charsmax ( szIp ) );

	

	formatex( szVaultKey, charsmax( szVaultKey ), "%s", szIp );

	nvault_get( iVault, szVaultKey, szVaultData, charsmax ( szVaultData ) );

	

	new iGagOn[ 32 ], iGagTime [ 32 ];

	parse( szVaultData, iGagOn, charsmax ( iGagOn ), iGagTime, charsmax ( iGagTime ) );

	

	PlayerGagged[ id ] = str_to_num ( iGagOn );

	PlayerGagTime[ id ] = str_to_num ( iGagTime );

	

}



public Save(  id  )

{

	

	new szIp[ 40 ], szVaultKey[ 64 ], szVaultData[ 64 ];

	get_user_ip( id, szIp, charsmax( szIp ) );

	

	formatex( szVaultKey, charsmax( szVaultKey ), "%s", szIp );

	formatex( szVaultData, charsmax( szVaultData ), "%i %i", PlayerGagged[ id ], PlayerGagTime[ id ] );

	

	nvault_set( iVault, szVaultKey, szVaultData );

}



public plugin_end( )

{

	nvault_close( iVault );

}

stock chat_color(const id, const input[], any:...)

{

	new count = 1, players[32]

	static msg[320]

	vformat(msg, 190, input, 3)

	replace_all(msg, 190, "!g", "^4")

	replace_all(msg, 190, "!n", "^1")

	replace_all(msg, 190, "!t", "^3")

	replace_all(msg, 190, "!t2", "^0")

	

	if (id)

		players[0] = id;

	else

		get_players(players, count, "ch")

	

	

	for (new i = 0; i < count; i++)

	{

		if (is_user_connected(players))

		{

			message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players)

			write_byte(players)

			write_string(msg)

			message_end()

		}

	}

}
Olium
User avatar
Sorinel
Fost moderator
Fost moderator
Posts: 6186
Joined: 25 Aug 2014, 20:31
Detinator Steam: Da
CS Status: All i ever wanted was a Roley Roley
SteamID: Jandarmeria
Reputatie: Fost Membru Club eXtreamCS ( o luna )
Fost eXtream Mod
Fost Intermediar
Nume anterior: Christmas, A k c 3 n 7
Fond eXtream: 0
Location: Ploiesti

25 Apr 2018, 13:50

ia vezi
| Afiseaza codul
#include < amxmodx >

#include < amxmisc >



#include < fakemeta >

#include < engine >

#include < nvault >



#define PLUGIN "Special Admin Gag"

#define VERSION "1.0"



#define COMMAND_ACCESS  	ADMIN_KICK // accesu adminilor pentru comanda

#define MAX_PLAYERS 		33



#define			SAVEDATA_FILE			"GagSaveDataFile"



enum {

	INFO_NAME

};



new const bars[ ] = "/";



new command[ ] [ ] =  {

	"/gag"

};



new Caccess[ ] =  {

	COMMAND_ACCESS,

	COMMAND_ACCESS

};



new const gGagFileName[ ] = "gag_words.ini";



new const gGagThinkerClassname[ ] = "GagThinker_";



new PlayerGagged[ MAX_PLAYERS ];

new PlayerGagTime[ MAX_PLAYERS ];

new JoinTime[ MAX_PLAYERS ];

new szName[ 33 ];



new g_Words[ 562 ] [ 32 ], g_Count;



new gCvarSwearGagTime;

new gCvarGagMinuteLimit;

new gCvarGagMinuteInSeconds;

new gCvarAdminGag;

new gCvarWords;



new gMaxPlayers;

new iVault;



new SaveDataFile [ 128 ];



public plugin_init( ) 

{

	register_plugin( PLUGIN, PLUGIN, "Cristi .C" );

	

	register_concmd( "amx_gag", "CommandGag" ); 

	register_concmd( "amx_ungag", "CommandUngag" );

	

	register_clcmd( "say", "CheckGag" );

	register_clcmd( "say_team", "CheckGag" );

	

	register_clcmd( "say", "command_chat" );

	

	GagThinker( );

	register_think( gGagThinkerClassname, "Forward_GagThinker" );

	

        gCvarSwearGagTime = register_cvar( "amx_autogag_time", "3" ); // minutele pentru gag cand ia autogag

        gCvarGagMinuteLimit = register_cvar( "amx_gag_minute_limit", "10" ); // limita maxima pentru gag minute

        gCvarGagMinuteInSeconds = register_cvar( "amx_gag_minute_in_seconds", "60" ); // minute in secunde

        gCvarAdminGag = register_cvar( "amx_admingag", "1" ); // poti da si la admini gag daca e egal cu 1, daca e 0 nu poti

        gCvarWords = register_cvar( "amx_maxwords", "900" ); // lista maxima de cuvinte in gag_words.ini

	

	iVault  =  nvault_open(  "GagSystem"  );

	

	if(  iVault  ==  INVALID_HANDLE  )

	{

		set_fail_state(  "nValut returned invalid handle!"  );

	}

	

	gMaxPlayers = get_maxplayers( );

	

	new DataDir [ 64 ];

	get_datadir ( DataDir, 63 );

	format ( SaveDataFile, 127, "%s/%s.dat", DataDir, SAVEDATA_FILE );

}



public plugin_cfg( ) 

{

	static szConfigDir[ 64 ], iFile[ 64 ];

	

	get_localinfo ( "amxx_configsdir", szConfigDir, 63 );

	formatex ( iFile , charsmax( iFile ) , "%s/%s" , szConfigDir, gGagFileName );

	

	if( !file_exists( iFile ) )

	{

		write_file( iFile, "# Pune aici cuvintele jignitoare sau reclamele", -1 );

	}

	

	new szBuffer[ 128 ];

	new szFile = fopen( iFile, "rt" );

	

	while( !feof( szFile ) )

	{

		fgets( szFile, szBuffer, charsmax( szBuffer ) );

		

		if( szBuffer[ 0 ] == '#' )

		{

			continue;

		}

		

		parse( szBuffer, g_Words[ g_Count ], sizeof g_Words[ ] - 1 );

		g_Count++;

		

		if( g_Count >= get_pcvar_num ( gCvarWords ) )

		{

			break;

		}

	}

	

	fclose( szFile );

}





public client_putinserver( id ) 

{ 

	if ( is_user_connected( id ) )

	{

		JoinTime[ id ] = get_systime( );

		Load ( id );

	}

}



public client_disconnect ( id ) {

	

	if ( PlayerGagged [ id ] )

		Save ( id );

}



public SaveData ( client ) {

	

	new Name [ 32 ];

	get_user_name ( client, Name, 31 );

	

	new _Gagged = PlayerGagged [ client ];

	new _GagTime = PlayerGagTime [ client ];

	

	new StrongData [ 1024 ];

	formatex ( StrongData, sizeof ( StrongData ) - 1, "^"%i^" ^"%i^"", _Gagged, _GagTime );

	

	new Save [ 1024 ];

	format ( Save, sizeof ( Save ) - 1, "^"%s^" %s", Name, StrongData );

	

	new Line [ 128 ], Linie, IsPlayer = false, Arg1 [ 32 ];

	

	new FileOpen = fopen ( SaveDataFile, "rt" );

	while ( !feof ( FileOpen ) ) {

		fgets ( FileOpen, Line, 127 );

		trim ( Line );

		

		parse ( Line, Arg1, 31 );

		

		if ( equali ( Arg1, Name ) ) {

			write_file ( SaveDataFile, Save, Linie );

			IsPlayer = true;

			break;

		}

		

		Linie++;

	}

	

	fclose ( FileOpen );

	if ( !IsPlayer )

		write_file ( SaveDataFile, Save, -1 );

}



public LoadData ( client ) {

	

	new Name [ 32 ];

	get_user_name ( client, Name, 31 );

	

	new Line [ 128 ], IsPlayer = false, Arg1 [ 32 ], Arg2 [ 32 ], Arg3 [ 32 ];

	new FileOpen = fopen ( SaveDataFile, "rt" );

	

	while ( !feof ( FileOpen ) ) {

		

		fgets ( FileOpen, Line, 127 );

		trim ( Line );

		

		parse ( Line, Arg1, 31, Arg2, 31, Arg3, 31 );

		

		if ( equali ( Arg1, Name ) ) {

			

			PlayerGagged [ client ] = str_to_num ( Arg2 );

			PlayerGagTime [ client ] = str_to_num ( Arg3 );

			

			IsPlayer = true;

			break;

		}

	}

	

	fclose ( FileOpen );

	

	if ( !IsPlayer ) {

		

		PlayerGagged [ client ] = 0;

		PlayerGagTime [ client ]  = 0;

		

		

	}

}



public command_chat( index )

{

	static szArg[ 192 ], command2[ 192 ];

	

	read_args( szArg, charsmax ( szArg ) );

	

	if( ! szArg [ 0 ] )

		return PLUGIN_CONTINUE;

	

	remove_quotes( szArg[0] );

	

	for( new x; x < sizeof command; x++ )

	{

		if ( equal ( szArg, command [ x ], strlen ( command [ x ] ) ) )

		{

			if ( get_user_flags ( index ) & Caccess [ x ] )

			{

				replace( szArg, charsmax ( szArg ), bars, "" );

				formatex( command2, charsmax(command2), "amx_%s", szArg );

				client_cmd( index, command2 );

			}	

			

			break;

		}

	}

	

	return PLUGIN_CONTINUE;

}



public CheckGag( id ) 

{

	new szSaid[ 300 ];

	

	read_args( szSaid, charsmax( szSaid ) );

	remove_quotes( szSaid );

	

	if( !UTIL_IsValidMessage( szSaid ) )

	{

		return PLUGIN_HANDLED;

	}

	

	if ( PlayerGagged[ id ] == 1 ) 

	{

		PlayerGagged[ id ] = 1;

		

		chat_color( id, "^4[FURY] ^1Ai primit ^4GAG ^1Pentru ^3LIMBAJ ^1sau ^3RECLAMA ^1Timp Ramas ^4%d ^1Minut(e)!", PlayerGagTime[ id ] );	

		

		return PLUGIN_HANDLED;

	}

	

	else

	{

		new i;

		for( i = 0; i < get_pcvar_num ( gCvarWords ); i++ )

		{

			if( containi( szSaid, g_Words[ i ] ) != -1 )

			{
				if( get_pcvar_num( gCvarAdminGag ) == 0 )

				{

					if ( is_user_admin ( id ) )

					{	

						return 1;

					}

				}

				

				PlayerGagged[ id ] = 1;

				PlayerGagTime[ id ] = get_pcvar_num ( gCvarSwearGagTime );

				set_speak( id, SPEAK_MUTED );

				

				chat_color( id, "^4[FURY] ^1Ai Primit ^4Auto-Gag ^1Pentru ^3LIMBAJ ^1sau ^3RECLAMA ^1Timp Ramas ^4%d ^1Minut(e)", PlayerGagTime[ id ] );

				

				//SaveGagedPlayers( id );

				return PLUGIN_HANDLED;

			}

		}

	}

	

	return PLUGIN_CONTINUE;

}



public CommandGag( id )  

{  

	if( !(get_user_flags( id ) & COMMAND_ACCESS ) )

	{

		client_cmd( id, "echo [FURIEN] Nu ai acces la aceasta comanda!" );

		return 1;

	}

	

	new szArg[ 32 ], szMinutes[ 32 ];

	

	read_argv( 1, szArg, charsmax ( szArg ) );

	

	if( equal( szArg, "" ) )

	{

		client_cmd( id, "echo amx_gag < nume > < minute >" );

		return 1;

	}

	

	new iPlayer = cmd_target( id, szArg, CMDTARGET_ALLOW_SELF );

	

	if( !iPlayer )

	{

		client_cmd( id, "echo [FURIEN] Jucatorul cu acel nume nu a fost gasit!" );

		return 1;

	}

	

	if ( get_pcvar_num( gCvarAdminGag ) == 0 )

	{

		if ( is_user_admin( iPlayer ) )

		{

			client_cmd( id, "echo [FURIEN] Nu poti da gag la Admini!" );

			return 1;

		}

	}

	

	read_argv( 2, szMinutes, charsmax ( szMinutes ) );

	

	new iMinutes = str_to_num( szMinutes );

	

	if ( iMinutes > get_pcvar_num ( gCvarGagMinuteLimit ) )

	{

		console_print( id, "Ai setat %d minute, iar limita maxima de minute este %d! Setare automata pe %d.", iMinutes, get_pcvar_float ( gCvarGagMinuteLimit ), get_pcvar_float ( gCvarGagMinuteLimit ) );

		iMinutes = get_pcvar_num( gCvarGagMinuteLimit ) ;

	}

	

	get_user_name( iPlayer, szName, sizeof ( szName ) -1 );

	

	if( PlayerGagged[ iPlayer ] == 1 ) 

	{

		client_cmd( id, "echo [FURIEN] Jucatorul %s are deja gag!", GetInfo( iPlayer, INFO_NAME ) );

		return 1;

	}

	

	PlayerGagged[ iPlayer ] = 1;

	PlayerGagTime[ iPlayer ] = iMinutes;

	set_speak( iPlayer, SPEAK_MUTED );

	

	chat_color(0, "^4[FURY] ^1Admin-ul ^4%s ^1i-a dat ^4GAG ^1Jucator-ului ^4%s ^1Pentru ^4%d ^1Minut(e)", GetInfo( id, INFO_NAME ), GetInfo( iPlayer, INFO_NAME ), iMinutes ); 

	chat_color(iPlayer, "^4[FURY] ^1Ai primit ^4GAG ^1pentru ^3LIMBAJ ^1sau ^3RECLAMA" ); 

	

	//SaveGagedPlayers( id );

	return PLUGIN_HANDLED;

}



public CommandUngag( id )  

{  

	if( !(get_user_flags( id ) & COMMAND_ACCESS ) )

	{

		client_cmd( id, "echo [FURIEN] Nu ai acces la aceasta comanda!" );

		return 1;

	}

	

	new szArg[ 32 ];

	

	read_argv( 1, szArg, charsmax( szArg ) );

	

	if( equal( szArg, "" ) )

	{

		client_cmd( id, "echo amx_ungag < nume > !" );

		return 1;

	}

	

	new iPlayer = cmd_target ( id, szArg, CMDTARGET_ALLOW_SELF );

	

	if( !iPlayer )

	{

		client_cmd(  id, "echo [FURIEN] Jucatorul cu acel nume nu a fost gasit!" );

		return 1;

	}

	

	if( PlayerGagged[ iPlayer ] == 0 ) 

	{

		console_print( id, "[FURIEN] Jucatorul %s nu are Gag!", GetInfo( iPlayer, INFO_NAME ) );

		return 1;

	}

	

	PlayerGagged[ iPlayer ] = 0;

	PlayerGagTime[ iPlayer ] = 0;

	set_speak( iPlayer, SPEAK_NORMAL );

	

	chat_color(0, "^4[FURY] ^1Admin-ul ^4%s ^1i-a dat ^4UnGag ^1Jucator-ului ^4%s", GetInfo( id, INFO_NAME ), GetInfo( iPlayer, INFO_NAME ) ); 

	

	Save( iPlayer );

	return PLUGIN_HANDLED;

}



public Forward_GagThinker( iEntity )

{

	if ( pev_valid( iEntity ) )

	{

		set_pev( iEntity, pev_nextthink, get_gametime( ) + 1.0 ) ;

		

		new id;

		for ( id = 1; id <= gMaxPlayers; id++ )

		{

			if ( is_user_connected ( id ) 	

			&& ! is_user_bot( id )

			&& PlayerGagged[ id ] == 1 

			&& PlayerGagTime[ id ] > 0

			&& ( ( get_systime( ) - JoinTime[ id ] ) >= get_pcvar_num ( gCvarGagMinuteInSeconds ) ) ) {

				JoinTime[ id ] = get_systime( );

				PlayerGagTime[ id ] -= 1;

				

				if ( PlayerGagTime[ id ] <= 0 )

				{

					PlayerGagTime[ id ] = 0;

					PlayerGagged[ id ] = 0;

					set_speak( id, SPEAK_NORMAL );

					Save(id)

				}

			}

		}

	}

}







stock GagThinker( )

{

	new iEntity = create_entity ( "info_target" );

	

	if( ! pev_valid ( iEntity ) )

	{

		return PLUGIN_HANDLED;

	}

	

	set_pev ( iEntity, pev_classname, gGagThinkerClassname );

	set_pev ( iEntity, pev_nextthink, get_gametime( ) + 1.0 );

	

	return PLUGIN_HANDLED;

}



stock GetInfo( id, const iInfo )

{

	new szInfoToReturn[ 64 ];

	

	switch( iInfo )

	{

		case INFO_NAME:

		{

			new szName[ 32 ];

			get_user_name( id, szName, sizeof ( szName ) -1 );

			

			copy( szInfoToReturn, sizeof ( szInfoToReturn ) -1, szName );

		}

	}

	

	return szInfoToReturn;

}



stock bool:UTIL_IsValidMessage( const szSaid[ ] )

{

	new iLen = strlen( szSaid );

	

	if( !iLen )

	{

		return false;

	}

	

	for( new i = 0; i < iLen; i++ )

	{

		if( szSaid[ i ] != ' ' )

		{

			return true;

		}

	}

	

	return false;

}



public Load( id )

{

	new szIp[ 40 ], szVaultKey[ 64 ], szVaultData[ 64 ];

	get_user_ip( id, szIp, charsmax ( szIp ) );

	

	formatex( szVaultKey, charsmax( szVaultKey ), "%s", szIp );

	nvault_get( iVault, szVaultKey, szVaultData, charsmax ( szVaultData ) );

	

	new iGagOn[ 32 ], iGagTime [ 32 ];

	parse( szVaultData, iGagOn, charsmax ( iGagOn ), iGagTime, charsmax ( iGagTime ) );

	

	PlayerGagged[ id ] = str_to_num ( iGagOn );

	PlayerGagTime[ id ] = str_to_num ( iGagTime );

	

}



public Save(  id  )

{

	

	new szIp[ 40 ], szVaultKey[ 64 ], szVaultData[ 64 ];

	get_user_ip( id, szIp, charsmax( szIp ) );

	

	formatex( szVaultKey, charsmax( szVaultKey ), "%s", szIp );

	formatex( szVaultData, charsmax( szVaultData ), "%i %i", PlayerGagged[ id ], PlayerGagTime[ id ] );

	

	nvault_set( iVault, szVaultKey, szVaultData );

}



public plugin_end( )

{

	nvault_close( iVault );

}

stock chat_color(const id, const input[], any:...)

{

	new count = 1, players[32]

	static msg[320]

	vformat(msg, 190, input, 3)

	replace_all(msg, 190, "!g", "^4")

	replace_all(msg, 190, "!n", "^1")

	replace_all(msg, 190, "!t", "^3")

	replace_all(msg, 190, "!t2", "^0")

	

	if (id)

		players[0] = id;

	else

		get_players(players, count, "ch")

	

	

	for (new i = 0; i < count; i++)

	{

		if (is_user_connected(players))

		{

			message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players)

			write_byte(players)

			write_string(msg)

			message_end()

		}

	}

}
N.A.S.A.
Membru, skill 0
Membru, skill 0
Posts: 99
Joined: 14 Feb 2018, 15:56
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

25 Apr 2018, 13:55

Code: Select all

L 04/25/2018 - 14:53:53: Start of error session.
L 04/25/2018 - 14:53:53: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20180425.log")
L 04/25/2018 - 14:53:53: [AMXX] Displaying debug trace (plugin "amx_gag.amxx")
L 04/25/2018 - 14:53:53: [AMXX] Run time error 4: index out of bounds 
L 04/25/2018 - 14:53:53: [AMXX]    [0] amx_gag.sma::CheckGag (line 535)
L 04/25/2018 - 14:54:40: Start of error session.
L 04/25/2018 - 14:54:40: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20180425.log")
L 04/25/2018 - 14:54:40: [AMXX] Displaying debug trace (plugin "amx_gag.amxx")
L 04/25/2018 - 14:54:40: [AMXX] Run time error 4: index out of bounds 
L 04/25/2018 - 14:54:40: [AMXX]    [0] amx_gag.sma::CheckGag (line 535)
L 04/25/2018 - 14:54:42: [AMXX] Displaying debug trace (plugin "amx_gag.amxx")
L 04/25/2018 - 14:54:42: [AMXX] Run time error 4: index out of bounds 
L 04/25/2018 - 14:54:42: [AMXX]    [0] amx_gag.sma::CheckGag (line 535)
L 04/25/2018 - 14:54:47: [AMXX] Displaying debug trace (plugin "amx_gag.amxx")
L 04/25/2018 - 14:54:47: [AMXX] Run time error 4: index out of bounds 
L 04/25/2018 - 14:54:47: [AMXX]    [0] amx_gag.sma::CheckGag (line 535)
Post Reply

Return to “Probleme in jocul Counter-Strike”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 14 guests