Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if SERVER then
- MsgN( "[MS Server Print] Working." )
- local function convertTo866( str )
- local tbl = {}
- for p, c in utf8.codes( str ) do
- table.insert( tbl, c )
- end
- for i = 1, table.Count( tbl ) do
- -- https://en.wikipedia.org/wiki/Code_page_866
- -- LOWER
- if tbl[i] == utf8.codepoint( "а" ) then
- tbl[i] = 160
- elseif tbl[i] == utf8.codepoint( "б" ) then
- tbl[i] = 161
- elseif tbl[i] == utf8.codepoint( "в" ) then
- tbl[i] = 162
- elseif tbl[i] == utf8.codepoint( "г" ) then
- tbl[i] = 163
- elseif tbl[i] == utf8.codepoint( "д" ) then
- tbl[i] = 164
- elseif tbl[i] == utf8.codepoint( "е" ) then
- tbl[i] = 165
- elseif tbl[i] == utf8.codepoint( "ё" ) then
- tbl[i] = 241
- elseif tbl[i] == utf8.codepoint( "ж" ) then
- tbl[i] = 166
- elseif tbl[i] == utf8.codepoint( "з" ) then
- tbl[i] = 167
- elseif tbl[i] == utf8.codepoint( "и" ) then
- tbl[i] = 168
- elseif tbl[i] == utf8.codepoint( "й" ) then
- tbl[i] = 169
- elseif tbl[i] == utf8.codepoint( "к" ) then
- tbl[i] = 170
- elseif tbl[i] == utf8.codepoint( "л" ) then
- tbl[i] = 171
- elseif tbl[i] == utf8.codepoint( "м" ) then
- tbl[i] = 172
- elseif tbl[i] == utf8.codepoint( "н" ) then
- tbl[i] = 173
- elseif tbl[i] == utf8.codepoint( "о" ) then
- tbl[i] = 174
- elseif tbl[i] == utf8.codepoint( "п" ) then
- tbl[i] = 175
- elseif tbl[i] == utf8.codepoint( "р" ) then
- tbl[i] = 224
- elseif tbl[i] == utf8.codepoint( "с" ) then
- tbl[i] = 225
- elseif tbl[i] == utf8.codepoint( "т" ) then
- tbl[i] = 226
- elseif tbl[i] == utf8.codepoint( "у" ) then
- tbl[i] = 227
- elseif tbl[i] == utf8.codepoint( "ф" ) then
- tbl[i] = 228
- elseif tbl[i] == utf8.codepoint( "х" ) then
- tbl[i] = 229
- elseif tbl[i] == utf8.codepoint( "ц" ) then
- tbl[i] = 230
- elseif tbl[i] == utf8.codepoint( "ч" ) then
- tbl[i] = 231
- elseif tbl[i] == utf8.codepoint( "ш" ) then
- tbl[i] = 232
- elseif tbl[i] == utf8.codepoint( "щ" ) then
- tbl[i] = 233
- elseif tbl[i] == utf8.codepoint( "ъ" ) then
- tbl[i] = 234
- elseif tbl[i] == utf8.codepoint( "ы" ) then
- tbl[i] = 235
- elseif tbl[i] == utf8.codepoint( "ь" ) then
- tbl[i] = 236
- elseif tbl[i] == utf8.codepoint( "э" ) then
- tbl[i] = 237
- elseif tbl[i] == utf8.codepoint( "ю" ) then
- tbl[i] = 238
- elseif tbl[i] == utf8.codepoint( "я" ) then
- tbl[i] = 239
- -- UPPER
- elseif tbl[i] == utf8.codepoint( "А" ) then
- tbl[i] = 128
- elseif tbl[i] == utf8.codepoint( "Б" ) then
- tbl[i] = 129
- elseif tbl[i] == utf8.codepoint( "В" ) then
- tbl[i] = 130
- elseif tbl[i] == utf8.codepoint( "Г" ) then
- tbl[i] = 131
- elseif tbl[i] == utf8.codepoint( "Д" ) then
- tbl[i] = 132
- elseif tbl[i] == utf8.codepoint( "Е" ) then
- tbl[i] = 133
- elseif tbl[i] == utf8.codepoint( "Ё" ) then
- tbl[i] = 240
- elseif tbl[i] == utf8.codepoint( "Ж" ) then
- tbl[i] = 134
- elseif tbl[i] == utf8.codepoint( "З" ) then
- tbl[i] = 135
- elseif tbl[i] == utf8.codepoint( "И" ) then
- tbl[i] = 136
- elseif tbl[i] == utf8.codepoint( "Й" ) then
- tbl[i] = 137
- elseif tbl[i] == utf8.codepoint( "К" ) then
- tbl[i] = 138
- elseif tbl[i] == utf8.codepoint( "Л" ) then
- tbl[i] = 139
- elseif tbl[i] == utf8.codepoint( "М" ) then
- tbl[i] = 140
- elseif tbl[i] == utf8.codepoint( "Н" ) then
- tbl[i] = 141
- elseif tbl[i] == utf8.codepoint( "О" ) then
- tbl[i] = 142
- elseif tbl[i] == utf8.codepoint( "П" ) then
- tbl[i] = 143
- elseif tbl[i] == utf8.codepoint( "Р" ) then
- tbl[i] = 144
- elseif tbl[i] == utf8.codepoint( "С" ) then
- tbl[i] = 145
- elseif tbl[i] == utf8.codepoint( "Т" ) then
- tbl[i] = 146
- elseif tbl[i] == utf8.codepoint( "У" ) then
- tbl[i] = 147
- elseif tbl[i] == utf8.codepoint( "Ф" ) then
- tbl[i] = 148
- elseif tbl[i] == utf8.codepoint( "Х" ) then
- tbl[i] = 149
- elseif tbl[i] == utf8.codepoint( "Ц" ) then
- tbl[i] = 150
- elseif tbl[i] == utf8.codepoint( "Ч" ) then
- tbl[i] = 151
- elseif tbl[i] == utf8.codepoint( "Ш" ) then
- tbl[i] = 152
- elseif tbl[i] == utf8.codepoint( "Щ" ) then
- tbl[i] = 153
- elseif tbl[i] == utf8.codepoint( "Ъ" ) then
- tbl[i] = 154
- elseif tbl[i] == utf8.codepoint( "Ы" ) then
- tbl[i] = 155
- elseif tbl[i] == utf8.codepoint( "Ь" ) then
- tbl[i] = 156
- elseif tbl[i] == utf8.codepoint( "Э" ) then
- tbl[i] = 157
- elseif tbl[i] == utf8.codepoint( "Ю" ) then
- tbl[i] = 158
- elseif tbl[i] == utf8.codepoint( "Я" ) then
- tbl[i] = 159
- end
- end
- return string.char( unpack(tbl) )
- end
- hook.Remove( "PlayerSay", "MS_PrintValidConsoleChars" )
- hook.Add( "PlayerSay", "MS_PrintValidConsoleChars", function( sender, text, teamChat )
- -- Priority, text, userid
- local ply = sender
- text = utf8.force( text ) -- Fixing utf8 string
- print( ( IsValid(ply) and ply:Name() or "Console")..": "..text )
- -- return false -- Then message will not show in player chat
- end )
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement