SA-MP Forums Archive
Server kicks me out, when I log in. - 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: Server kicks me out, when I log in. (/showthread.php?tid=392453)



Server kicks me out, when I log in. - tsonn1 - 14.11.2012

Hi!

I've got a problem with my OnPlayerLogin.
I replaced the mysql_get_row with mysqlfetchacctsingle, because the mysql_get_row didn't work on my host and now, when I log in, it just kicks me out, saying "Server closed the connection."

Here's the pawn code:
pawn Code:
public OnPlayerLogin(playerid,password[]) // by Luk0r v1.0
{
    MySQLCheckConnection();
    printf("Check 1");
    new tmp2[256];
    new string2[64];
    new str[128];
    new
    string[256]
    ;
    new playername2[MAX_PLAYER_NAME];
    new playernamesplit[3][MAX_PLAYER_NAME];
    GetRPName(playerid, playername2, sizeof(playername2));
    split(playername2, playernamesplit, '_');
    MySQLFetchAcctSingle(KasutajaInfo[playerid][pSQLID], "Password", KasutajaInfo[playerid][pKey]);
    printf("Check 2");
    if(!strcmp(KasutajaInfo[playerid][pKey],password, true ) )
    {
        new Query[1024];
        new Field[64];
        new result[256];
        printf("Check 3");
        format(Query, sizeof(Query), "SELECT * FROM `players` WHERE `id` = '%d'", KasutajaInfo[playerid][pSQLID] );
        mysql_query(Query);
        mysql_store_result();
        printf("Check 4");
        if(mysql_fetch_row_format(Query,"|"))
        {
            printf("Check 5");
            MySQLFetchAcctSingle(KasutajaInfo[playerid][pSQLID], "PlayerLevel", KasutajaInfo[playerid][pLevel]);
                    // A couple of more lines, about a hundred. :D



Re: Server kicks me out, when I log in. - jotan. - 14.11.2012

Code:
    if(!strcmp(KasutajaInfo[playerid][pKey],password, true ) )
Try to replace this code with:

Code:
    if(strcmp(KasutajaInfo[playerid][pKey],password, true ) )



Re: Server kicks me out, when I log in. - tsonn1 - 14.11.2012

That's not the problem. Because the lines, that u don't see, are else SendClientMessage...


Re: Server kicks me out, when I log in. - tsonn1 - 15.11.2012

Bump<1


Re: Server kicks me out, when I log in. - KiNG3 - 15.11.2012

@Tsonn1, the code he posted should be right

pawn Code:
if(strcmp(KasutajaInfo[playerid][pKey],password, true ) )
If you had a !, you're basically stating that if it has the wrong password, it can get out of here. Have you tried it?


Re: Server kicks me out, when I log in. - ReneG - 15.11.2012

Quote:
Originally Posted by jotan.
View Post
Code:
    if(!strcmp(KasutajaInfo[playerid][pKey],password, true ) )
Try to replace this code with:

Code:
    if(strcmp(KasutajaInfo[playerid][pKey],password, true ) )
Quote:
Originally Posted by KiNG3
View Post
@Tsonn1, the code he posted should be right

pawn Code:
if(strcmp(KasutajaInfo[playerid][pKey],password, true ) )
If you had a !, you're basically stating that if it has the wrong password, it can get out of here. Have you tried it?
Don't post if you don't know what you're talking about.

strcmp() returns 0 if the strings MATCH. So you are both wrong. The original post strcmp line is correct.


Re: Server kicks me out, when I log in. - Sinner - 15.11.2012

Quote:
Originally Posted by KiNG3
View Post
@Tsonn1, the code he posted should be right

pawn Code:
if(strcmp(KasutajaInfo[playerid][pKey],password, true ) )
If you had a !, you're basically stating that if it has the wrong password, it can get out of here. Have you tried it?
No! strcmp return 0 if the 2 strings are equal. That line is correct.