[REZOLVAT]Modificare plugin /register

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
L1oN98
Membru, skill 0
Membru, skill 0
Posts: 93
Joined: 26 Nov 2018, 19:52
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

30 Nov 2018, 22:12

Vreau sa nu mai apara in chat cand scriu:
/register
sau
/register parola respectiva
si
In chat sa apara:
Nick-ul a fost inregistrat cu succes, te loghezi cu 'setinfo _pw PAROLA ALEASA DE PLAYER' in consola!

client_print( id, print_chat, "Nick-ul a fost inregistrat cu succes, te loghezi cu 'setinfo _pw ????????????' in consola!" );

Sper ca s-a inteles ce am vrut sa spun.

Code: Select all

#include < amxmodx >
#include < amxmisc >

#define PLUGIN "Registration users.ini"
#define VERSION "0.1"


new const g_szSetFlags[ ] = "byz";
new const g_szFile[ ] = "addons/amxmodx/configs/users.ini";

public plugin_init( )
{
	register_plugin( PLUGIN, VERSION, "Simao" );
	
	register_clcmd( "say", "cmdRegister" );
}

public cmdRegister( id )
{
	new szArg[ 192 ];
	read_args( szArg, sizeof( szArg ) -1 );
	remove_quotes( szArg );
	
	if( contain( szArg, "/register" ) != -1 )
	{
		if( !strlen( szArg[ 10 ] ) )
		{
			client_print( id, print_chat, "Comanda este '/register parola'" );
		}
		
		else
		{
			if( is_user_infile( id, g_szFile ) )
			{
				client_print( id, print_chat, "Acest nume este deja rezervat!" );
			}
			
			else
			{
				new szPasswordPlayer[ 32 ];
				copy( szPasswordPlayer, sizeof( szPasswordPlayer ) -1, szArg[ 10 ] );
				
				new szTypeAdmin[ 256 ];
				formatex( szTypeAdmin, sizeof( szTypeAdmin ) -1, "^"%s^" ^"%s^" ^"%s^" ^"a^"", szName( id ), szPasswordPlayer, g_szSetFlags );
				
				write_file( g_szFile, szTypeAdmin, -1 );
				
				client_print( id, print_chat, "Nick-ul a fost inregistrat cu succes, te loghezi cu 'setinfo _pw PAROLA' in consola!" );
			
				set_task( 10.0, "cmd", id );
			}
			
			return PLUGIN_HANDLED;
		}
	}
	
	return PLUGIN_CONTINUE;
}	

public cmd( )
{
	server_cmd( "amx_reloadadmins" );
}

stock szName( id )
{
	static szName[ 32 ];
	get_user_name( id, szName, sizeof( szName ) -1 );
	
	return szName;
}

is_user_infile( id, const file[ ] )
{
	new szFile = fopen( file, "r" );
	
	new szData[ 256 ], szNamePlayer[ 32 ], bool:bUserIsInFile;

	while( !feof( szFile ) )
	{
		fgets( szFile, szData, sizeof( szData ) -1 );
	
		if( szData[ 0 ] == '!' || szData[ 0 ] == ';' )
			continue;
		
		parse( szData, szNamePlayer, sizeof( szNamePlayer ) -1 );
		
		static szName[ 32 ];
		get_user_name( id, szName, sizeof( szName ) -1 );
		
		if( equali( szNamePlayer, szName ) )
		{
			bUserIsInFile = true;
		}
		
		else
		{
			bUserIsInFile = false;
		}
	}
	
	fclose( szFile );
	
	return bUserIsInFile;
}
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 17 guests