BorderLine Posted April 18, 2012 Posted April 18, 2012 Hi everyone. Well to make less flood in my server, i make this local chatRadius = 50 function sendMessageToNearbyPlayers( message, messageType ) if messageType == 0 then local posX, posY, posZ = getElementPosition( source ) local chatSphere = createColSphere( posX, posY, posZ, chatRadius ) local nearbyPlayers = getElementsWithinColShape( chatSphere, "player" ) destroyElement( chatSphere ) for index, nearbyPlayer in ipairs( nearbyPlayers ) do local red, green, blue = getPlayerNametagColor(source) outputChatBox( getPlayerName(source)..": #ffffff"..message, nearbyPlayer, red, green, blue, true ) end end end addEventHandler( "onPlayerChat", getRootElement(), sendMessageToNearbyPlayers ) function blockChatMessage() cancelEvent() end addEventHandler( "onPlayerChat", getRootElement(), blockChatMessage ) But the teamchat was removed. If i speak with "Y" dont show message How i can put back again? im searched in forum and i readed the wiki but i dont know how do. If someone can helpme thanks for your time Actual Nick: [XGN]BorderLine Actual Clan: XLatino Actual Status: Staff, Mod Level 1 (BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline
Castillo Posted April 18, 2012 Posted April 18, 2012 Your problem is the "blockChatMessage" function, it'll cancel all chat messages, no matters if is not a team message, you have to use cancelEvent on "sendMessageToNearbyPlayers" function. local chatRadius = 50 function sendMessageToNearbyPlayers ( message, messageType ) if ( messageType == 0 ) then local posX, posY, posZ = getElementPosition ( source ) local chatSphere = createColSphere ( posX, posY, posZ, chatRadius ) local nearbyPlayers = getElementsWithinColShape ( chatSphere, "player" ) destroyElement ( chatSphere ) for index, nearbyPlayer in ipairs( nearbyPlayers ) do local red, green, blue = getPlayerNametagColor ( source ) outputChatBox( getPlayerName ( source )..": #ffffff".. message, nearbyPlayer, red, green, blue, true ) end cancelEvent ( ) end end addEventHandler ( "onPlayerChat", getRootElement(), sendMessageToNearbyPlayers ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
BorderLine Posted April 18, 2012 Author Posted April 18, 2012 Working.. Thanks man Actual Nick: [XGN]BorderLine Actual Clan: XLatino Actual Status: Staff, Mod Level 1 (BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline
Castillo Posted April 18, 2012 Posted April 18, 2012 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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