20.05.2015, 18:42
is there a way to check banlog ingame for zcmd? if yes, idk how to do it.
stock LoadBansAsString(string[])
{
new File: handle = fopen("bans.log"), buf[200];
if(handle) {
fread(handle, buf);
return buf;
}
return 0; // bad file(handle couldn't be established)
}
Yes you can using native functions! You can use file and string functions to do this(as you can get file contents as a string easily):
e.g: pawn Код:
|
This function can't access files outside the 'scriptfiles' folder! |
CMD:checkbanlist(playerid, params[]) { if(PlayerAcc[playerid][Admin] >= 3) { stock LoadBansAsString(string[]) { new File: handle = fopen("banlog"), buf[200]; if(handle) { fread(handle, buf); return buf; } return 0; // bad file(handle couldn't be established) } } return 1; }
Have you even tested your code? Returning both a string (array) and integer which results in error 079.
Also from the wiki (https://sampwiki.blast.hk/wiki/Fopen): The only way to read from it would be using FileManager plugin I guess. |