K4stic Posted January 26, 2013 Posted January 26, 2013 How make then player muted to can't chat in Local and them not muted to can chat in local i know only who the EventHandler is "onPlayerChat" chat_range = 100 addEventHandler("onPlayerJoin",getRootElement(), function () bindKey(source,"u","down","chatbox","localchat") end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do bindKey(player,"u","down","chatbox","localchat") 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("(Local) "..nick..":#FFFFFF "..msg,v,r,g,b,true) end triggerEvent ( "onLocalChatMessage", v, player, msg ) end end addCommandHandler("localchat",onChat) Giving a Fuck? Nope, That isn't in My Skill Set
Castillo Posted January 26, 2013 Posted January 26, 2013 When they try to send a message, check if they are muted with: isPlayerMuted San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
K4stic Posted January 26, 2013 Author Posted January 26, 2013 like this? chat_range = 100 addEventHandler("onPlayerJoin",getRootElement(), function () bindKey(source,"u","down","chatbox","localchat") end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do bindKey(player,"u","down","chatbox","localchat") 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("(Local) "..nick..":#FFFFFF "..msg,v,r,g,b,true) else if isPlayerMuted ( player ) then cancelEvent() end triggerEvent ( "onLocalChatMessage", v, player, msg ) end end addCommandHandler("localchat",onChat) Giving a Fuck? Nope, That isn't in My Skill Set
Castillo Posted January 26, 2013 Posted January 26, 2013 Not really what I meant, no. chat_range = 100 addEventHandler("onPlayerJoin",getRootElement(), function () bindKey(source,"u","down","chatbox","localchat") end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do bindKey(player,"u","down","chatbox","localchat") 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)) if ( isPlayerMuted ( player ) ) then return end for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox("(Local) "..nick..":#FFFFFF "..msg,v,r,g,b,true) end triggerEvent ( "onLocalChatMessage", v, player, msg ) end end addCommandHandler("localchat",onChat) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
K4stic Posted January 26, 2013 Author Posted January 26, 2013 Works good thaks you are Best Giving a Fuck? Nope, That isn't in My Skill Set
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