Is it possible with a module / hook to check when a banned player joins and print things to his console? Because I don't like how it says "Disconnected: You have been banned by the server!" and just kick you or something like that...
I want to print to the player his ban reason and such... Am I going to have to make my own ban system to do so?
Well if you are using the [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index5982.html?title=Player.Kick"]Player:Kick()[/URL] method, there is an argument that lets you specify the kick reason. The output would be something like
You have been disconnected by the server:[I] "[Your reason would go here]"[/I]
[lua]
for k, v in pairs( player.GetAll() ) do
v:Kick("For being on my server!");
end
[/lua]
[QUOTE=InfernalCookie;35309956]Is it possible with a module / hook to check when a banned player joins and print things to his console? Because I don't like how it says "Disconnected: You have been banned by the server!" and just kick you or something like that...
I want to print to the player his ban reason and such... Am I going to have to make my own ban system to do so?[/QUOTE]
It's better to write your own ban system, using [URL="http://facepunch.com/threads/695636"]gatekeeper[/URL]. That way you have total control over the disconnect message.
$5 I'll give you my code. Assuimg you ban via mysql if not I'll give you code to do so.
[QUOTE=InfernalCookie;35309956]check when a banned player joins and print things to his console?[/QUOTE]
I already have gatekeeper and stuff. But I decided to make my own ban system, I'm doing fine other than the fact that for some reason it can't find "Length" in my table... I'll ask later if I need the help.
[editline]27th March 2012[/editline]
Okay so I ran into a problem where I don't know how to remove the previous bans... Right now I have:
( Using tmysql )
"CREATE TABLE Banned ( ID varchar(255), Length int, OSTime int, Reason varchar(255), Admin varchar(255), Server varchar(255) )"
And each time it bans a player it adds 1 to the index. Now say ban 1 is over and should be unbanned, how would I remove that index? I know "DROP TABLE Banned" will remove the ENTIRE table, but how would I remove just the index from that table?
Ah yes, good old SQL Syntax =P Can get confusing until you have used it enough. This should work:
DELETE FROM Banned WHERE ID = 'IDHere'
Here is a good place for figuring out all of the commands
[URL="http://www.tizag.com/sqlTutorial/index.php"]http://www.tizag.com/sqlTutorial/index.php[/URL]
Oh thanks man! You are a life saver! :P
Sorry, you need to Log In to post a reply to this thread.