Author Topic: Function called when player is banned  (Read 916 times)

Quick question, does anyone know what function is called when the player is banned?
I need to get


Banned clients name / BL_ID
Ban reason
The time the client was banned for.
Banners Name / BL_ID

I'm 90% sure GUI bans call banBLID( ID, time, reason ). However, serverCmdBan(%banningClient, %name, %id, %time, %reason) should fit your needs.

you can always check BanManagerSO for the most recent ban

BanManagerSO.dumpBans();


--

for a more correct answer, you can also just parent the addition to BanManagerSO

I believe it's either

BanManagerSO::Add
or
BanManagerSO::AddBan

the parameters are
BannerName BannerID BannedName BannedID BannedIP twodigityearofban minutes

minutes is the amount of minutes into the current year that the ban will expire

It's worth noting that BanManagerSO::AddBan will be called repeatedly to add existing bans when a server starts up.

It's worth noting that BanManagerSO::AddBan will be called repeatedly to add existing bans when a server starts up.
So I can basically call that function with the set parameters and then when my server starts up it will ban those people?

So actually what I am trying to do is intercept the called ban, extract info from it and then authenticate that ban,
eg

A bans B
This mod pulls out some info like...
B's name & BL_ID
B's ban time
B's Ban reason
The banner (In this case is A)

then lets the ban ban the player.

in that case use servercmdBan

in that case use servercmdBan
But I am not banning them myself, what I am trying to do is just get the details of the ban whenever someone is banned.

serverCmdBan is called whenever anyone issues a ban, not just yourself. banBLID is the backend function that actually writes the ban. BanManagerSO::addBan simply adds it to the ban list for quick checking when someone connects rather than reading the ban file. BanManagerSO entries are not permanent.

Code: [Select]
function serverCmdBan(%client, %name, %blid, %time, %reason)
{
    if(%client.isAdmin)
        announce(%client.getPlayerName() SPC "issued a ban for BL_ID" SPC %blid SPC "(" @ %name @ ") at the length" SPC %time SPC "for the reason of" SPC %reason @ ".");
    parent::serverCmdBan(%client, %name, %blid, %time, %reason);
}
« Last Edit: March 12, 2014, 11:49:56 PM by $trinick »

BanListSO?

Are you referring to BanManagerSO?
BanManagerSO is a temporary (loaded on server startup, saved on close) 'class' containing the contents if BanList.txt

banBLID I have no experience with so I can't help there

I meant to type BanManagerSO, my bad. Corrected.

Also, I'm not confident that BanManagerSO is saved on close. I'm positive that bans are written (saved) at the time of the issuance, so it wouldn't make sense for them to be saved again at server close.

I meant to type BanManagerSO, my bad. Corrected.

Also, I'm not confident that BanManagerSO is saved on close. I'm almost positive that bans are written (saved) at the time of the issuance, not at server close.

If banBLID is the actually the backend function then it adds the ban to the BanManagerSO and calls it's save function.

The only other time it is called is on server close
Feel free to run a trace to check this

I took you up on it.

BanManagerSO::saveBans is not called on server close. However, I was wrong about banBLID being the backend for serverCmdBan (in my defense I did only say I was 90% sure). It goes serverCmdBan -> BanManagerSO::addBan -> BanManagerSO::saveBans when the GUI is used to ban somebody. BanManagerSO::saveBans is only called when a new player is banned. So, to fabricate a ban, you must call both addBan and saveBans on the BanManagerSO object.

neat,

And when I said to trace it I didn't mean it in a sense of implying I was right.  Currently on mobile and trying to cut down on typing

Anyways, that's interesting, because I remembered a text when I wrote directly to BanList.txt and without banning anyone, when I closed to server my appendage was removed.

May of been caused by something else, who knowx

when I closed to server my appendage was removed.
I know what you meant, but this made me laugh.