help | mysql
#1

hello !

I started to learn MySQL.
I downloaded this plugin:

https://sampforum.blast.hk/showthread.php?tid=56564

Now I have a small problem in the code:
pawn Код:
if(dialogid == LogDialog)
    {
        if(!response) return SendClientMessage(playerid,c_red,"...בחרת לא להתחבר ולכן קיבלת קיק"),Kick(playerid),0;
        if(!strlen(inputtext))
        {
            format(String,256,"{ffffff}!\"%s\" שלום\n{%s}Proffesional DeathMeath ברוך הבא לקהילת\nעל מנת להמשיך לשחק\n:הקש את הסיסמה שאיתה נרשמת",GetName(playerid),GetHColor(c_yellow));
            return ShowPlayerDialog(playerid,LogDialog,DIALOG_STYLE_INPUT,"\t\t\t\t{ffffff}התחברות לשרת",String,"התחבר","");
        }
        format(String,256,"SELECT Password FROM Users WHERE Nick='%s'",GetName(playerid));
        if(strcmp(inputtext,mysql_query(String),true)==0)
        {
            SendClientMessage(playerid,c_green,"!התחברת בהצלחה");
            Logged[playerid] = true;
        }
        else
        {
            LoginsErrors[playerid]++;
            format(String,256,"(%i/3) !סיסמה שגויה",LoginsErrors[playerid]);
            SendClientMessage(playerid,c_red,String);
            if(LoginsErrors[playerid] == 3) return Kick(playerid);
            format(String,256,"{ffffff}!\"%s\" שלום\n{%s}Proffesional DeathMeath ברוך הבא לקהילת\nעל מנת להמשיך לשחק\n:הקש את הסיסמה שאיתה נרשמת",GetName(playerid),GetHColor(c_yellow));
            ShowPlayerDialog(playerid,LogDialog,DIALOG_STYLE_INPUT,"\t\t\t\t{ffffff}התחברות לשרת",String,"התחבר","");
        }
    }
this login system code.
and this errors:

pawn Код:
C:\Users\user\Desktop\чйцешй гшк - ощзчйн\Server\gamemodes\PDM.pwn(212) : error 035: argument type mismatch (argument 2)
C:\Users\user\Desktop\чйцешй гшк - ощзчйн\Server\gamemodes\PDM.pwn(262) : error 010: invalid function or declaration
C:\Users\user\Desktop\чйцешй гшк - ощзчйн\Server\gamemodes\PDM.pwn(262 -- 268) : error 017: undefined symbol "a"
C:\Users\user\Desktop\чйцешй гшк - ощзчйн\Server\gamemodes\PDM.pwn(262 -- 269) : error 054: unmatched closing brace ("}")
C:\Users\user\Desktop\чйцешй гшк - ощзчйн\Server\gamemodes\PDM.pwn(262 -- 269) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.
the lain of errors:

pawn Код:
if(strcmp(inputtext,mysql_query(String),true)==0)
thanks for the helpers !
Reply
#2

Like I said in your last topic, mysql_query returns 1 on success and 0 on failure.
If you want to check if the player's password is correct you could use a query and mysql_num_rows.
pawn Код:
new query[128];
format(query, sizeof (query), "SELECT * FROM `users` WHERE `name` = '%s' AND `password` = '%s';", ...);
mysql_query(query);
mysql_store_result();
if (mysql_num_rows())
{
    // player has got the password right, do something
}
else
{
    // the player sent a wrong password, do something
}
Reply
#3

Thank you !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)