SA-MP Forums Archive
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)
+--- Thread: mysql (/showthread.php?tid=342723)



mysql - BaubaS - 14.05.2012

So, I have create registration system based on mysql, the script works fine, but there's a problem in one query:

1. Someone creates account with name TEST, everything is okay.
2. Then, someone connects with name TesT, and he will dont need to register, he will need to login and all data will be set on this account from account TEST.

Query to check is player registered:

pawn Код:
mysql_format(_, szQuery, "SELECT `Name` FROM `players` WHERE `Name` = '%e'", GetPlayerNameEx(playerid));
Thank you in advance.


Re: mysql - Mandrakke - 14.05.2012

here you go;

Код:
SELECT `Name` FROM `players` WHERE BINARY `Name` = '%e'



Re: mysql - BaubaS - 14.05.2012

Thank you, repped.


Re: mysql - BaubaS - 15.05.2012

One more question. I am hooking all system (creating each in other file). The problem is that when I want to call players system OnPlayerConnect callback using CallLocalFunction, it doesnt work.

CallLocalFunction("players_OnPlayerConnect", "d", playerid);

OnPlayerConnect:

pawn Код:
Hook:players_OnPlayerConnect(playerid)
{
    new szQuery[78 + 1];
    mysql_format(_, szQuery, "SELECT `Vardas` FROM `zaidejai` WHERE BINARY `Vardas` = '%e'", GetPlayerNameEx(playerid));
    mysql_query(szQuery);
    mysql_store_result();
           if (mysql_num_rows()
           {
               // registered - Showing dialog
           }
           else
           {
               // not registered - Showing other dialog
           }
       return true;
}
So, as I said, server doesnt show me dialog.


Re: mysql - Vince - 15.05.2012

Quote:
Originally Posted by Mandrakke
Посмотреть сообщение
here you go;

Код:
SELECT `Name` FROM `players` WHERE BINARY `Name` = '%e'
Or instead of doing that, have the table use a case sensitive collation, like latin1_general_cs where cs denotes Case Sensitive.


Re: mysql - BaubaS - 15.05.2012

Ok, this is easier, I'll will change these types.

And what about my second problem?


Re: mysql - BaubaS - 18.05.2012

Quote:
Originally Posted by BaubaS
Посмотреть сообщение
One more question. I am hooking all system (creating each in other file). The problem is that when I want to call players system OnPlayerConnect callback using CallLocalFunction, it doesnt work.

CallLocalFunction("players_OnPlayerConnect", "d", playerid);

OnPlayerConnect:

pawn Код:
Hook:players_OnPlayerConnect(playerid)
{
    new szQuery[78 + 1];
    mysql_format(_, szQuery, "SELECT `Vardas` FROM `zaidejai` WHERE BINARY `Vardas` = '%e'", GetPlayerNameEx(playerid));
    mysql_query(szQuery);
    mysql_store_result();
           if (mysql_num_rows()
           {
               // registered - Showing dialog
           }
           else
           {
               // not registered - Showing other dialog
           }
       return true;
}
So, as I said, server doesnt show me dialog.
Anyone?


Re: mysql - BaubaS - 19.05.2012

As I understand, I should create a stock, and then call it? I mean,

pawn Код:
public players_OPC(playerid)
{
    // script from the callback
    return true;
}
then,
pawn Код:
CallLocalFunction("players_OPC", "d", playerid);
or just
pawn Код:
players_OPC(playerid);
Am I correct?


Re: mysql - BaubaS - 19.05.2012

Okay, thank you.