Add reason for closing connection when returning false on server event "PlayerConnect"
under review
SyedMuhammad
The "design solution" that need to be solved is how to pass the reason as the Player entity doesn't exist yet and we can't call a function in a proper way there. I'm accepting suggestions.
NegativeName
SyedMuhammad: Add a new return value? (bAllow, sReason)
SyedMuhammad
NegativeName: This is though as events only support boolean returns (as we can have several lua functions being called, the booleans returned are combined and it makes sense), I would really love to have another solution before starting to think on a big refactoration on that internally
NegativeName
SyedMuhammad: Yeah actually that's complicated to imagine a way to do it now...
T
Timmy
SyedMuhammad Would it be fine to keep the boolean-only for the first value returned, and support any other type for other returned values?
SyedMuhammad
Timmy: you mean like
return false, "you ugly"
?T
Timmy
SyedMuhammad yes
SyedMuhammad
Timmy it would be possible, but my argument above keeps the same, I would need to refactor a lot internally for a single only method that has this different design
I'm willing to add a new method like
Server.PreventPlayerConnect(kick_reason)
that can only be called from inside that event instead of a new return implementationSyedMuhammad
or like a new method
Server.KickPlayerByIP()
that could be used more generallyT
Timmy
SyedMuhammad This would do the trick for this event, but don't you think that this design may be problematic in the future if other events are also in need of a return value of a different type?
SyedMuhammad
Timmy yeah, but I'd prefer having to refactor it when having at least 2 use cases instead of just one now 😅
T
Timmy
SyedMuhammad Sounds good
SyedMuhammad
under review