This allows me to enter without entering a password. Checking if it's null? - 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: This allows me to enter without entering a password. Checking if it's null? (
/showthread.php?tid=573853)
This allows me to enter without entering a password. Checking if it's null? -
Dokins - 11.05.2015
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_LOGIN)
{
if(response == 0)
{
Kick(playerid);
}
else
{
new query[256], password[128];
format(query, sizeof(query), "SELECT `Password` FROM `accounts` WHERE id = %d", PlayerSQLID[playerid]);
mysql_query(query);
mysql_store_result();
mysql_fetch_row(password);
mysql_free_result();
new string[300];
format(string, sizeof(string), "Welcome to %s\n\nYou entered a wrong password, please try again:", HOSTNAME);
if(isnull(password))return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Please retry your password", string, "Login", "Leave");
if(strcmp(password, inputtext, false) == 0)
{
Title says all!
Thanks for any assistance.
Re: This allows me to enter without entering a password. Checking if it's null? -
Dokins - 11.05.2015
RESOLVED.
Re: This allows me to enter without entering a password. Checking if it's null? -
Threshold - 11.05.2015
Yes, strcmp returns 0 when both strings match OR if either of the strings is empty, for future reference.