help | mysql - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: help | mysql (
/showthread.php?tid=261264)
help | mysql -
EviLpRo - 12.06.2011
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 (:
Re: help | mysql -
whitedragon - 12.06.2011
You may try
format(String,256,"SELECT * FROM Users WHERE Nick='%s'",GetName(playerid));
when you use count you need counting smth like id
Re: help | mysql -
EviLpRo - 12.06.2011
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!
Re: help | mysql -
whitedragon - 12.06.2011
Are you using any Hash?
btw let server print to log the result of mysql_num_rows
btw you forgot to store it