SA-MP Forums Archive
Automatic Login Not Working :( - 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: Automatic Login Not Working :( (/showthread.php?tid=119042)



Automatic Login Not Working :( - ~Dangun! - 06.01.2010

My automatic login isn't working when i connect or changing mode....

pawn Код:
public OnPlayerLogin(playerid)
{
new string[265];

pInfo[playerid][logged] = 1;
pInfo[playerid][money] = dini_Int(udb_encode(pInfo[playerid][name]), "money");
pInfo[playerid][score] = dini_Int(udb_encode(pInfo[playerid][name]), "score");
pInfo[playerid][level] = dini_Int(udb_encode(pInfo[playerid][name]), "level");
pInfo[playerid][perfect] = dini_Int(udb_encode(pInfo[playerid][name]), "perfect");
new IP[56];
GetPlayerIp(playerid, IP, 56);
dini_Set(udb_encode(pInfo[playerid][name]), "IP", IP);
format(string, sizeof(string), "~r~Information: ~w~your now logged in! [~r~Score: ~w~%d] [~r~Admin Level: ~w~%d] [~r~Premium Member:~w~ %d] [~r~Money: ~w~%d]", pInfo[playerid][score], pInfo[playerid][level], pInfo[playerid][perfect], pInfo[playerid][money]);
SendMsg(playerid, 5000, string);

GivePlayerMoney(playerid,pInfo[playerid][money]);
SetPlayerScore(playerid,pInfo[playerid][score]+GetPlayerScore(playerid));
}
/////////////////////////////////////////
public OnPlayerConnect(playerid)
{
new IP[56];
  GetPlayerIp(playerid, IP, 56);
  if(strcmp(dini_Get(pInfo[playerid][name], "IP"), IP)) OnPlayerLogin(playerid);
}
I hope somebody will be able to help me out.


Re: Automatic Login Not Working :( - DeathOnaStick - 06.01.2010

At first, try to make the string, where you save the IP into, with a size of 16 cells. More are not needed (says sa-mp wiki). And replace this:

pawn Код:
if(strcmp(dini_Get(pInfo[playerid][name], "IP"), IP)==0) OnPlayerLogin(playerid);
Now it should work, i guess.

Cheers.


Re: Automatic Login Not Working :( - Niixie - 06.01.2010

Get the players registered ip

pawn Код:
new tmp2[56], tmp3[56];

GetPlayerIp(blabla, tmp3);
dini_Int(blabla, tmp2);

If(strcmp(tmp2, tmp3 = true))
{
   IsPlayerLogged[playerid] = 1;
   SendClientMessage(playerid, blue, "You've been automaticly logged in");
}
Something like that, thats what i would do
Dont copy it, its not written as it should be. because you dont learn of copying


Re: Automatic Login Not Working :( - DeathOnaStick - 06.01.2010

Quote:
Originally Posted by Niixie
Get the players registered ip

pawn Код:
new tmp2[56], tmp3[56];

GetPlayerIp(blabla, tmp3);
dini_Int(blabla, tmp2);

If(tmp2, tmp3 = true)
{
   IsPlayerLogged[playerid] = 1;
   SendClientMessage(playerid, blue, "You've been automaticly logged in");
}
Something like that, thats what i would do
Dont copy it, its not written as it should be. because you dont learn of copying
Quote:
Originally Posted by ~Dangun!
pawn Код:
public OnPlayerConnect(playerid)
{
new IP[56];
  GetPlayerIp(playerid, IP, 56);
  if(strcmp(dini_Get(pInfo[playerid][name], "IP"), IP)) OnPlayerLogin(playerid);
}
I hope somebody will be able to help me out.
He does yet... doesnt he?


Re: Automatic Login Not Working :( - Niixie - 06.01.2010

What does he?
(I edited my other post)


Re: Automatic Login Not Working :( - DeathOnaStick - 06.01.2010

Quote:
Originally Posted by Niixie
What does he?
(I edited my other post)
He saves on the login the IP he has atm, cuz he logs in and this is the valid IP of the user, saves it into a file and checks under first connection if the IP is okay/same. He did all this yet


Re: Automatic Login Not Working :( - Niixie - 06.01.2010

he should be, if he didnt try himself he'll never learn :/


Re: Automatic Login Not Working :( - ~Dangun! - 06.01.2010

Mmmh weird bug happening now...

www.nix.turkdale.nl/weird.wmv < i made a lil movie of it,

I connect to the server... it says i am logged in. It isn't going out the screen. When i want to use /explode. I am not premium or lvl 1 admin.
Then i use /login i just login... then i can use the premium commands/admin commands.
But the text staying in screen.

Hope somebody can help me.


Re: Automatic Login Not Working :( - ~Dangun! - 07.01.2010

bump


Re: Automatic Login Not Working :( - Niixie - 07.01.2010

its hard to see without the hole script