checking banlog ingame
#1

is there a way to check banlog ingame for zcmd? if yes, idk how to do it.
Reply
#2

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.
Reply
#3

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.
Reply
#4

from scriptfile folder
Reply
#5

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)
}
Reply
#6

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.
Reply
#7

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.
Reply
#8

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.
Reply
#9

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.
Reply
#10

the banlog is in 3 folders
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)