Jump to content

help with Russians letters[SOLVED]


Kenix

Recommended Posts

Hi, i have problem with Russians letters,

I already tryed with string.find but I had a problem with $ so I made a custom function with Citizen's help.

Client:

words = {"а","б","в","г","д","е","ё","ж","з","и","й","к","л","м","о","п","р","с","т","у","ф","х","ц","ч","щ","ь","ы","ъ","э","ю","я","!","@","#","$","%","^","&","*","(",")","№",";",":","?"} 
loginButton = {} 
loginEdit = {} 
  
loginEdit[0] = guiCreateEdit(0.475,0.4263,0.0812,0.0244,"",true) -- едит аккаунта 
guiSetAlpha(loginEdit[0],0.75) 
loginButton[2] = guiCreateButton(0.3858,0.8154,0.1917,0.0601,"Зарегистрироваться",true) 
addEventHandler("onClientGUIClick",loginButton[2], 
                function() 
                    local accText = guiGetText(loginEdit[0]) 
                    if string.findtable(accText,words) then 
                        -- do some stuff 
                    end 
                end) 
  
  
function string.findtable( text, theTable )  
    for j=1, string.len( text ) do 
        local char = string.sub( tostring(text), j, j ) 
        for k=1, #theTable do  
            local character = theTable[k]  
            --outputChatBox( "if "..tostring(char).." == "..tostring(character)..") then", 0, 200, 0 ) 
            outputDebugString( "if "..tostring(char).." == "..tostring(character).." then") 
             
            if  char == character then 
                outputChatBox( "found invalid character", 0, 255, 0 ) 
                return true  
            end 
        end 
    end  
    outputChatBox( "not found invalid character", 255, 0, 0 ) 
    return false 
end 

When I type the д in the edit, then in the clientscript.log, I see 'if Р == Рґ then' instead of 'if д == д then'

I saw that there is some utf functions, but I don't know how to use it and if they can fix my problem.

Thanks for helping me,

kenix

Edited by Guest
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...