Problem in mysql plugin
#1

hello !

i'm download mysql plugin,
I tried to build a Registration and Logging
Now that's the problem:

Even if the user exists, he shows him the dialogue of the registration
Here's the code:

pawn Код:
public OnPlayerConnect(playerid)
{
    format(String,256,"SELECT COUNT * FROM Users WHERE Nick='%s'",GetName(playerid));
    new exists = mysql_query(String);
    if(mysql_num_rows(exists) == 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;
}
What's the problem?
Reply
#2

Delete the exists variable, it doesn't help you. mysql_query returns 1 on success and 0 on failure and mysql_num_rows has an optional parameter, which is the connection handle returned by mysql_connect. So, in the end, you should be doing something like:
pawn Код:
public OnPlayerConnect(playerid)
{
    format(String,256,"SELECT COUNT * FROM Users WHERE Nick='%s'",GetName(playerid));
    mysql_query(String);
    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;
}
Reply
#3

thank you very much !!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)