Automatic Login Not Working :(
#1

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

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

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
Reply
#4

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

What does he?
(I edited my other post)
Reply
#6

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

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

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

bump
Reply
#10

its hard to see without the hole script
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)