Rat32 Posted March 14, 2015 Posted March 14, 2015 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 ) addEventHandler ( "onPlayerChat", getRootElement(), function ( message, messageType ) if messageType == 1 then cancelEvent() end end) Why this doesn't work? Sends a double message, does not close the event.
3B00DG4MER Posted March 14, 2015 Posted March 14, 2015 Daf***k it's not your Problem, then why you post it ?!
xXMADEXx Posted March 14, 2015 Posted March 14, 2015 There is probably another script that cancels and sends a message onPlayerChat.
Et-win Posted March 14, 2015 Posted March 14, 2015 Daf***kit's not your Problem, then why you post it ?! Why this doesn't work? Sends a double message, does not close the event.
3B00DG4MER Posted March 14, 2015 Posted March 14, 2015 He didn't wrote that at first time * He edited it and colshape for that i think gives lagg, why don't u use math better than creating colshapes get distance then check if distance is lower then 15 or something then cancel event and output again
Moderators IIYAMA Posted March 15, 2015 Moderators Posted March 15, 2015 It is probably sending double messages because you are using the freeroam resource, which is also using this event. Or some other resource.
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