Login problem
#1

Well, it saves the file in Notepad in scriptfiles folder, but when I do I log it does not read the player files ... I'm with this problem for days ... + Rep

pawn Код:
Save Player:
stock SavePlayer(playerid){

        new name[MAX_PLAYER_NAME];
    if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid)){
        if(GetPVarInt(playerid,"Eingeloggt") == 1){
        new fFile[86];
                GetPlayerName(playerid, name, sizeof(name));
                GetPlayerPos(playerid, SpielerInfo[playerid][PosX], SpielerInfo[playerid][PosY], SpielerInfo[playerid][PosZ]);
                        format(fFile, sizeof(fFile), "%s.txt", name);
            DOF2_CreateFile(fFile);

                        DOF2_SetInt(fFile, "Passw", SpielerInfo[playerid][Pass]);
                        DOF2_SetInt(fFile, "Level", GetPlayerScore(playerid));
                        DOF2_SetInt(fFile, "Items_MED", GiveItem[playerid][MED_KIT]);
                        DOF2_SetInt(fFile, "Items_CZ550", GiveItem[playerid][CZ550]);
                        DOF2_SetInt(fFile, "Items_M4A1", GiveItem[playerid][M4A1]);
                        DOF2_SetInt(fFile, "Items_AK47", GiveItem[playerid][AK47]);
                        DOF2_SetInt(fFile, "Items_binoculars", GiveItem[playerid][binoculars]);
                        DOF2_SetInt(fFile, "Items_bandage", GiveItem[playerid][bandage]);
                        DOF2_SetInt(fFile, "Items_FullBottle", GiveItem[playerid][FULL_BOTTLE]);
                        DOF2_SetInt(fFile, "Items_Map", GiveItem[playerid][MAP]);
                        DOF2_SetInt(fFile, "Items_Items_EmptyBottle", GiveItem[playerid][EMPTY_BOTTLE]);
                        DOF2_SetInt(fFile, "Backpack", SpielerInfo[playerid][Backpack]);
                        DOF2_SetInt(fFile, "AliveMinutes", SpielerInfo[playerid][pAliveMinutes]);
                        DOF2_SetInt(fFile, "AliveSeconds", SpielerInfo[playerid][pAliveSeconds]);
                        DOF2_SetInt(fFile, "Blood", SpielerInfo[playerid][pBlood]);
                        DOF2_SetInt(fFile, "Temparatur", SpielerInfo[playerid][pTemparatur1]);
                        DOF2_SetInt(fFile, "Live", SpielerInfo[playerid][pLive]);
                        DOF2_SetInt(fFile, "Durst", SpielerInfo[playerid][pDurst]);
                        DOF2_SetInt(fFile, "Banned", SpielerInfo[playerid][pBan]);
                        DOF2_SetInt(fFile, "MapUsed", SpielerInfo[playerid][isMapUsed]);
                        DOF2_SetInt(fFile, "AdminPlayer", SpielerInfo[playerid][isAdmin]);
                        DOF2_SetFloat(fFile, "Backpack", SpielerInfo[playerid][Backpack]);
                        DOF2_SetFloat(fFile, "PosX", SpielerInfo[playerid][PosX]);
                        DOF2_SetFloat(fFile, "PosY", SpielerInfo[playerid][PosY]);
                        DOF2_SetFloat(fFile, "PosZ", SpielerInfo[playerid][PosZ]);
                        DOF2_SetString(fFile, "BanReason", SpielerInfo[playerid][pBanGrund]);
                        DOF2_SetString(fFile, "BanTime", SpielerInfo[playerid][pBanTime]);
                        DOF2_SetString(fFile, "BanDate", SpielerInfo[playerid][pBanDate]);
                        DOF2_SetString(fFile, "BanIP", SpielerInfo[playerid][pBanIP]);
                        DOF2_SaveFile(); // you must save the data with this ^^


        }
    }
    return 1;
}
pawn Код:
LoadPlayer
stock LoadPlayer(playerid)
{
        new fFile[90];
        if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid)){
        GiveItem[playerid][MED_KIT]         = DOF2_GetInt(fFile, "Items_MED");
        GiveItem[playerid][CZ550]             = DOF2_GetInt(fFile, "Items_CZ550");
        GiveItem[playerid][M4A1]             = DOF2_GetInt(fFile, "Items_M4A1");
        GiveItem[playerid][AK47]             = DOF2_GetInt(fFile, "Items_AK47");
        GiveItem[playerid][binoculars]       = DOF2_GetInt(fFile, "Items_binoculars");
        GiveItem[playerid][bandage]         = DOF2_GetInt(fFile, "Items_bandage");
        GiveItem[playerid][FULL_BOTTLE]         = DOF2_GetInt(fFile, "Items_FullBottle");
        GiveItem[playerid][MAP]             = DOF2_GetInt(fFile, "Items_Map");
        GiveItem[playerid][EMPTY_BOTTLE]    = DOF2_GetInt(fFile, "Items_EmptyBottle");
        SpielerInfo[playerid][pLevel]         = DOF2_GetInt(fFile, "Level");
        SpielerInfo[playerid][Backpack]         = DOF2_GetInt(fFile, "Backpack");
        SpielerInfo[playerid][pAliveMinutes]     = DOF2_GetInt(fFile, "AliveMinutes");
        SpielerInfo[playerid][pAliveSeconds]     = DOF2_GetInt(fFile, "AliveSeconds");
        SpielerInfo[playerid][pBlood]         = DOF2_GetInt(fFile, "Blood");
        SpielerInfo[playerid][pTemparatur1]     = DOF2_GetInt(fFile, "Temparatur");
        SpielerInfo[playerid][pLive]             = DOF2_GetInt(fFile, "Live");
        SpielerInfo[playerid][pDurst]         = DOF2_GetInt(fFile, "Durst");
        SpielerInfo[playerid][pBan]             = DOF2_GetInt(fFile, "Banned");
        SpielerInfo[playerid][isMapUsed]         = DOF2_GetInt(fFile, "MapUsed");
        SpielerInfo[playerid][isAdmin]         = DOF2_GetInt(fFile, "AdminPlayer");
        SpielerInfo[playerid][PosX]             = DOF2_GetFloat(fFile, "PosX");
        SpielerInfo[playerid][PosY]             = DOF2_GetFloat(fFile, "PosY");
        SpielerInfo[playerid][PosZ]             = DOF2_GetFloat(fFile, "PosZ");
        SpielerInfo[playerid][Pass]             = DOF2_GetInt(fFile, "Passw");

    }
    return 1;
}
pawn Код:
callback Playerdisconnect: SavePlayer(playerid);
pawn Код:
Login Box: LoadPlayer(playerid);
pawn Код:
public Account(playerid)
{
        new name[MAX_PLAYER_NAME];
  new fFile[256], string[256];
  GetPlayerName(playerid, name, sizeof(name));
    format(fFile, sizeof(fFile), "%s.txt", name);
  if(DOF2_FileExists(fFile))  {
    format(string,sizeof(string),"{FFFFFF}Welcome back '%s' to DayZ Beta 0.12\nPlease enter your {FF1E00}password{FFFFFF} now to login!",GetName(playerid));
       ShowPlayerDialog(playerid,DIALOG_ID_LOGIN,DIALOG_STYLE_PASSWORD,"{FFAA00}Welcome to DayZ Beta 0.12",string,"Login","Exit");
  }
   else
   {
        format(string,sizeof(string),"{FFFFFF}Welcome '%s' DayZ Beta 0.12\nPlease enter a {FF1E00}password{FFFFFF} to continue.\n{55FF00}Important: {FFE600}Your password should be safe!",GetName(playerid));
         ShowPlayerDialog(playerid,DIALOG_ID_REGISTER,DIALOG_STYLE_PASSWORD,"{FFAA00}Welcome to DayZ Beta 0.12",string,"Register","Exit");

     }
     }
Reply
#2

Anyone please? i need fix it to put my server online, i will give rep guys, thanks for the pacience
Reply
#3

does DOF2 knows the path of the file just with new fFile[90]; ? dont you need to format the location and load file from location? it seems so weird! I'm not using DOF2 so I'm not sure I could help you well. however I'm pretty sure this looks odd, you loadplayer with playerid but the actual file location isnt formated anywhere.
Try making those aswell with the loading, playerid is not enough for the file, he needs name + location.
Код:
new fFile[86], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(fFile, sizeof(fFile), "%s.txt", name);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)