• TTT - Notifying about a karma banned in chat
    10 replies, posted
Karma bans by defualt are issued without notifying anyone but the victim. Is there a way to have a notification about someone being karma banned in chat?
Print the message here instead of just logging it: [url]https://github.com/garrynewman/garrysmod/blob/f9f8ebe5341a5f69191dbef4c86b532e534c60a8/garrysmod/gamemodes/terrortown/gamemode/karma.lua#L337[/url]
[QUOTE=code_gs;48488028]Print the message here instead of just logging it: [url]https://github.com/garrynewman/garrysmod/blob/f9f8ebe5341a5f69191dbef4c86b532e534c60a8/garrysmod/gamemodes/terrortown/gamemode/karma.lua#L337[/url][/QUOTE] Not too great with Lua, am i making a Print line?
[QUOTE=seabeds;48488201]Not too great with Lua, am i making a Print line?[/QUOTE] Just do as code gs said, use any function that prints it to the chat, eg using a for loop that uses PrintMessage on every player, or chat.addtext.
[QUOTE=whitestar;48488212]Just do as code gs said, use any function that prints it to the chat, eg using a for loop that uses PrintMessage on every player, or chat.addtext.[/QUOTE] Would this work?: [CODE] ServerLog(ply:Nick() .. " autokicked/banned for low karma.\n") chat.AddText ply:Nick() .. "was karma banned." ) [/CODE]
thehell no, you are missing an (, and the file is serverside, so you'd have (as I said..) make a for loop that does that..
[code]for _, ply in ipairs( player.GetAll() ) do ply:PrintMessage( "message here" ) end[/code]
[code] hook.Add("TTTKarmaLow", "NotifyForKarmaBan", function(ply) PrintMessage( HUD_PRINTTALK, "Player '" .. ply:Nick() .. "' has been banned for low karma." ) end) [/code] [URL="http://ttt.badking.net/guides/hooks"]http://ttt.badking.net/guides/hooks[/URL] [URL="http://wiki.garrysmod.com/page/Global/PrintMessage"]http://wiki.garrysmod.com/page/Global/PrintMessage[/URL]
[QUOTE=MuteTM;48488834][code] hook.Add("TTTKarmaLow", "NotifyForKarmaBan", function(ply) PrintMessage( HUD_PRINTTALK, "Player '" .. ply:Nick() .. "' has been banned for low karma." ) end) [/code] [URL="http://ttt.badking.net/guides/hooks"]http://ttt.badking.net/guides/hooks[/URL] [URL="http://wiki.garrysmod.com/page/Global/PrintMessage"]http://wiki.garrysmod.com/page/Global/PrintMessage[/URL][/QUOTE] Placed it right beneath [CODE] ServerLog(ply:Nick() .. " autokicked/banned for low karma.\n")[/CODE] And it didnt work. Just to remind you, I am not good with lua, that's why i came here to learn and get help. EDIT: tried a 2nd time and it worked
[QUOTE=seabeds;48493391]Placed it right beneath [CODE] ServerLog(ply:Nick() .. " autokicked/banned for low karma.\n")[/CODE] And it didnt work. Just to remind you, I am not good with lua, that's why i came here to learn and get help. EDIT: tried a 2nd time and it worked[/QUOTE] you just could've made an addon instead of overwriting core files, duh >-<
[QUOTE=whitestar;48493613]you just could've made an addon instead of overwriting core files, duh >-<[/QUOTE] There's no hook for that section.
Sorry, you need to Log In to post a reply to this thread.