#1

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.
Reply
#2

here you go;

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

Thank you, repped.
Reply
#4

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.
Reply
#5

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.
Reply
#6

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

And what about my second problem?
Reply
#7

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?
Reply
#8

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?
Reply
#9

Okay, thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)