SA-MP Forums Archive
How i can use strcmp for this [REP + ho help] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How i can use strcmp for this [REP + ho help] (/showthread.php?tid=563443)



How i can use strcmp for this [REP + ho help] - bigboy81 - 15.02.2015

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


Re: How i can use strcmp for this [REP + ho help] - xVIP3Rx - 15.02.2015

Use strlen .

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



Re: How i can use strcmp for this [REP + ho help] - bigboy81 - 15.02.2015

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.


Re: How i can use strcmp for this [REP + ho help] - xVIP3Rx - 15.02.2015

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.


Re: How i can use strcmp for this [REP + ho help] - bigboy81 - 15.02.2015

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;
	}



Re: How i can use strcmp for this [REP + ho help] - PaulDinam - 15.02.2015

You're doing it wrong.

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


Re: How i can use strcmp for this [REP + ho help] - bigboy81 - 16.02.2015

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


Re: How i can use strcmp for this [REP + ho help] - AndySedeyn - 16.02.2015

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'.


Re: How i can use strcmp for this [REP + ho help] - Banana_Ghost - 16.02.2015

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.


Re: How i can use strcmp for this [REP + ho help] - bigboy81 - 16.02.2015

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