checking banlog ingame -
suni - 20.05.2015
is there a way to check banlog ingame for zcmd? if yes, idk how to do it.
Re: checking banlog ingame -
Alex Magaсa - 20.05.2015
I believe it's not possible for a non-mysql server to check from inside game the bans.
I know a way about mysql based gamemodes to check bans but it's difficult for beginners.
Re: checking banlog ingame -
Konstantinos - 20.05.2015
Do you mean by "banlog" to read from samp.ban? That's not possible as far as I know. Any other, yes - it's possible but it all depends on what you use for saving/loading the ban data.
Re: checking banlog ingame -
suni - 20.05.2015
from scriptfile folder
Re: checking banlog ingame -
Abagail - 20.05.2015
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 Код:
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)
}
Re: checking banlog ingame -
Konstantinos - 20.05.2015
Quote:
Originally Posted by Abagail
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 Код:
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) }
|
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):
Quote:
This function can't access files outside the 'scriptfiles' folder!
|
The only way to read from it would be using FileManager plugin I guess.
Re: checking banlog ingame -
suni - 20.05.2015
i installed filemanager plugin.
i created a command checkbanlist.(idk if i create it right)
Код:
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;
}
i wanted to load a list of banned players ingame using /checkbanlist
and it would loaded the list of banned players in the banlog by dialog msg box. but idk how.
Re: checking banlog ingame -
Banana_Ghost - 20.05.2015
You can create a softlink on Linux and Windows to copy the banfile from the server directory to the scriptfiles folder.
Look up on how to use the command:
ln - Linux
mklink - Windows
Once you do that, you can use fopen, etc to open and parse the banfile.
~ -
Abagail - 20.05.2015
Quote:
Originally Posted by Konstantinos
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.
|
I didn't test the code, and he said:
Quote:
Originally Posted by suni
from scriptfile folder
|
so he doesn't need filemanager, I'd advise you to read all the posts before commenting in the future! As for returning both types, I have never encountered that error so I guess it was my fault for that part - I really had no idea such an error existed. I am guessing he has something like "ban.log" so that's why I chose that file name.
Re: checking banlog ingame -
suni - 20.05.2015
the banlog is in 3 folders