help | mysql
#1

hello !

I have a small problem in MySql.
The problem is this:

Registered player enters the server it shows him he has to connect,
But even if the player is not registered to the server, it shows him to connect instead of break.

Here's the code:

pawn Код:
public OnPlayerConnect(playerid)
{
    format(String,256,"SELECT COUNT * FROM Users WHERE Nick='%s'",GetName(playerid));
    mysql_query(String);
    mysql_store_result();
    if(mysql_num_rows() == 0)
    {
        format(String,256,"{ffffff}.Proffesional DeathMeath бшек дба мщшъ \n .айрк шщен мотшлъ, тм оръ мдшщн емдреъ одоег лод щйеъш дрк цшйк мдшщн \n.тм оръ мдшщн длрс аъ сйсоък:",GetName(playerid),GetHColor(c_yellow));
        ShowPlayerDialog(playerid,RegDialog,DIALOG_STYLE_INPUT,"\t\t\t\t{ffffff}дшщод мщшъ",String,"дшщн","");
    }
    else
    {
        LoginsErrors[playerid] = 0;
        format(String,256,"{ffffff}/Proffesional DeathMatch бшек дба мщшъ \n .щн дощъощ мк шщен, ард дъзбш мотшлъ ббчщд",GetName(playerid),GetHColor(c_yellow));
        ShowPlayerDialog(playerid,LogDialog,DIALOG_STYLE_INPUT,"\t\t\t\t{ffffff}дъзбшеъ мщшъ",String,"дъзбш","");
    }
    return 1;
}
Thanks in advance helpers (:
Reply
#2

You may try
format(String,256,"SELECT * FROM Users WHERE Nick='%s'",GetName(playerid));
when you use count you need counting smth like id
Reply
#3

Okay it worked.
But now there is another problem.
A player connects, even if he wrote the wrong password it than the entry.
Here's 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' AND Password='%s'",GetName(playerid),inputtext);
        mysql_query(String);
        if(mysql_num_rows() == 1)
        {
            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,"התחבר","");
        }
    }
What's the problem here?
Thanks in advance for helpers!
Reply
#4

Are you using any Hash?
btw let server print to log the result of mysql_num_rows
btw you forgot to store it
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)