18.08.2013, 01:33
Hello,
I have a player file created with Y_INI, however I only want to load one line from this file. The way I want to do this is with native SAMP File Functions (Found here: https://sampwiki.blast.hk/wiki/File_Functions), however I cannot make head or tail of it.
The line I want to retrieve is: "IP = ***.***.***.***"
I do not want to parse the whole file as the player isn't going to be actively online for this function, however I also don't want to use Y_INI to parse one line of information.
I have tried attempting this myself:
As you can see here I am trying to delete a ban file using the IP from within "LuckyGuys" file, which I have set this to the correct path.
This is shown here by the inital LuckyGuy result back from sccanf is being formatted into string.
I have a player file created with Y_INI, however I only want to load one line from this file. The way I want to do this is with native SAMP File Functions (Found here: https://sampwiki.blast.hk/wiki/File_Functions), however I cannot make head or tail of it.
The line I want to retrieve is: "IP = ***.***.***.***"
I do not want to parse the whole file as the player isn't going to be actively online for this function, however I also don't want to use Y_INI to parse one line of information.
I have tried attempting this myself:
pawn Код:
new File:PlayerIP = fopen(LuckyGuy, io_read);
new string[15 + 5];
while(fread(PlayerIP, string))
{
if(strcmp(string, "IP = ", true)==0)
{
strmid(string, string, 5, 20, 15);
}
}
format(LuckyGuy, sizeof(LuckyGuy), Ban_Path, string);
if(fremove(LuckyGuy)) return SendClientMessage(playerid, COLOR_RED, "|-- Error: Account Deletion Failed!");
pawn Код:
format(LuckyGuy, sizeof(LuckyGuy), PATH, LuckyGuy);