How i can use strcmp for this [REP + ho help]
#1

How to check using strcmp or strfind if dialog inputtext are empty ?
Reply
#2

Use strlen .

Examples
pawn Код:
if(!strlen(inputtext))
//Or
if(!inputtext[0])
Reply
#3

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
Use strlen .

Examples
pawn Код:
if(!strlen(inputtext))
//Or
if(!inputtext[0])
Yes i use that but when player are typed something server showing him that he not type anything.
Reply
#4

Is it only this dialog or for all the dialogs ?
You could add a debug to know what's he writing, or post the script.
Reply
#5

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
Is it for all the dialogs or just this one, Show us the script for that part.
This is just for one dialog

Код:
if(strlen(inputtext))
	{
 		SCM(playerid, COLOR_LIGHTRED, "{157DEC}You are not type an{FFFFFF}Email");
 		ShowPlayerDialog(playerid, 6, DIALOG_STYLE_INPUT, "E-Mail", "{FFFFFF}Please type your{157DEC}e-mail {FFFFFF}adress", "Ok", "" );
   		return 1;
	}
Reply
#6

You're doing it wrong.

You can also use isnull(inputtext) or for your problem, if(strlen(inputtext) == 0)
Reply
#7

I make like this

if(!isnull(inputtext))
{
SCM(playerid, COLOR_LIGHTRED, "{157DEC}You are not type an{FFFFFF}Email");
ShowPlayerDialog(playerid, 6, DIALOG_STYLE_INPUT, "E-Mail", "{FFFFFF}Please type your{157DEC}e-mail {FFFFFF}adress", "Ok", "" );
return 1;
}

But not work,it say i not type anything but i type
Reply
#8

Quote:
Originally Posted by bigboy81
Посмотреть сообщение
I make like this

if(!isnull(inputtext))
{
SCM(playerid, COLOR_LIGHTRED, "{157DEC}You are not type an{FFFFFF}Email");
ShowPlayerDialog(playerid, 6, DIALOG_STYLE_INPUT, "E-Mail", "{FFFFFF}Please type your{157DEC}e-mail {FFFFFF}adress", "Ok", "" );
return 1;
}

But not work,it say i not type anything but i type
The isnull function already checks whether or not the input is empty.
The function returns 1 when the input is empty and returns 0 when the input is not empty. By placing an exclamation mark, you tell the function that 'When the input is NOT null (there is an input), execute the code'.
Reply
#9

forgot to remove the ! from isnull
pawn Код:
if(isnull(inputtext))
{
    SCM(playerid, COLOR_LIGHTRED, "{157DEC}You are not type an{FFFFFF}Email");
    ShowPlayerDialog(playerid, 6, DIALOG_STYLE_INPUT, "E-Mail", "{FFFFFF}Please type your{157DEC}e-mail       {FFFFFF}adress", "Ok", "" );
    return 1;
}
basically what you were doing was if it wasn't empty.
Reply
#10

Quote:
Originally Posted by Banana_Ghost
Посмотреть сообщение
forgot to remove the ! from isnull
pawn Код:
if(isnull(inputtext))
{
    SCM(playerid, COLOR_LIGHTRED, "{157DEC}You are not type an{FFFFFF}Email");
    ShowPlayerDialog(playerid, 6, DIALOG_STYLE_INPUT, "E-Mail", "{FFFFFF}Please type your{157DEC}e-mail       {FFFFFF}adress", "Ok", "" );
    return 1;
}
basically what you were doing was if it wasn't empty.
I making email system,but i want if player not type in inputtext email conditional return that
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)