SA-MP Forums

Go Back   SA-MP Forums > SA-MP > Client Support

Reply
 
Thread Tools Display Modes
Old 11/06/2011, 07:22 PM   #1
EviLpRo
Big Clucker
 
Join Date: Jun 2011
Posts: 142
Reputation: -12
Default Problem in mysql plugin

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 Code:
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?
EviLpRo is offline   Reply With Quote
Old 11/06/2011, 07:54 PM   #2
[NoV]LaZ
High-roller
 
Join Date: May 2008
Posts: 1,458
Reputation: 84
Default Re: Problem in mysql plugin

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 Code:
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;
}
[NoV]LaZ is offline   Reply With Quote
Old 11/06/2011, 08:02 PM   #3
EviLpRo
Big Clucker
 
Join Date: Jun 2011
Posts: 142
Reputation: -12
Default Re: Problem in mysql plugin

thank you very much !!
EviLpRo is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL Plugin R5 plugin problem dud Scripting Help 12 05/12/2011 07:28 PM
Problem with mysql plugin... Vvolk Help Archive 2 06/05/2011 01:03 PM
mysql plugin r4 problem, query DowNlOaD_ Help Archive 0 22/05/2010 12:12 PM
Problem with MySQL plugin Filka Server Support 4 17/10/2009 04:59 PM
MOVED: Problem with MySQL plugin dugi Help Archive 0 17/10/2009 04:13 PM


All times are GMT. The time now is 10:44 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.