case DIALOG_ACCLOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == pInfo[playerid][Pass])
{
new file[100];
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in to your Account!","Ok","");
GetPlayerIp(playerid,pIP,16);
format(file, 100, PATH, GetName(playerid));
new INI:ACCOUNT = INI_Open(file);
INI_SetTag(ACCOUNT,"data");
INI_WriteString(ACCOUNT, "LastLoggedIP", pIP);
INI_Close(ACCOUNT);
SetPlayerScore(playerid, pInfo[playerid][Score]);
GivePlayerCash(playerid, pInfo[playerid][Cash]);
SetPlayerPos(playerid,1918.1643,1175.7311,18.2846);
SetPlayerCameraLookAt(playerid,1918.1643,1175.7311,18.2846);
SetPlayerCameraPos(playerid,1908.1575,1175.7079,18.2846);
SetPlayerFacingAngle(playerid,91.2061);
pInfo[playerid][Logged] = 1; //This is where i set them as logged in but it doesn't work
SetTimerEx("pTime", 1000, true, "i", playerid);
}
new Logged[MAX_PLAYERS]; // Add this somewhere on top of your script
public OnPlayerSpawn(playerid)
{
Logged[playerid] = 1;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
Logged[playerid] = 0;
return 1;
}
If you just want to check if they're logged and not saving the variable, you could just:
PHP код:
|
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
// Loading users data code
pInfo[playerid][Logged] = 1;
}