SA-MP Forums Archive
Auto - Loggin by IP Adress (Need Help) - 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: Auto - Loggin by IP Adress (Need Help) (/showthread.php?tid=348139)



Auto - Loggin by IP Adress (Need Help) - nGen.SoNNy - 04.06.2012

Hi guys! I'm trying to make AutoLoggin by IP adress but... don't work Don't matter what IP i have... the script will loggin me )


pawn Код:
// (Get User Account Info)
    AccInfo[ playerid ][ Logged ] = 0;
    if(BUD::IsNameRegistered( PlayerName2(playerid) ) == true)
    {
        new pQuery[512], pField[60];
        format(pQuery, 512, "SELECT `Adress` FROM `users` WHERE `name` = '%s';", PlayerName2(playerid));
        Result = db_query(Database, pQuery);
        db_get_field_assoc(Result, "Adress", pField, sizeof(pField));
        if( strcmp(pField, GetPlayerIPEx(playerid)) == 0 ) LogPLayer(playerid);
       
        SendInfo(playerid, "Your account is Registered! Please loggin to your account: ~r~~h~/login");
        SCM:(playerid, ~1,"Your account is "G"Registered"W"! Please "R"loggin "W"to your account: "O"/"W"login");
        AccInfo[ playerid ][ Admin ] = 0;
        AccInfo[ playerid ][ VIP ] = 0;
        AccInfo[ playerid ][ Sadmin ] = 0;
        AccInfo[ playerid ][ Registered ] = 1;
    }
    if(BUD::IsNameRegistered( PlayerName2(playerid) ) == false)
    {
        new rstring[256];
        format(rstring,256,""W"Welcome "YE"%s"W", on "R"San "S"Fierro "YE"Stuntage\n\n"W"Please "G"Register"W" to save your stats: "COL_ORANGE"Score,Money,Coins...", PlayerName2(playerid));
        ShowPlayerDialog(playerid,RegisterDialog,DIALOG_STYLE_PASSWORD,""W"Location:"G" Register Account",rstring,"(Register)","(Quit)");
    }



Re: Auto - Loggin by IP Adress (Need Help) - Yuryfury - 04.06.2012

I'm assuming that GetPlayerIPEx is a function you made. Are you sure it works correctly?

Try doing printf and comparing the two strings (the GetPlayerIPEx one and the file one).

P.S. It is spelled "address" not "adress"


Re: Auto - Loggin by IP Adress (Need Help) - nGen.SoNNy - 04.06.2012

PRINT
PHP код:
[15:11:25Player Real IP127.0.0.1
[15:11:25Player Account IP
pawn Код:
stock GetPlayerAccountIP(playerid)
{
    new clanquery[100];
    new clan_motd[100];
    format(clanquery, sizeof(clanquery), "SELECT Adress FROM users WHERE name = '%s'", PlayerName2(playerid));
    Result = db_query( Database, clanquery );
    db_get_field_assoc( Result, "Adress", clan_motd, 30 );
    db_free_result(Result);
    printf("Player Account IP: %s", clan_motd);
    return clan_motd;
}



Re: Auto - Loggin by IP Adress (Need Help) - Yuryfury - 04.06.2012

So the problem is with the ip saved in the file. You are either not saving it (correctly) or are not retrieving it correctly.

Sorry, but I'm not familiar with SQlite.


Re: Auto - Loggin by IP Adress (Need Help) - Jonny5 - 04.06.2012

Quote:
Originally Posted by Yuryfury
Посмотреть сообщение
P.S. It is spelled "address" not "adress"
yes are you sure you dont have a typo in your query?


Re: Auto - Loggin by IP Adress (Need Help) - nGen.SoNNy - 04.06.2012

in database i have data..so i don't know why the script don't read it..