Jump to content

استفسار


Recommended Posts

السلام عليكم انا لساتني سيئ بالبرمجة بس عندي سؤال هاذا وش

chatTime = {} 
lastChatMessage = {} 
addEventHandler("onPlayerChat", getRootElement(), 
    function(text, msgtype) 
    local result = SQLS3D.qury("SELECT * FROM Tags_System") 
    if ( type ( result ) == "table" and #result == 0 or not result ) then return end 
    local account = getAccountName(getPlayerAccount(source)) 
    local name = getPlayerName(source) 
        local new = "" 
        local iter = 0 
        msg = string.gsub(text,"ـ","") 
        for word in msg:gmatch("%S+") do 
            iter = iter + 1 
            for i,swr in ipairs(words) do 
                local src = word:lower():gsub("%s","") 
                local src = src:gsub("#%x%x%x%x%x%x","") 
                local src = src:gsub("%c","") 
                local src = src:gsub("%p","") 
                local pat = swr:lower():gsub("%s","") 
                if src:find(pat) then 
                    local replaceString = "" 
                    for x=1,word:gsub("#%x%x%x%x%x%x",""):len() do 
                        replaceString = replaceString.."*" 
                    end 
                    word = word:gsub(word,replaceString) 
                end 
            end 
            if iter == 1 and word:len() > 2 then 
                word = word:gsub("%a",string.upper,1) 
            end 
            new = new..word.." " 
        end 
        if new ~= "" then msg = new end 
        text = msg 
        if chatTime[source] and chatTime[source] + tonumber(1000) > getTickCount() then 
            cancelEvent() 
            outputChatBox("Stop spamming main chat!", source, 255, 0, 0) 
            return 
        else 
                chatTime[source] = getTickCount() 
        end 
        if lastChatMessage[source] and lastChatMessage[source] == text then cancelEvent() return outputChatBox("Stop repeating yourself!", source, 255, 0, 0) end 
        lastChatMessage[source] = text 
        local r, g, b = getPlayerNametagColor(source) 
        cancelEvent() 
        for k, v in ipairs(Tag) do 
            if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup(v["tag"])) then 
                    cancelEvent() 
                    outputChatBox('#'..v["color1"]..' ' ..v["name"]..' '.. getPlayerName ( source ) .. ' : #'..v["color2"]..''..text..'', getRootElement(), r, g, b, true ) 
                break 
            end 
        end 
    end 
) 

طبعا هاذا الكود جايبه من مود تاج لسعد

Link to comment

ما انتبهت للرد

string.gsub

تستبدل شي بشي اخر .. طبعا بالسترنق

يعني مثلأ

local text_ = "Hello ZA7F" 
  
function gText (  ) 
      return string.gsub ( text_, "ZA7F", "World" ) 
end 

بالنسبة للاشارات هذي فـ يقصد بها كود اللون اللي يكون موجود بالاسم حق اللاعب يشيله .

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