ryan112 Posted January 5, 2018 Share Posted January 5, 2018 سلام عليكم شباب اريد اضيف كود ميوت عشات local و Global لما لاعب ياخد ميوت مايقدر يتكلم فيهم function globalMessage(thePlayer, cmd, ...) local message = table.concat ( { ... }, " " ) local name = getPlayerName(thePlayer) outputChatBox("#FF66FF(Global) #FFFFFF"..name..": #FFFFFF"..message, getRootElement(), 255, 255, 255, true) end addCommandHandler("global", globalMessage) ----Local Chat chat_range=100 addEventHandler("onPlayerJoin",getRootElement(), function () bindKey(source,"t","down","chatbox","local") end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do bindKey(player,"t","down","chatbox","local") end end) function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range end function onChat(player,_,...) local px,py,pz=getElementPosition(player) local msg = table.concat({...}, " ") local nick=getPlayerName(player) local r,g,b = getTeamColor(getPlayerTeam(player)) for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox("#FF99FF(Local) #FFFFFF"..nick..": "..msg,v,r,g,b,true) end end end addCommandHandler("local",onChat) ----Unbind The Default Chat addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() unbindKey("t") end ) هي مود شات local و Global بس اريد تضيف كود ميوت لهم وشكرا Link to comment
Master_MTA Posted January 5, 2018 Share Posted January 5, 2018 function globalMessage(thePlayer, cmd, ...) if isPlayerMuted(thePlayer) then outputChatBox('#ff0000 * you are muted',thePlayer,255,255,255,true) return end local message = table.concat ( { ... }, " " ) local name = getPlayerName(thePlayer) outputChatBox("#FF66FF(Global) #FFFFFF"..name..": #FFFFFF"..message, getRootElement(), 255, 255, 255, true) end addCommandHandler("global", globalMessage) ----Local Chat chat_range=100 addEventHandler("onPlayerJoin",getRootElement(), function () bindKey(source,"t","down","chatbox","local") end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do bindKey(player,"t","down","chatbox","local") end end) function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range end function onChat(player,_,...) if isPlayerMuted(player) then outputChatBox('#ff0000 * you are muted',player,255,255,255,true) return end local px,py,pz=getElementPosition(player) local msg = table.concat({...}, " ") local nick=getPlayerName(player) local r,g,b = getTeamColor(getPlayerTeam(player)) for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox("#FF99FF(Local) #FFFFFF"..nick..": "..msg,v,r,g,b,true) end end end addCommandHandler("local",onChat) ----Unbind The Default Chat addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() unbindKey("t") end ) 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