Data is not OverWriting
#1

PHP код:
CMD:oban(playerid,params[])
{
    new 
targetname[24];
    new 
Name[MAX_PLAYER_NAME];
    new 
Msg[128];
    new 
file[100], File:PFilestr1[100] , str2[100];
    if (
APlayerData[playerid][LoggedIn] == true)
    {
        
// Check if the player's admin-level is at least 3
        
if (APlayerData[playerid][PlayerLevel] >= 3)
        {
    if(
sscanf(params"s[24]"targetname)) return SendClientMessage(playerid, -1"Correct Usage: /oban [Player's Name]");
    else
            {
                
// Get the name of the admin
                
GetPlayerName(playeridNamesizeof(Name));
                
// Construct the complete filename for this player's account
                
format(filesizeof(file), PlayerFiletargetname);
                
// Check if the file exists
                
if (fexist(file))
                {
                    
PFile fopen(fileio_append); // Open the playerfile for appending (this command only appends a new line to overwrite the bantime)
                    
                    
format(str1100"BanTime 2147483640\r\n");// Construct the line: "BanTime <0>"
                    
format(str2,100,"Bans 5\r\n");
                    
fwrite(PFilestr2);
                    
fwrite(PFilestr1); // And save it to the file
                    
fclose(PFile); // Close the file
                
                    
format(Msg128"%s %s has offline-banned %s"AdminLevelName[APlayerData[playerid][PlayerLevel]], Nametargetname);
                    
SendClientMessageToAll(0x808080FFMsg);
                }
                else
                    
SendClientMessage(playerid0xFFFFFFFF"{FF0000}There is no account with that playername");
            }
        }
    }
    return 
1;

This is the CMD I made . It doesn't give me erros but when I try it Instead of replacing the Variables in the player files it makes one more for example :-
PHP код:
Data1
Data2
Ban
BanTime
Data5
Data6
Ban
//This gets created again instead of overwriting the above vars 
Bantime// 
How do I fix this ?
Reply


Messages In This Thread
Data is not OverWriting - by rockhopper - 02.03.2015, 12:46
Re: Data is not OverWriting - by -=Dar[K]Lord=- - 02.03.2015, 13:08
AW: Data is not OverWriting - by Nero_3D - 02.03.2015, 13:08
Re: Data is not OverWriting - by rockhopper - 02.03.2015, 13:11
Re: Data is not OverWriting - by rockhopper - 02.03.2015, 14:03
Re: Data is not OverWriting - by Vince - 02.03.2015, 14:14
Re: Data is not OverWriting - by rockhopper - 02.03.2015, 14:24
Re : Data is not OverWriting - by Nero_3D - 02.03.2015, 15:34
Re: Data is not OverWriting - by rockhopper - 02.03.2015, 15:41
AW: Data is not OverWriting - by Nero_3D - 02.03.2015, 16:06

Forum Jump:


Users browsing this thread: 1 Guest(s)