Auto-Login Just Dosent Seem To Work -
[WF]Demon - 29.12.2010
Well, today i was attempting at a auto-login when i ran into some problems, when i use onplayerconnect and check if the file does exist (which it does) that a login dialog will come up, that wont work either, im not sure why this isnt working but here is the code
pawn Код:
public OnPlayerConnect(playerid)
{
logged[playerid] = 0;
Rank[playerid] = 0;
AdminL[playerid] = 0;
SetTimerEx("Save", 25000, true, "i", playerid);
GetPlayerName(playerid, pname, sizeof(pname));
GetPlayerIp(playerid, pIp, sizeof(pIp));
format(file, sizeof(file), ASDP, pname);
if(!dini_Exists(file)) return ShowPlayerDialog(playerid, 123, DIALOG_STYLE_INPUT, "Register", "Enter A Password:", "Register", "Cancel");
if(strcmp(pIp, dini_Get(file, "IP"), true) == 0)
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, dini_Int(file, "Cash"));
SetPlayerScore(playerid, dini_Int(file, "Score"));
AdminL[playerid] = dini_Int(file, "Admin");
logged[playerid] = 1;
SendClientMessage(playerid, RED, "You Have Been Automaticly Logged In!");
Rank[playerid] = dini_Int(file, "Rank");
GetPlayerIp(playerid, pIp, sizeof(pIp));
dini_Set(file, "IP", pIp);
PlayerJustConnected(playerid);
logged[playerid] = 1;
}
else
{
ShowPlayerDialog(playerid, 124, DIALOG_STYLE_INPUT, "Login", "Enter Your Password:", "Login", "Cancel");
}
return 1;
}
Please help me out, never ran into this stupid problem before...
Re: Auto-Login Just Dosent Seem To Work -
Iuri - 29.12.2010
pawn Код:
public OnPlayerConnect(playerid)
{
logged[playerid] = 0;
Rank[playerid] = 0;
AdminL[playerid] = 0;
SetTimerEx("Save", 25000, true, "i", playerid);
GetPlayerName(playerid, pname, sizeof(pname));
new Ip[24],pIp[24];
GetPlayerIp(playerid,pIp,sizeof(pIp));
strmid(Ip, dini_Get(filename*, "Ip"), 0, strlen(dini_Get(filename*, "Ip")), 255);
format(file, sizeof(file), ASDP, pname);
if(!dini_Exists(file)) return ShowPlayerDialog(playerid, 123, DIALOG_STYLE_INPUT, "Register", "Enter A Password:", "Register", "Cancel");
if(!strcmp(pIp, Ip, true))
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, dini_Int(file, "Cash"));
SetPlayerScore(playerid, dini_Int(file, "Score"));
AdminL[playerid] = dini_Int(file, "Admin");
logged[playerid] = 1;
SendClientMessage(playerid, RED, "You Have Been Automaticly Logged In!");
Rank[playerid] = dini_Int(file, "Rank");
GetPlayerIp(playerid, pIp, sizeof(pIp));
dini_Set(file, "IP", pIp);
PlayerJustConnected(playerid);
logged[playerid] = 1;
}
else
{
ShowPlayerDialog(playerid, 124, DIALOG_STYLE_INPUT, "Login", "Enter Your Password:", "Login", "Cancel");
}
return 1;
}
Just replace the
filename* with yours and the
Ip Text if you don't have it same.
Re: Auto-Login Just Dosent Seem To Work -
[WF]Demon - 29.12.2010
That actually didnt work.. any other suggestions from.. well.... anyone?
Re: Auto-Login Just Dosent Seem To Work -
Iuri - 29.12.2010
Try to put the
format(file, sizeof(file), ASDP, pname); above this:
new Ip[24],pIp[24];