• Custom "You have been banned from this server" message?
    17 replies, posted
I have a server and I want to change the default message (either with lua or the config file, I don't see it anywhere in the config) when you are banned and it says "You are banned from this server" to a link to my forums. Where can I find the necessary files to modify? I checked both my ulib and ulx install but can't seem to find it there so I imagine I'm looking in the wrong place.
You have to write your own ban system. ULX (and Evolve) uses Source's built in "banid" concommand, which doesn't provide a reason when banned.
[QUOTE=Mors Quaedam;43491837]You have to write your own ban system. ULX (and Evolve) uses Source's built in "banid" concommand, which doesn't provide a reason when banned.[/QUOTE] I know ULX you can set a reason 'ulx ban <player> <time> <reason>' In the xgui admin tab, you can set preset ban reasons too, adding your website in there shouldn't be too hard
[QUOTE=Scratch.;43491998]I know ULX you can set a reason 'ulx ban <player> <time> <reason>'[/QUOTE] He means when you connect after you've been banned.
[QUOTE=Shinycow;43492008]He means when you connect after you've been banned.[/QUOTE] [img]http://puu.sh/60yo6/1308776aa8.png[/img] Something like that. As I said before, it requires a custom written ban system.
Wouldn't it be a matter of just seeing if they're banned, and if so displaying that message on the connect message?
[url]http://wiki.garrysmod.com/page/GM/CheckPassword[/url] If you're using ULX then you could try something like this: [CODE] hook.Add("CheckPassword", "CustomBannedMessage", function( steamid ) if ULib.bans[ steamid ] then return false, "You're banned! Visit www.yourforum.com to appeal it." end end) [/CODE]
[QUOTE=Zazibar;43493355][url]http://wiki.garrysmod.com/page/GM/CheckPassword[/url] If you're using ULX then you could try something like this: [CODE] hook.Add("CheckPassword", "CustomBannedMessage", function( steamid ) if ULib.bans[ steamid ] then return false, "You're banned! Visit www.yourforum.com to appeal it." end end) [/CODE][/QUOTE] I'd say [url=http://wiki.garrysmod.com/page/GM/PlayerAuthed]PlayerAuthed[/url] would be a more fitting hook for this, like such: [lua] hook.Add( 'PlayerAuthed', 'CheckIfBanned', function( ply ) if ULib.bans[ply:SteamID64()] then ply:Kick( 'You're banned! Visit www.yourforum.com to appeal it.' ) end end ) [/lua]
[QUOTE=TVC;43493969]I'd say [url=http://wiki.garrysmod.com/page/GM/PlayerAuthed]PlayerAuthed[/url] would be a more fitting hook for this, like such: [lua] hook.Add( 'PlayerAuthed', 'CheckIfBanned', function( ply ) if ULib.bans[ply:SteamID64()] then ply:Kick( 'You're banned! Visit [url]www.yourforum.com[/url] to appeal it.' ) end end ) [/lua][/QUOTE] This is supposed to happen after you let them authenticate, the other hook is designed specifically for "you are banned" type messages.
[QUOTE=Zazibar;43493355][url]http://wiki.garrysmod.com/page/GM/CheckPassword[/url] If you're using ULX then you could try something like this: [CODE] hook.Add("CheckPassword", "CustomBannedMessage", function( steamid ) if ULib.bans[ steamid ] then return false, "You're banned! Visit www.yourforum.com to appeal it." end end) [/CODE][/QUOTE] Exactly what I was looking for, thanks!
Does anyone want to assist me? I installed the 'code' into lua/autorun but it didn't work. I then tried using client and server but it didn't work ever.
[QUOTE=Sm63;43510018]Does anyone want to assist me? I installed the 'code' into lua/autorun but it didn't work. I then tried using client and server but it didn't work ever.[/QUOTE] You have to be running it from Server and you need to restart to get it to pick up the new file(s). If you don't know this you need to not be running a server.
[QUOTE=OzymandiasJ;43510485]You have to be running it from Server and you need to restart to get it to pick up the new file(s). If you don't know this you need to not be running a server.[/QUOTE] You do not need to restart the server to pick up files in lua/autorun. From my knowledge, you only need to restart for the server to see new addons from the addons folder.
[QUOTE=Sm63;43510718]You do not need to restart the server to pick up files in lua/autorun. From my knowledge, you only need to restart for the server to see new addons from the addons folder.[/QUOTE] Map restart != Server restart, I didn't specify which.
[QUOTE=Zazibar;43493355][url]http://wiki.garrysmod.com/page/GM/CheckPassword[/url] If you're using ULX then you could try something like this: [CODE] hook.Add("CheckPassword", "CustomBannedMessage", function( steamid ) if ULib.bans[ steamid ] then return false, "You're banned! Visit www.yourforum.com to appeal it." end end) [/CODE][/QUOTE] Where would I put this for a gamemode?
[QUOTE=Frozendairy;45487301]Where would I put this for a gamemode?[/QUOTE] In a server side file?
I suggest not using it for a gamemode, but rather for an admin mod of some sorts. A lot of people don't like admin mods built in.
Sorry, you need to Log In to post a reply to this thread.