Y_INI problem :write the same value.
#4

Quote:
Originally Posted by ******
Посмотреть сообщение
Have you tried writing the data in to a tag instead of with no tag? The no tag support was very quickly hacked in I have to say.
Hi ******
I have write it in tags.
pawn Код:
Function OnPlayerLogin(playerid,password[])
{
    new nickname[35];
    format(nickname,sizeof(nickname),PLAYER_INFO, GetName(playerid));
    new INI:handler = INI_Open(nickname);
    INI_ParseFile(nickname, "LoadPlayerInfo", .bExtra = true, .extra = playerid);
    INI_Close(handler);
    if(!strcmp(pInfo[playerid][pPass],password))
    {
        pLogged[playerid] = 1;
        SetSpawnInfo(playerid,0,pInfo[playerid][pSkin],pInfo[playerid][pPos][0],pInfo[playerid][pPos][1],pInfo[playerid][pPos][2]+3,0,0,0,0,0,0,0);
        SpawnPlayer(playerid);
    }
    else
    {
        pLogTries[playerid] ++;
        if(pLogTries[playerid] > 3)
        {ERROR(playerid,"您多次输入错误密码,系统自动封锁IP!");Ban(playerid);}
        else
        {ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"登陆窗口","您输入的密码不匹配,请重新输入!","登陆","离开");}
    }

}

Function LoadPlayerInfo(playerid, name[], value[])
{
    INI_String("password",pInfo[playerid][pPass],64);
    INI_Int("skin",pInfo[playerid][pSkin]);
    INI_Int("honor",pInfo[playerid][pHonor]);
    INI_Int("money",pInfo[playerid][pMoneys]);
    INI_Int("team",pInfo[playerid][pTeam]);
    INI_Int("rank",pInfo[playerid][pRank]);
    INI_Int("job",pInfo[playerid][pJob]);
    INI_Int("mats",pInfo[playerid][pMats]);
    INI_Int("drugs",pInfo[playerid][pDrugs]);
    INI_Int("license",pInfo[playerid][pLic]);
    INI_Int("weaponlic",pInfo[playerid][pWeaponLic]);
    INI_Int("houseid",pInfo[playerid][pOwnhouse]);
    INI_Int("vehicleid",pInfo[playerid][pOwncar]);
    INI_Int("fightstyle",pInfo[playerid][pFightStyle]);
    INI_Float("health",pInfo[playerid][pHealth]);
    INI_Float("armour",pInfo[playerid][pArmour]);
    INI_Int("wanted",pInfo[playerid][pWanted]);
    INI_Int("jailed",pInfo[playerid][pWanted]);
    INI_Int("jailetime",pInfo[playerid][pWanted]);
    INI_Float("pos_x",pInfo[playerid][pPos][0]);
    INI_Float("pos_y",pInfo[playerid][pPos][1]);
    INI_Float("pos_z",pInfo[playerid][pPos][2]);
    INI_Int("interior",pInfo[playerid][pInterior]);
    INI_Int("world",pInfo[playerid][pWorld]);
    INI_Int("weapon_1",pInfo[playerid][pWeapon][0]);
    INI_Int("weapon_2",pInfo[playerid][pWeapon][1]);
    INI_Int("weapon_3",pInfo[playerid][pWeapon][2]);
    INI_Int("weapon_4",pInfo[playerid][pWeapon][3]);
    INI_Int("weapon_5",pInfo[playerid][pWeapon][4]);
    INI_Int("weapon_6",pInfo[playerid][pWeapon][5]);
    INI_Int("weapon_7",pInfo[playerid][pWeapon][6]);
    INI_Int("weapon_8",pInfo[playerid][pWeapon][7]);
    INI_Int("weapon_9",pInfo[playerid][pWeapon][8]);
    INI_Int("weapon_10",pInfo[playerid][pWeapon][9]);
    return 1;
}

SavePlayerInfo(playerid)
{
    if(pLogged[playerid] >0)
    {
        pInfo[playerid][pSkin] = GetPlayerSkin(playerid);
        GetPlayerHealth(playerid, pInfo[playerid][pHealth]);
        GetPlayerArmour(playerid, pInfo[playerid][pArmour]);
        GetPlayerPos(playerid, pInfo[playerid][pPos][0], pInfo[playerid][pPos][1], pInfo[playerid][pPos][2]);
        pInfo[playerid][pInterior] = GetPlayerInterior(playerid);
        pInfo[playerid][pWorld] = GetPlayerVirtualWorld(playerid);
        for (new i = 0; i < 10; i++)
        {GetPlayerWeaponData(playerid, i, pInfo[playerid][pWeapon][i], pInfo[playerid][pSlot][i]);}
        new nickname[35];
        format(nickname,sizeof(nickname),PLAYER_INFO,GetName(playerid));
        new INI:PlayerFile = INI_Open(nickname);
        INI_SetTag(PlayerFile, "config");
        INI_WriteString(PlayerFile,"password",pInfo[playerid][pPass]);
        INI_SetTag(PlayerFile, "info");
        INI_WriteInt(PlayerFile,"skin",pInfo[playerid][pSkin]);
        INI_WriteInt(PlayerFile,"honor",pInfo[playerid][pHonor]);
        INI_WriteInt(PlayerFile,"money",pInfo[playerid][pMoneys]);
        INI_WriteInt(PlayerFile,"team",pInfo[playerid][pTeam]);
        INI_WriteInt(PlayerFile,"rank",pInfo[playerid][pRank]);
        INI_WriteInt(PlayerFile,"job",pInfo[playerid][pJob]);
        INI_WriteInt(PlayerFile,"mats",pInfo[playerid][pMats]);
        INI_WriteInt(PlayerFile,"drugs",pInfo[playerid][pDrugs]);
        INI_WriteInt(PlayerFile,"license",pInfo[playerid][pLic]);
        INI_WriteInt(PlayerFile,"weaponlic",pInfo[playerid][pWeaponLic]);
        INI_WriteInt(PlayerFile,"houseid",pInfo[playerid][pOwnhouse]);
        INI_WriteInt(PlayerFile,"vehicleid",pInfo[playerid][pOwncar]);
        INI_WriteInt(PlayerFile,"fightstyle",pInfo[playerid][pFightStyle]);
        INI_SetTag(PlayerFile, "stats");
        INI_WriteFloat(PlayerFile,"health",pInfo[playerid][pHealth]);
        INI_WriteFloat(PlayerFile,"armour",pInfo[playerid][pArmour]);
        INI_WriteInt(PlayerFile,"wanted",pInfo[playerid][pWanted]);
        INI_WriteInt(PlayerFile,"jailed",pInfo[playerid][pJailed]);
        INI_WriteInt(PlayerFile,"jailetime",pInfo[playerid][pJailTime]);
        INI_WriteFloat(PlayerFile,"pos_x",pInfo[playerid][pPos][0]);
        INI_WriteFloat(PlayerFile,"pos_y",pInfo[playerid][pPos][1]);
        INI_WriteFloat(PlayerFile,"pos_z",pInfo[playerid][pPos][2]);
        INI_WriteInt(PlayerFile,"interior",pInfo[playerid][pInterior]);
        INI_WriteInt(PlayerFile,"world",pInfo[playerid][pWorld]);
        INI_WriteInt(PlayerFile,"weapon_1",pInfo[playerid][pWeapon][0]);
        INI_WriteInt(PlayerFile,"weapon_2",pInfo[playerid][pWeapon][1]);
        INI_WriteInt(PlayerFile,"weapon_3",pInfo[playerid][pWeapon][2]);
        INI_WriteInt(PlayerFile,"weapon_4",pInfo[playerid][pWeapon][3]);
        INI_WriteInt(PlayerFile,"weapon_5",pInfo[playerid][pWeapon][4]);
        INI_WriteInt(PlayerFile,"weapon_6",pInfo[playerid][pWeapon][5]);
        INI_WriteInt(PlayerFile,"weapon_7",pInfo[playerid][pWeapon][6]);
        INI_WriteInt(PlayerFile,"weapon_8",pInfo[playerid][pWeapon][7]);
        INI_WriteInt(PlayerFile,"weapon_9",pInfo[playerid][pWeapon][8]);
        INI_WriteInt(PlayerFile,"weapon_10",pInfo[playerid][pWeapon][9]);
        INI_Close(PlayerFile);
    }
}
But it also make this:
pawn Код:
[config]
password = lwzi&#138;……
[info]
skin = 200
honor = 997797
money = 9839799
team = 0
rank = 0
job = 0
mats = 0
drugs = 0
license = 0
weaponlic = 0
houseid = 999
vehicleid = 999
fightstyle = 4
[stats]
health = 0.000000
armour = 0.000000
wanted = 0
jailed = 0
jailetime = 0
pos_x = -2254.688964
pos_y = -148.358123
pos_z = 39.156242
interior = 0
world = 0
weapon_1 = 0
weapon_2 = 0
weapon_3 = 0
weapon_4 = 0
weapon_5 = 0
weapon_6 = 0
weapon_7 = 0
weapon_8 = 0
weapon_9 = 0
weapon_10 = 0
[config]
password = lwzi&#138;……
Reply


Messages In This Thread
Y_INI problem :write the same value. - by VivianKris - 25.07.2011, 05:52
Re: Y_INI problem :write the same value. - by VivianKris - 25.07.2011, 09:59
Re: Y_INI problem :write the same value. - by VivianKris - 25.07.2011, 15:52
Re: Y_INI problem :write the same value. - by VivianKris - 26.07.2011, 07:43

Forum Jump:


Users browsing this thread: 1 Guest(s)