multitheftauto/mtasa-blue

onPlayerDisconnect

Closed this issue ยท 4 comments

Is your feature request related to a problem? Please describe.

Previously, ban events were only logged on the server console. If a banned player reconnected to the server, or if a player joined with the same name, no information was sent to the Lua side. While this functionality might not be essential for everyone, it is available for optional usage for those who may find it useful. For instance, it can be utilized for Discord logging or other custom integrations.

Describe the solution you'd like

addEventHandler("onPlayerDisconnect",root,function(playerNick, playerIP, reason, playerUsername, playerSerial)
	iprint("onPlayerDisconnect",reason,playerNick)
end)

Security Policy

  • I have read and understood the Security Policy and this issue is not about a cheat or security vulnerability.

Can't this approach be done using onPlayerBan?

Can't this approach be done using onPlayerBan?

I know this event is triggered when a ban is applied. When someone previously banned joins the game, no information is sent to the Lua side. It's not a strictly necessary feature, but I mentioned it so that anyone who wants to keep a log can use it.

Yes, I understand you now. This could be important for tracking the activity of some banned individuals who attempt to reconnect. Being able to capture their latest data during these connection attempts can help the server staff gather more information about them and determine whether their behavior is suspicious or not.

If you really need this information here's a workaround: Use a custom ban system (there's a community resource called sqlbans) and that then uses onPlayerConnect and cancels that event, that way you will get the info from that.