/unban Command.
#1

Hi,
I try to make an /unban command. I use LAdmin4v2 edited with ZCMD, SScanf and foreach!
Here is the command:
Код:
CMD:unban( PARAMS )
{
	LevelCheck( playerid, 10 );
	LoginCheck( playerid );
    if ( sscanf( params, "s[128]", params[0] ) ) return SendClientMessage( playerid, COLOR_ULTRARED, "USAGE: {33CCFF}/unban [Player Name]" );

	new file[ 128 ];
	format( file, 128, "/ladmin/users/%s.sav", params[0] );
	if ( !udb_Exists( file ) ) return SendClientMessage( playerid, COLOR_ULTRARED, "ERROR: This player doesnt have an account" );

	dUserSetINT( params[0] ).( "Banned", 0 );
	PlayerPlaySound( playerid, 1057, 0.0, 0.0, 0.0 );
	FormatMSG( playerid, COLOR_YELLOW, "Account '%s' has been succes fully UnBanned!", params[0] );
	return 1;
}
When i type /unban Existent account in scriptfiles it shows me: "Command /unban accountname doesn't not exist...", but when i type /unban unexisten account in scriptfiles it tells me true: "ERROR: This player doesnt have an account"

What's the problem with that command?
Reply
#2

PHP код:
CMD:unban(playeridparams[])
{
    
LevelCheckplayerid10 );
    
LoginCheckplayerid );
    if (
sscanf(params"s[128]"params[0])) return SendClientMessage(playeridCOLOR_ULTRARED"USAGE: {33CCFF}/unban [Player Name]" );
    new 
file128 ];
    
formatfile128"/ladmin/users/%s.sav"params[0] );
    if ( !
udb_Existsfile ) ) return SendClientMessageplayeridCOLOR_ULTRARED"ERROR: This player doesnt have an account" );
    
dUserSetINTparams[0] ).( "Banned");
    
PlayerPlaySoundplayerid10570.00.00.0 );
    
FormatMSGplayeridCOLOR_YELLOW"Account '%s' has been succes fully UnBanned!"params[0] );
    return 
1;

Reply
#3

if ( !udb_Exists( file ) )

udb_Exists is made for player account's location, so change
Код:
if ( !udb_Exists( file ) )
to
Код:
if ( !udb_Exists( params[ 0 ] ) )
@GameOver: "u" is for player, "s" is for a string, he want to unban a disconnected player, not a connected one, connected players are not banned.
Reply
#4

Quote:
Originally Posted by costel_nistor96
Посмотреть сообщение
if ( !udb_Exists( file ) )

udb_Exists is made for player account's location, so change
Код:
if ( !udb_Exists( file ) )
to
Код:
if ( !udb_Exists( params[ 0 ] ) )
@GameOver: "u" is for player, "s" is for a string, he want to unban a disconnected player, not a connected one, connected players are not banned.
Then I misread, edited.
Reply
#5

Quote:
Originally Posted by costel_nistor96
Посмотреть сообщение
if ( !udb_Exists( file ) )

udb_Exists is made for player account's location, so change
Код:
if ( !udb_Exists( file ) )
to
Код:
if ( !udb_Exists( params[ 0 ] ) )
@GameOver: "u" is for player, "s" is for a string, he want to unban a disconnected player, not a connected one, connected players are not banned.
Thanks you it works! xD +1 at rep.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)