29.12.2010, 14:07
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
Please help me out, never ran into this stupid problem before...
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;
}