dini question [REP+]
#1

Hi. How can I delete players file with extension .ini from /scriptfiles/Users. I want all of them. How can I do this ? Please help me. REP+ for who help me !
Sorry for my bad english
Reply
#2

Look here:
https://sampwiki.blast.hk/wiki/Fremove

I don't know if
PHP код:
dini_Remove(file
will work but you can try this.
Reply
#3

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Look here:
https://sampwiki.blast.hk/wiki/Fremove

I don't know if
PHP код:
dini_Remove(file
will work but you can try this.
I want to find all the players data and to remove it. Can you give me an example please?
Reply
#4

Quote:
Originally Posted by radiobizza
Посмотреть сообщение
I want to find all the players data and to remove it. Can you give me an example please?
Not really too sure how to show you an example but I think you mean something like this..

pawn Код:
new ExampleStat1[MAX_PLAYERS];
new ExampleStat2[MAX_PLAYERS];
new ExampleStat3[MAX_PLAYERS];
new ExampleStat4[MAX_PLAYERS];

public SavePlayerFile(playerid)
{
    new File[128];
    format(File, sizeof(File), "FolderName/%s", GetPlayerNameEx(playerid));
   
    if(dini_Exists(File))
    {
        dini_IntSet(File, "ExampleStat1", ExampleStat1);
        dini_IntSet(File, "ExampleStat2", ExampleStat1);
        dini_IntSet(File, "ExampleStat3", ExampleStat1);
        dini_IntSet(File, "ExampleStat4", ExampleStat1);
    }
    else
    {
        dini_Create(File);
       
        dini_IntSet(File, "ExampleStat1", ExampleStat1);
        dini_IntSet(File, "ExampleStat2", ExampleStat1);
        dini_IntSet(File, "ExampleStat3", ExampleStat1);
        dini_IntSet(File, "ExampleStat4", ExampleStat1);
    }
    return 1;
}

public LoadPlayerFile(playerid)
{
    new File[128];
    format(File, sizeof(File), "FolderName/%s", GetPlayerNameEx(playerid));

    if(dini_Exists(File))
    {
        ExampleStat1[playerid] = dini_Int(File, "ExampleStat1");
        ExampleStat1[playerid] = dini_Int(File, "ExampleStat2");
        ExampleStat1[playerid] = dini_Int(File, "ExampleStat3");
        ExampleStat1[playerid] = dini_Int(File, "ExampleStat4");
    }
    return 1;
}

public RemovePlayerFile(playerid)
{
    new File[128];
    format(File, sizeof(File), "FolderName/%s", GetPlayerNameEx(playerid));

    if(dini_Exists(File))
    {
        dini_Remove(File);
       
        ExampleStat1[playerid] = -1
        ExampleStat2[playerid] = -1
        ExampleStat3[playerid] = -1
        ExampleStat4[playerid] = -1
    }
    return 1;
}
Reply
#5

Do you mean that u want to delete the files of all players?Or just one player file (or its content)?
Reply
#6

Quote:
Originally Posted by [Bios]Marcel
Посмотреть сообщение
Do you mean that u want to delete the files of all players?Or just one player file (or its content)?
Oh if you mean to RESET/REMOVE all the data on the players FILE then do it like this...

pawn Код:
new ExampleInt[MAX_PLAYERS];
new Float:ExampleFloat[MAX_PLAYERS];
new ExampleString[MAX_PLAYERS][128];


public RemovePlayerDataFromFile(playerid)
{
    new File[128];
    format(File, sizeof(File), "FolderName/%s", GetPlayerNameEx(playerid));

    if(dini_Exists(File))
    {
        dini_IntSet(File, "ExampleInt", 0);
        dini_SetFloat(File, "ExampleFloat", 0.0);
        dini_Set(File, "ExampleString", "");
    }
    return 1;
}
I think something like that..
Reply
#7

Quote:
Originally Posted by FarTooBaked
Посмотреть сообщение
Not really too sure how to show you an example but I think you mean something like this..

pawn Код:
new ExampleStat1[MAX_PLAYERS];
new ExampleStat2[MAX_PLAYERS];
new ExampleStat3[MAX_PLAYERS];
new ExampleStat4[MAX_PLAYERS];

public SavePlayerFile(playerid)
{
    new File[128];
    format(File, sizeof(File), "FolderName/%s", GetPlayerNameEx(playerid));
   
    if(dini_Exists(File))
    {
        dini_IntSet(File, "ExampleStat1", ExampleStat1);
        dini_IntSet(File, "ExampleStat2", ExampleStat1);
        dini_IntSet(File, "ExampleStat3", ExampleStat1);
        dini_IntSet(File, "ExampleStat4", ExampleStat1);
    }
    else
    {
        dini_Create(File);
       
        dini_IntSet(File, "ExampleStat1", ExampleStat1);
        dini_IntSet(File, "ExampleStat2", ExampleStat1);
        dini_IntSet(File, "ExampleStat3", ExampleStat1);
        dini_IntSet(File, "ExampleStat4", ExampleStat1);
    }
    return 1;
}

public LoadPlayerFile(playerid)
{
    new File[128];
    format(File, sizeof(File), "FolderName/%s", GetPlayerNameEx(playerid));

    if(dini_Exists(File))
    {
        ExampleStat1[playerid] = dini_Int(File, "ExampleStat1");
        ExampleStat1[playerid] = dini_Int(File, "ExampleStat2");
        ExampleStat1[playerid] = dini_Int(File, "ExampleStat3");
        ExampleStat1[playerid] = dini_Int(File, "ExampleStat4");
    }
    return 1;
}

public RemovePlayerFile(playerid)
{
    new File[128];
    format(File, sizeof(File), "FolderName/%s", GetPlayerNameEx(playerid));

    if(dini_Exists(File))
    {
        dini_Remove(File);
       
        ExampleStat1[playerid] = -1
        ExampleStat2[playerid] = -1
        ExampleStat3[playerid] = -1
        ExampleStat4[playerid] = -1
    }
    return 1;
}
I will try this

Quote:
Originally Posted by [Bios]Marcel
Посмотреть сообщение
Do you mean that u want to delete the files of all players?Or just one player file (or its content)?
Yes. I want to delete the files of all the players

Quote:
Originally Posted by FarTooBaked
Посмотреть сообщение
Oh if you mean to RESET/REMOVE all the data on the players FILE then do it like this...

pawn Код:
new ExampleInt[MAX_PLAYERS];
new Float:ExampleFloat[MAX_PLAYERS];
new ExampleString[MAX_PLAYERS][128];


public RemovePlayerDataFromFile(playerid)
{
    new File[128];
    format(File, sizeof(File), "FolderName/%s", GetPlayerNameEx(playerid));

    if(dini_Exists(File))
    {
        dini_IntSet(File, "ExampleInt", 0);
        dini_SetFloat(File, "ExampleFloat", 0.0);
        dini_Set(File, "ExampleString", "");
    }
    return 1;
}
I think something like that..
I will try this,but it delele and the file with .ini at last? Like "radiobizza.ini" to delete all what contains that file and that file .ini
Reply
#8

Quote:
Originally Posted by radiobizza
Посмотреть сообщение
I will try this



Yes. I want to delete the files of all the players



I will try this,but it delele and the file with .ini at last? Like "radiobizza.ini" to delete all what contains that file and that file .ini
The example I posted first for removing the file will DELETE the FILE and RESET the players information from the file.
Reply
#9

u can either make a list of all players that register (so u know what files exist already) , or delete the whole folder with a plugin (look at the plugin in my https://sampforum.blast.hk/showthread.php?tid=599116 , the "Directory" one)
Reply
#10

Quote:
Originally Posted by FarTooBaked
Посмотреть сообщение
Not really too sure how to show you an example but I think you mean something like this..

pawn Код:
new ExampleStat1[MAX_PLAYERS];
new ExampleStat2[MAX_PLAYERS];
new ExampleStat3[MAX_PLAYERS];
new ExampleStat4[MAX_PLAYERS];

public SavePlayerFile(playerid)
{
    new File[128];
    format(File, sizeof(File), "FolderName/%s", GetPlayerNameEx(playerid));
   
    if(dini_Exists(File))
    {
        dini_IntSet(File, "ExampleStat1", ExampleStat1);
        dini_IntSet(File, "ExampleStat2", ExampleStat1);
        dini_IntSet(File, "ExampleStat3", ExampleStat1);
        dini_IntSet(File, "ExampleStat4", ExampleStat1);
    }
    else
    {
        dini_Create(File);
       
        dini_IntSet(File, "ExampleStat1", ExampleStat1);
        dini_IntSet(File, "ExampleStat2", ExampleStat1);
        dini_IntSet(File, "ExampleStat3", ExampleStat1);
        dini_IntSet(File, "ExampleStat4", ExampleStat1);
    }
    return 1;
}

public LoadPlayerFile(playerid)
{
    new File[128];
    format(File, sizeof(File), "FolderName/%s", GetPlayerNameEx(playerid));

    if(dini_Exists(File))
    {
        ExampleStat1[playerid] = dini_Int(File, "ExampleStat1");
        ExampleStat1[playerid] = dini_Int(File, "ExampleStat2");
        ExampleStat1[playerid] = dini_Int(File, "ExampleStat3");
        ExampleStat1[playerid] = dini_Int(File, "ExampleStat4");
    }
    return 1;
}

public RemovePlayerFile(playerid)
{
    new File[128];
    format(File, sizeof(File), "FolderName/%s", GetPlayerNameEx(playerid));

    if(dini_Exists(File))
    {
        dini_Remove(File);
       
        ExampleStat1[playerid] = -1
        ExampleStat2[playerid] = -1
        ExampleStat3[playerid] = -1
        ExampleStat4[playerid] = -1
    }
    return 1;
}
This is what I did.
PHP код:
public RemovePlayerDataFromFile(playerid)
{
    
GetPlayerName(playeridsendernamesizeof(sendername));
    if(
IsPlayerConnected(playerid))
    {
        for(new 
0MAX_PLAYERS++)
        {
            if(
IsPlayerConnected(i))
            {
                new 
File[128];
                
GetPlayerName(playeridsendernamesizeof(sendername));
                
format(Filesizeof(File), "Users/%s"sendername);
                if(
dini_Exists(File))
                {
                    
dini_Remove(File);
                    
PlayerInfo[i][pKey] = -1;
                    
PlayerInfo[i][pLevel] = -1;
                    
PlayerInfo[i][pAdmin] = -1;
                    
PlayerInfo[i][pHelper] = -1;
                    
PlayerInfo[i][pMisDif] = -1;
                    
PlayerInfo[i][pContracts] = -1;
                    
PlayerInfo[i][pWhisperColor] = -1;
                    
PlayerInfo[i][pFarmerTime] = -1;
                    
PlayerInfo[i][pWarKills] = -1;
                    
PlayerInfo[i][pWarDeaths] = -1;
                    
PlayerInfo[i][pEmail] = -1;
                    
PlayerInfo[i][pInPTH] = -1;
                    
PlayerInfo[i][pMissionSkill] = -1;
                    
PlayerInfo[i][pCompMission] = -1;
                    
PlayerInfo[i][pCancelHits] = -1;
                    
PlayerInfo[i][pDonateRank] = -1;
                    
PlayerInfo[i][pLicenseTime] = -1;
                    
PlayerInfo[i][pRobCount] = -1;
                    
PlayerInfo[i][pGifted] = -1;
                    
PlayerInfo[i][pGiftTokens] = -1;
                    
PlayerInfo[i][pBonusGift] = -1;
                    
PlayerInfo[i][pGifts] = -1;
                    
PlayerInfo[i][pCooked] = -1;
                    
PlayerInfo[i][pPNPoints] = -1;
                    
PlayerInfo[i][pStatsType] = -1;
                    
PlayerInfo[i][gPupgrade] = -1;
                    
PlayerInfo[i][pConnectTime] = -1;
                    
PlayerInfo[i][pClubLeader] = -1;
                    
PlayerInfo[i][pClubMember] = -1;
                    
PlayerInfo[i][pClubRank] = -1;
                    
PlayerInfo[i][pBoxMats] = -1;
                    
PlayerInfo[i][pBoxDrugs] = -1;
                     
PlayerInfo[i][pPbKills] = -1;
                     
PlayerInfo[i][pinPB] = -1;
                    
PlayerInfo[i][pReg] = -1;
                    
PlayerInfo[i][pSex] = -1;
                    
PlayerInfo[i][pAge] = -1;
                    
PlayerInfo[i][pOrigin] = -1;
                    
PlayerInfo[i][pCK] = -1;
                    
PlayerInfo[i][pMuted] = -1;
                    
PlayerInfo[i][pMuteTime] = -1;
                    
PlayerInfo[i][pExp] = -1;
                    
PlayerInfo[i][pCash] = -1;
                    
PlayerInfo[i][pAccount] = -1;
                    
PlayerInfo[i][pCrimes] = -1;
                    
PlayerInfo[i][pGrassObject] = -1;
                    
PlayerInfo[i][MowerTimer] = -1;
                    
PlayerInfo[i][pMowed] = -1;
                    
PlayerInfo[i][pggKills] = -1;
                    
PlayerInfo[i][pggKills2] = -1;
                    
PlayerInfo[i][pggDeaths] = -1;
                    
PlayerInfo[i][pggLevel] = -1;
                    
PlayerInfo[i][pInGG] = -1;
                    
PlayerInfo[i][pKills] = -1;
                    
PlayerInfo[i][pDeaths] = -1;
                    
PlayerInfo[i][pArrested] = -1;
                    
PlayerInfo[i][pWantedLevel] = -1;
                    
PlayerInfo[i][pWantedDeaths] = -1;
                    
PlayerInfo[i][pPhoneBook] = -1;
                    
PlayerInfo[i][pAchievement1] = -1;
                    
PlayerInfo[i][pAchievement2] = -1;
                    
PlayerInfo[i][pAchievement3] = -1;
                    
PlayerInfo[i][pAchievement4] = -1;
                    
PlayerInfo[i][pAchievement5] = -1;
                    
PlayerInfo[i][pAchievement6] = -1;
                    
PlayerInfo[i][pAchievement7] = -1;
                    
PlayerInfo[i][pAchievement8] = -1;
                    
PlayerInfo[i][pAchievement9] = -1;
                    
PlayerInfo[i][pAchievement10] = -1;
                    
PlayerInfo[i][pAchievement11] = -1;
                    
PlayerInfo[i][pAchievement12] = -1;
                    
PlayerInfo[i][pAchievement13] = -1;
                    
PlayerInfo[i][pAchievement14] = -1;
                    
PlayerInfo[i][pAchievement15] = -1;
                    
PlayerInfo[i][pJob] = -1;
                    
PlayerInfo[i][pPayCheck] = -1;
                    
PlayerInfo[i][pHeadValue] = -1;
                    
PlayerInfo[i][pJailed] = -1;
                    
PlayerInfo[i][pWarns] = -1;
                    
PlayerInfo[i][pFactionWarns] = -1;
                    
PlayerInfo[i][pLeaderWarns] = -1;
                    
PlayerInfo[i][pJailTime] = -1;
                    
PlayerInfo[i][pMats] = -1;
                    
PlayerInfo[i][pDrugs] = -1;
                    
PlayerInfo[i][pPills] = -1;
                    
PlayerInfo[i][pSpawnLoc] = -1;
                    
PlayerInfo[i][pLocked] = -1;
                    
PlayerInfo[i][pFMuted] = -1;
                    
PlayerInfo[i][pCMuted] = -1;
                    
PlayerInfo[i][pPillsTime] = -1;
                    
PlayerInfo[i][pMaskuse] = -1;
                    
PlayerInfo[i][pLeader] = -1;
                    
PlayerInfo[i][pMember] = -1;
                    
PlayerInfo[i][pRank] = -1;
                    
PlayerInfo[i][pBounty] = -1;
                    
PlayerInfo[i][pRequestingBackup] = -1;
                    
PlayerInfo[i][pChar] = -1;
                    
PlayerInfo[i][pContractTime] = -1;
                    
PlayerInfo[i][pDetSkill] = -1;
                    
PlayerInfo[i][pSexSkill] = -1;
                    
PlayerInfo[i][pLawSkill] = -1;
                    
PlayerInfo[i][pMechSkill] = -1;
                    
PlayerInfo[i][pJackSkill] = -1;
                    
PlayerInfo[i][pCarSkill] = -1;
                    
PlayerInfo[i][pNewsSkill] = -1;
                    
PlayerInfo[i][pDrugsSkill] = -1;
                    
PlayerInfo[i][pHealth] = -1;
                    
PlayerInfo[i][pSHealth] = -1;
                    
PlayerInfo[i][pInt] = -1;
                    
PlayerInfo[i][pLocal] = -1;
                    
PlayerInfo[i][pTeam] = -1;
                    
PlayerInfo[i][pModel] = -1;
                    
PlayerInfo[i][pPnumber] = -1;
                    
PlayerInfo[i][pPhousekey] = -1;
                    
PlayerInfo[i][pPbiskey] = -1;
                    
PlayerInfo[i][pPos_x] = -1;
                    
PlayerInfo[i][pPos_y] = -1;
                    
PlayerInfo[i][pPos_z] = -1;
                    
PlayerInfo[i][pFPunish] = -1;
                    
PlayerInfo[i][pCarLic] = -1;
                    
PlayerInfo[i][pFreeTime] = -1;
                    
PlayerInfo[i][pFlyLic] = -1;
                    
PlayerInfo[i][pBoatLic] = -1;
                    
PlayerInfo[i][pGunLic] = -1;
                    
PlayerInfo[i][pGun1] = -1;
                    
PlayerInfo[i][pGun2] = -1;
                    
PlayerInfo[i][pGun3] = -1;
                    
PlayerInfo[i][pGun4] = -1;
                    
PlayerInfo[i][pAmmo1] = -1;
                    
PlayerInfo[i][pAmmo2] = -1;
                    
PlayerInfo[i][pAmmo3] = -1;
                    
PlayerInfo[i][pAmmo4] = -1;
                    
PlayerInfo[i][pCarTime] = -1;
                    
PlayerInfo[i][pPayDay] = -1;
                    
PlayerInfo[i][pPayDayHad] = -1;
                    
PlayerInfo[i][pCDPlayer] = -1;
                    
PlayerInfo[i][pAlcoholPerk] = -1;
                    
PlayerInfo[i][pDrugPerk] = -1;
                    
PlayerInfo[i][pMiserPerk] = -1;
                    
PlayerInfo[i][pPainPerk] = -1;
                    
PlayerInfo[i][pTraderPerk] = -1;
                    
PlayerInfo[i][pTut] = -1;
                    
PlayerInfo[i][pMissionNr] = -1;
                    
PlayerInfo[i][pAdjustable] = -1;
                    
PlayerInfo[i][pFuel] = -1;
                    
PlayerInfo[i][pVirWorld] = -1;
                    
PlayerInfo[i][pMarried] = -1;
                    
PlayerInfo[i][pMarriedTo] = -1;
                    
PlayerInfo[i][pPcarkey] = -1;
                    
PlayerInfo[i][pPcarkey2] = -1;
                    
PlayerInfo[i][pPcarkey3] = -1;
                    
Kick(i);
                }
            }
        }
    }
    return 
1;

But doesn' work. Can you help me please?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)