Jump to content

كود بحث


KaduRo

Recommended Posts

السلام عليكم

شباب محتاج مساعدة في كود بحث , مثلآ

سكربت لأسامي الاسلحة , وكتبت اول حرف من السلاح , يطلع لي اسم السلاح كامل

وهذا كود بسيط ومومضبوط بس لتوضيح الطلب

table1 = { "Good" , "Bad " , "No" , "Yes" }  
  
function Name (v) 
    v = tostring(v) 
    n = string.match(table.concat(table1) , v) 
    return v 
end  
outputChatBox(Name("G")) 

عند كتابة حرف G

ابيه يظهر لي كلمة Good

في الشات

Link to comment
table1 = { "Good" , "Bad " , "No" , "Yes" } 
  
function Name (v) 
    local v = tostring(v) 
    if v then 
        for _, word in ipairs(table1) do 
            if word:lower():find(v:lower()) then 
                return word 
            end 
        end 
    end 
end 
outputChatBox(Name("G")) 

Link to comment
table1 = { "Good" , "Bad " , "No" , "Yes" } 
  
function Name (v) 
    local v = tostring(v) 
    if v then 
        local string = "" 
        for _, word in ipairs(table1) do 
            if word:lower():find(v:lower()) then 
                string = #string > 0 and string.." "..word or word 
            end 
        end 
        return string 
    end 
end 
outputChatBox(Name("o")) 

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...