Tarek1 Posted January 26, 2018 Share Posted January 26, 2018 --Error attempt to concatenate global 'ctr' ( a bollean value ) outputChatBox("("..ctr..") "..string.gsub(getPlayerName(thePlayer), "#%x%x%x%x%x%x", "")..": #FFFFFF"..table.concat({...}, " "), v, r, g, b, true) Link to comment
#SycroX Posted January 26, 2018 Share Posted January 26, 2018 8 hours ago, Tarek1 said: --Error attempt to concatenate global 'ctr' ( a bollean value ) outputChatBox("("..ctr..") "..string.gsub(getPlayerName(thePlayer), "#%x%x%x%x%x%x", "")..": #FFFFFF"..table.concat({...}, " "), v, r, g, b, true) true or false او قيمته تساوي ctr مو معرف تاكد من الكود كويس او اطرح الكود عشان نقدر نساعدك Link to comment
Tarek1 Posted January 26, 2018 Author Share Posted January 26, 2018 7 hours ago, #SycroX said: true or false او قيمته تساوي ctr مو معرف تاكد من الكود كويس او اطرح الكود عشان نقدر نساعدك addCommandHandler("LangChat", function (thePlayer, cn, ...) if isPlayerMuted(thePlayer) or isGuestAccount(getPlayerAccount(thePlayer)) then return end if isTimer(spam[thePlayer]) then exports.URGMessages:sendClientMessage("Anti-spam: please refrain from spamming the chats!",thePlayer, 255, 0, 0) return end if plang[getElementData(thePlayer, "Country")] then ctr = plang[getElementData(thePlayer, "Country")] isclg = true else ctr = getElementData(thePlayer, "Country") isclg = false end r, g, b = getTeamColor(getPlayerTeam(thePlayer)) spam[thePlayer] = setTimer(function () end, 1000, 1) for k, v in ipairs(getElementsByType("player")) do --- getElementData(v, "nonEnglishChat")) if(ifnot(isclg, plang[getElementData(v, "Country")], getElementData(v, "Country")) == ctr ) then outputChatBox("("..ctr..") "..string.gsub(getPlayerName(thePlayer), "#%x%x%x%x%x%x", "")..": #FFFFFF"..table.concat({...}, " "), v, r, g, b, true) end end outputServerLog("LANGCHAT: ("..ctr..") "..getPlayerName(thePlayer)..": "..table.concat({...}, " ")) logThis("Lang Chat", "("..ctr..") "..getPlayerName(thePlayer)..": "..table.concat({...}, " ")) end) function ifnot(a, b, c) if a then return b else return c end end plang = { ["Portugal"] = "Portuguese", ["Brazil"] = "Portuguese", ["Slovenia"] = "Ex-Yu", ["Serbia"] = "Ex-Yu", ["Croatia"] = "Ex-Yu", ["Macedonia"] = "Ex-Yu", } addEventHandler("onPlayerJoin", getRootElement(), function () bindKey(source, "5", "down", "chatbox", "LangChat") dap = source fetchRemote("http://162.250.144.215/json/"..getPlayerIP(dap), countryCheck, "", false, dap) end) function countryCheck(resp, erno, dap) if resp ~= "ERROR" then if(fromJSON(resp)["query"] == "127.0.0.1") then pip = "Portugal" else pip = fromJSON(resp)["country"] end setElementData(dap, "Country", pip) setElementData(dap, "CC", string.lower(fromJSON(resp)["countryCode"] or "zz")) if fileExists(":admin/client/images/flags/"..getElementData(dap, "CC")..".png") then path = ":admin/client/images/flags/"..getElementData(dap, "CC")..".png" else path = ":admin/client/images/flags/zz.png" end setElementData(dap,"Pic",path) end end 7 hours ago, #SycroX said: true or false او قيمته تساوي ctr مو معرف تاكد من الكود كويس او اطرح الكود عشان نقدر نساعدك addCommandHandler("LangChat", function (thePlayer, cn, ...) if isPlayerMuted(thePlayer) or isGuestAccount(getPlayerAccount(thePlayer)) then return end if isTimer(spam[thePlayer]) then exports.URGMessages:sendClientMessage("Anti-spam: please refrain from spamming the chats!",thePlayer, 255, 0, 0) return end if plang[getElementData(thePlayer, "Country")] then ctr = plang[getElementData(thePlayer, "Country")] isclg = true else ctr = getElementData(thePlayer, "Country") isclg = false end r, g, b = getTeamColor(getPlayerTeam(thePlayer)) spam[thePlayer] = setTimer(function () end, 1000, 1) for k, v in ipairs(getElementsByType("player")) do --- getElementData(v, "nonEnglishChat")) if(ifnot(isclg, plang[getElementData(v, "Country")], getElementData(v, "Country")) == ctr ) then outputChatBox("("..ctr..") "..string.gsub(getPlayerName(thePlayer), "#%x%x%x%x%x%x", "")..": #FFFFFF"..table.concat({...}, " "), v, r, g, b, true) end end outputServerLog("LANGCHAT: ("..ctr..") "..getPlayerName(thePlayer)..": "..table.concat({...}, " ")) logThis("Lang Chat", "("..ctr..") "..getPlayerName(thePlayer)..": "..table.concat({...}, " ")) end) function ifnot(a, b, c) if a then return b else return c end end plang = { ["Portugal"] = "Portuguese", ["Brazil"] = "Portuguese", ["Slovenia"] = "Ex-Yu", ["Serbia"] = "Ex-Yu", ["Croatia"] = "Ex-Yu", ["Macedonia"] = "Ex-Yu", } addEventHandler("onPlayerJoin", getRootElement(), function () bindKey(source, "5", "down", "chatbox", "LangChat") dap = source fetchRemote("http://162.250.144.215/json/"..getPlayerIP(dap), countryCheck, "", false, dap) end) function countryCheck(resp, erno, dap) if resp ~= "ERROR" then if(fromJSON(resp)["query"] == "127.0.0.1") then pip = "Portugal" else pip = fromJSON(resp)["country"] end setElementData(dap, "Country", pip) setElementData(dap, "CC", string.lower(fromJSON(resp)["countryCode"] or "zz")) if fileExists(":admin/client/images/flags/"..getElementData(dap, "CC")..".png") then path = ":admin/client/images/flags/"..getElementData(dap, "CC")..".png" else path = ":admin/client/images/flags/zz.png" end setElementData(dap,"Pic",path) end end Link to comment
^iiEcoo'x_) Posted January 26, 2018 Share Posted January 26, 2018 اظن انه tabel.concat ما تقبل قيم true , false , ..... Link to comment
Tarek1 Posted January 26, 2018 Author Share Posted January 26, 2018 39 minutes ago, DABL said: اظن انه tabel.concat ما تقبل قيم true , false , ..... al error line 15 (True) Link to comment
#SycroX Posted January 27, 2018 Share Posted January 27, 2018 16 hours ago, Tarek1 said: al error line 15 (True) addCommandHandler("LangChat", function(player,_, ...) if not isGuestAccount(getPlayerAccount(player)) then if not isPlayerMuted(player) then if not isTimer(spam[player]) then local ctr if plang[getElementData(player, "Country")] then ctr = plang[getElementData(player, "Country")] isclg = true else ctr = getElementData(player, "Country") isclg = false end local r, g, b = getTeamColor(getPlayerTeam(player)) spam[player] = setTimer(function() end, 1000, 1) for _,v in ipairs(getElementsByType("player")) do if ifnot(isclg, plang[getElementData(v, "Country")], getElementData(v, "Country")) == ctr then outputChatBox("("..ctr..") "..string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "")..": #FFFFFF"..table.concat({...}, " "), v, r, g, b, true) end end outputServerLog("LANGCHAT: ("..ctr..") "..getPlayerName(player)..": "..table.concat({...}, " ")) logThis("Lang Chat", "("..ctr..") "..getPlayerName(player)..": "..table.concat({...}, " ")) else exports.URGMessages:sendClientMessage("Anti-spam: please refrain from spamming the chats!",player, 255, 0, 0) end else exports.URGMessages:sendClientMessage("you'r muted!",player, 255, 0, 0) end else exports.URGMessages:sendClientMessage("please log in first",player, 255, 0, 0) end end ) Link to comment
Tarek1 Posted January 27, 2018 Author Share Posted January 27, 2018 4 hours ago, #SycroX said: addCommandHandler("LangChat", function(player,_, ...) if not isGuestAccount(getPlayerAccount(player)) then if not isPlayerMuted(player) then if not isTimer(spam[player]) then local ctr if plang[getElementData(player, "Country")] then ctr = plang[getElementData(player, "Country")] isclg = true else ctr = getElementData(player, "Country") isclg = false end local r, g, b = getTeamColor(getPlayerTeam(player)) spam[player] = setTimer(function() end, 1000, 1) for _,v in ipairs(getElementsByType("player")) do if ifnot(isclg, plang[getElementData(v, "Country")], getElementData(v, "Country")) == ctr then outputChatBox("("..ctr..") "..string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "")..": #FFFFFF"..table.concat({...}, " "), v, r, g, b, true) end end outputServerLog("LANGCHAT: ("..ctr..") "..getPlayerName(player)..": "..table.concat({...}, " ")) logThis("Lang Chat", "("..ctr..") "..getPlayerName(player)..": "..table.concat({...}, " ")) else exports.URGMessages:sendClientMessage("Anti-spam: please refrain from spamming the chats!",player, 255, 0, 0) end else exports.URGMessages:sendClientMessage("you'r muted!",player, 255, 0, 0) end else exports.URGMessages:sendClientMessage("please log in first",player, 255, 0, 0) end end ) Error : Line 7:attempt to index global 'plang' ( anil value) Link to comment
#SycroX Posted January 28, 2018 Share Posted January 28, 2018 16 hours ago, Tarek1 said: Error : Line 7:attempt to index global 'plang' ( anil value) اطرح سطر 7 Link to comment
Tarek1 Posted January 28, 2018 Author Share Posted January 28, 2018 1 hour ago, #SycroX said: اطرح سطر 7 if plang[getElementData(player, "Country")] then Link to comment
#SycroX Posted January 28, 2018 Share Posted January 28, 2018 اطرح ملف سيرفر كامل طيب Link to comment
Tarek1 Posted January 28, 2018 Author Share Posted January 28, 2018 25 minutes ago, #SycroX said: اطرح ملف سيرفر كامل طيب al sevrer side ملهوش لازمه Binds bs Link to comment
#SycroX Posted January 28, 2018 Share Posted January 28, 2018 Just now, Tarek1 said: al sevrer side ملهوش لازمه Binds bs plang = { ["Portugal"] = "Portuguese", ["Brazil"] = "Portuguese", ["Slovenia"] = "Ex-Yu", ["Serbia"] = "Ex-Yu", ["Croatia"] = "Ex-Yu", ["Macedonia"] = "Ex-Yu", } function ifnot(a, b, c) if a then return b else return c end end addCommandHandler("LangChat", function(player,_, ...) if not isGuestAccount(getPlayerAccount(player)) then if not isPlayerMuted(player) then if not isTimer(spam[player]) then local ctr local country = getElementData(player, "Country") if plang[country] then ctr = plang[country] isclg = true else ctr = country isclg = false end local r, g, b = getTeamColor(getPlayerTeam(player)) spam[player] = setTimer(function() end, 1000, 1) for _,v in ipairs(getElementsByType("player")) do if ifnot(isclg, plang[getElementData(v, "Country")], getElementData(v, "Country")) == ctr then outputChatBox("("..ctr..") "..string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "")..": #FFFFFF"..table.concat({...}, " "), v, r, g, b, true) end end outputServerLog("LANGCHAT: ("..ctr..") "..getPlayerName(player)..": "..table.concat({...}, " ")) logThis("Lang Chat", "("..ctr..") "..getPlayerName(player)..": "..table.concat({...}, " ")) else exports.URGMessages:sendClientMessage("Anti-spam: please refrain from spamming the chats!",player, 255, 0, 0) end else exports.URGMessages:sendClientMessage("you'r muted!",player, 255, 0, 0) end else exports.URGMessages:sendClientMessage("please log in first",player, 255, 0, 0) end end ) addEventHandler("onPlayerJoin", root, function() bindKey(source, "5", "down", "chatbox", "LangChat") dap = source fetchRemote("http://162.250.144.215/json/"..getPlayerIP(source), countryCheck, "", false, source) end ) function countryCheck(resp, erno, player) if resp ~= "ERROR" then if fromJSON(resp)["query"] == "127.0.0.1" then pip = "Portugal" else pip = fromJSON(resp)["country"] end setElementData(player, "Country", pip) setElementData(player, "CC", string.lower(fromJSON(resp)["countryCode"] or "zz")) if fileExists(":admin/client/images/flags/"..getElementData(player, "CC")..".png") then path = ":admin/client/images/flags/"..getElementData(player, "CC")..".png" else path = ":admin/client/images/flags/zz.png" end setElementData(player,"Pic",path) end end جرب Link to comment
Tarek1 Posted January 29, 2018 Author Share Posted January 29, 2018 (edited) 23 hours ago, #SycroX said: plang = { ["Portugal"] = "Portuguese", ["Brazil"] = "Portuguese", ["Slovenia"] = "Ex-Yu", ["Serbia"] = "Ex-Yu", ["Croatia"] = "Ex-Yu", ["Macedonia"] = "Ex-Yu", } function ifnot(a, b, c) if a then return b else return c end end addCommandHandler("LangChat", function(player,_, ...) if not isGuestAccount(getPlayerAccount(player)) then if not isPlayerMuted(player) then if not isTimer(spam[player]) then local ctr local country = getElementData(player, "Country") if plang[country] then ctr = plang[country] isclg = true else ctr = country isclg = false end local r, g, b = getTeamColor(getPlayerTeam(player)) spam[player] = setTimer(function() end, 1000, 1) for _,v in ipairs(getElementsByType("player")) do if ifnot(isclg, plang[getElementData(v, "Country")], getElementData(v, "Country")) == ctr then outputChatBox("("..ctr..") "..string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "")..": #FFFFFF"..table.concat({...}, " "), v, r, g, b, true) end end outputServerLog("LANGCHAT: ("..ctr..") "..getPlayerName(player)..": "..table.concat({...}, " ")) logThis("Lang Chat", "("..ctr..") "..getPlayerName(player)..": "..table.concat({...}, " ")) else exports.URGMessages:sendClientMessage("Anti-spam: please refrain from spamming the chats!",player, 255, 0, 0) end else exports.URGMessages:sendClientMessage("you'r muted!",player, 255, 0, 0) end else exports.URGMessages:sendClientMessage("please log in first",player, 255, 0, 0) end end ) addEventHandler("onPlayerJoin", root, function() bindKey(source, "5", "down", "chatbox", "LangChat") dap = source fetchRemote("http://162.250.144.215/json/"..getPlayerIP(source), countryCheck, "", false, source) end ) function countryCheck(resp, erno, player) if resp ~= "ERROR" then if fromJSON(resp)["query"] == "127.0.0.1" then pip = "Portugal" else pip = fromJSON(resp)["country"] end setElementData(player, "Country", pip) setElementData(player, "CC", string.lower(fromJSON(resp)["countryCode"] or "zz")) if fileExists(":admin/client/images/flags/"..getElementData(player, "CC")..".png") then path = ":admin/client/images/flags/"..getElementData(player, "CC")..".png" else path = ":admin/client/images/flags/zz.png" end setElementData(player,"Pic",path) end end جرب نفس المشكله المشكله هنا :outputChatBox("("..ctr..") "..string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "")..": #FFFFFF"..table.concat({...}, " "), v, r, g, b, true) Edited January 29, 2018 by Tarek1 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