The moVer Posted March 22, 2015 Share Posted March 22, 2015 السلام عليكم انا لساتني سيئ بالبرمجة بس عندي سؤال هاذا وش 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
The moVer Posted March 22, 2015 Author Share Posted March 22, 2015 انا قصدي عن ذي الاشارات %%%% والكلمات الغريبة string.gsub Link to comment
justboy Posted March 23, 2015 Share Posted March 23, 2015 هذا يششيل اكواد الالوان اعتقد Link to comment
ALw7sH Posted March 23, 2015 Share Posted March 23, 2015 مثل ماقال بندول من الاسم Hex يحذف اكواد ال Link to comment
Tete omar Posted March 23, 2015 Share Posted March 23, 2015 ..الأسئلة المتعلقة بالبرمجة في قسم البرمجة وليس في قسم الدروس viewforum.php?f=160 ينقل إلى قسم البرمجة Link to comment
#DRAGON!FIRE Posted March 23, 2015 Share Posted March 23, 2015 اتمنى تحدد الشي لانه الكود 54 سطر قول الشي اللي تبي تسال عنه فنكشن ولا سطر . Link to comment
yazan Posted March 23, 2015 Share Posted March 23, 2015 انا قصدي عن ذي الاشارات %%%% والكلمات الغريبة string.gsub Link to comment
#DRAGON!FIRE Posted March 23, 2015 Share Posted March 23, 2015 ما انتبهت للرد string.gsub تستبدل شي بشي اخر .. طبعا بالسترنق يعني مثلأ local text_ = "Hello ZA7F" function gText ( ) return string.gsub ( text_, "ZA7F", "World" ) end بالنسبة للاشارات هذي فـ يقصد بها كود اللون اللي يكون موجود بالاسم حق اللاعب يشيله . Link to comment
The moVer Posted March 24, 2015 Author Share Posted March 24, 2015 شكرا شباب ما قصرتو الله يعطيكم العافية Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now