if(strcmp .... - 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: if(strcmp .... (
/showthread.php?tid=641777)
if(strcmp .... -
Oficer - 20.09.2017
Hi, why -> if(strcmp(password, inputtext)) .... is not working ? Player give false password and is connecting?
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 2)
{
if(response == 1)
{
mysql_format(SqlGM, samp, sizeof(samp), "SELECT `password` FROM `players` WHERE `nick` LIKE BINARY `%s`", GetPlayerNick(playerid));
mysql_query(SqlGM, samp, true);
cache_get_field_content(0, "password", password);
if(strcmp(password, inputtext))
{
format(samp, sizeof(samp), ""RED"Wrong password!");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, ""ORANGE"Loging", samp, ""GREEN"next", ""RED"back");
return 1;
}
else
{
format(string,sizeof(string),""RED"[LOGING]: "WHITE" your password is correct!, account "GREEN" is connecting.");
SendClientMessage(playerid, -1, string);
TogglePlayerSpectating(playerid, 0);
SpawnPlayer(playerid);
}
}
}
...
Re: if(strcmp .... -
BiosMarcel - 20.09.2017
You have to negate the call, strcmp yields false if the strings match, look at the wiki:
https://sampwiki.blast.hk/wiki/Using_strcmp%28%29
Re: if(strcmp .... -
kAn3 - 20.09.2017
NO NO NO UN-HASHED PWORDS OMG
Re: if(strcmp .... -
Deadpoop - 20.09.2017
hash the passwords!!!
Re: if(strcmp .... -
n00blek - 20.09.2017
use udb_hash
Re: if(strcmp .... -
Oficer - 20.09.2017
How to make it?
I just started learning pawn.
Re: if(strcmp .... -
Burridge - 20.09.2017
Quote:
Originally Posted by n00blek
use udb_hash
|
Or use the default hashing function provided by SA-MP itself which would be far more secure than udb_hash.
Quote:
Originally Posted by Oficer
How to make it?
I just started learning pawn.
|
Take time to read the
wiki as it contains a lot of information which is vital to learning how the callbacks etc. work and how best to use them. Also take a look at the tutorial board on this forum as there are some very well written tutorials there.
I would probably start with something a little smaller than a user system, especially if it's going to be a mysql system. Mysql is a language in its own right which means what you are doing right now is trying to learn two languages at once.