sckatchof Posted February 10, 2012 Share Posted February 10, 2012 hello guys , I have a problem when i leave the area i have a spam like this pic this is my script : local posX, posY, posZ = 269.70001220703, -1895.0999755859, 0.69999998807907 local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) local radioURL = "http://www.181.fm/winamp.pls?station=181-power&style=mp3" local radius = 150 local volume = 4.0 local thisRoot = getResourceRootElement(getThisResource()) local root = getRootElement() local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) addEventHandler("onClientResourceStart", thisRoot, function() local radio = playSound3D(radioURL, posX, posY, posZ, false) setSoundVolume(radio, volume) setSoundMaxDistance(radio, radius) end) addEventHandler("onClientResourceStop", thisRoot, function() destroyElement(colShape) end) addEventHandler("onColShapeLeave", getRootElement(), function(leaveElement, matchingDimension) if getElementType(leaveElement) == "player" then outputChatBox("#FFFF00RADIO: #FFFFFFStream stopped.", leaveElement, 255, 255, 255, true) end end) Link to comment
unknooooown Posted February 10, 2012 Share Posted February 10, 2012 Please define "spam". Does it write it multiple times or just ONCE when you leave the area/colshape? Link to comment
sckatchof Posted February 10, 2012 Author Share Posted February 10, 2012 Please define "spam". Does it write it multiple times or just ONCE when you leave the area/colshape? when i leave the area this text spam like this Radio :Stream Stopped Radio :Stream Stopped Radio :Stream Stopped Radio :Stream Stopped Radio :Stream Stopped I want When I leave the region does not show anything and thnx for help Link to comment
drk Posted February 10, 2012 Share Posted February 10, 2012 Doesn't show anything? LOL Only remove onColShapeLeave event. Link to comment
sckatchof Posted February 10, 2012 Author Share Posted February 10, 2012 Doesn't show anything? LOL Only remove onColShapeLeave event. thnx for help but some problem local posX, posY, posZ = 269.70001220703, -1895.0999755859, 0.69999998807907 local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) local radioURL = "http://www.181.fm/winamp.pls?station=181-power&style=mp3" local radius = 150 local volume = 4.0 local thisRoot = getResourceRootElement(getThisResource()) local root = getRootElement() local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) addEventHandler("onClientResourceStart", thisRoot, function() local radio = playSound3D(radioURL, posX, posY, posZ, false) setSoundVolume(radio, volume) setSoundMaxDistance(radio, radius) end) addEventHandler("onColShapeLeave", getRootElement(), function(leaveElement, matchingDimension) if getElementType(leaveElement) == "player" then outputChatBox("#FFFF00RADIO: #FFFFFFStream stopped.", leaveElement, 255, 255, 255, true) end end) Link to comment
drk Posted February 10, 2012 Share Posted February 10, 2012 LOL Only remove onColShapeLeave event. What you don't understand in this lol addEventHandler('onColShapeLeave',root, function(player,dimension) if source == RadioColshape then if getElementType(player) == 'player' then outputChatBox('#ffff00RADIO: #ffffffStream stopped.', player, 255,255,255,true) end end end) Link to comment
sckatchof Posted February 10, 2012 Author Share Posted February 10, 2012 LOL Only remove onColShapeLeave event. What you don't understand in this lol addEventHandler('onColShapeLeave',root, function(player,dimension) if source == RadioColshape then if getElementType(player) == 'player' then outputChatBox('#ffff00RADIO: #ffffffStream stopped.', player, 255,255,255,true) end end end) I understand you but some problem if u want test it and thnx again you mean like this local posX, posY, posZ = 269.70001220703, -1895.0999755859, 0.69999998807907 local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) local radioURL = "http://www.181.fm/winamp.pls?station=181-power&style=mp3" local radius = 150 local volume = 4.0 local thisRoot = getResourceRootElement(getThisResource()) local root = getRootElement() local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) addEventHandler("onClientResourceStart", thisRoot, function() local radio = playSound3D(radioURL, posX, posY, posZ, false) setSoundVolume(radio, volume) setSoundMaxDistance(radio, radius) end) addEventHandler("onClientResourceStop", thisRoot, function() destroyElement(colShape) end) Link to comment
drk Posted February 10, 2012 Share Posted February 10, 2012 You get any error? You tried this? addEventHandler('onColShapeLeave',root, function(player,dimension) if source == RadioColshape then if getElementType(player) == 'player' then outputChatBox('#ffff00RADIO: #ffffffStream stopped.', player, 255,255,255,true) end end end) Link to comment
sckatchof Posted February 10, 2012 Author Share Posted February 10, 2012 You get any error?You tried this? addEventHandler('onColShapeLeave',root, function(player,dimension) if source == RadioColshape then if getElementType(player) == 'player' then outputChatBox('#ffff00RADIO: #ffffffStream stopped.', player, 255,255,255,true) end end end) any error and some problem . Link to comment
drk Posted February 10, 2012 Share Posted February 10, 2012 function onLeave(player) if getElementType(player) == 'player' then outputChatBox('#ffff00RADIO: #ffffffStream stopped.', player, 255, 255, 255, true) end end addEventHandler('onColShapeLeave',RadioColshape,onLeave) If it don't solve, I can't help you. Link to comment
sckatchof Posted February 10, 2012 Author Share Posted February 10, 2012 function onLeave(player) if getElementType(player) == 'player' then outputChatBox('#ffff00RADIO: #ffffffStream stopped.', player, 255, 255, 255, true) end end addEventHandler('onColShapeLeave',RadioColshape,onLeave) If it don't solve, I can't help you. some problem , but thnx for ur help Link to comment
drk Posted February 10, 2012 Share Posted February 10, 2012 Why you don't try to set a timer to outputChatBox with 800ms delay message = { '#ffff00RADIO: #ffffffStream stopped' } addEventHandler('onColShapeLeave',root, function(tplayer) if source == RadioColshape then if getElementType(tplayer) == 'player' then local msg = math.random(1,#message) setTimer(outputChatBox, 800, 1, msg, tplayer, 255, 255, 255, true) end end end) I not tested it, I think setTimer arguments is invalid but try Link to comment
sckatchof Posted February 10, 2012 Author Share Posted February 10, 2012 Why you don't try to set a timer to outputChatBox with 800ms delay message = { '#ffff00RADIO: #ffffffStream stopped' } addEventHandler('onColShapeLeave',root, function(tplayer) if source == RadioColshape then if getElementType(tplayer) == 'player' then local msg = math.random(1,#message) setTimer(outputChatBox, 800, 1, msg, tplayer, 255, 255, 255, true) end end end) I not tested it, I think setTimer arguments is invalid but try Thanxx for help but some problem Link to comment
drk Posted February 10, 2012 Share Posted February 10, 2012 lol, I will search about this. Edit: I can't help you. Please wait for a more experienced scripter help you Link to comment
Castillo Posted February 10, 2012 Share Posted February 10, 2012 That script is client side, and you're using a server side event. local posX, posY, posZ = 269.70001220703, -1895.0999755859, 0.69999998807907 local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) local radioURL = "http://www.181.fm/winamp.pls?station=181-power&style=mp3" local radius = 150 local volume = 4.0 addEventHandler("onClientResourceStart",resourceRoot, function() local radio = playSound3D(radioURL, posX, posY, posZ, false) setSoundVolume(radio, volume) setSoundMaxDistance(radio, radius) end ) message = { "#ffff00RADIO: #ffffffStream stopped" } addEventHandler("onClientColShapeLeave",RadioColshape, function(tplayer) if (getElementType(tplayer) == "player" and tplayer == localPlayer) then local msg = math.random(#message) setTimer(outputChatBox, 800, 1, msg, tplayer, 255, 255, 255, true) end end ) Link to comment
Kenix Posted February 10, 2012 Share Posted February 10, 2012 local message = { "#ffff00RADIO: #ffffffStream stopped" } local posX, posY, posZ = 269.70001220703, -1895.0999755859, 0.69999998807907 local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) local radioURL = "http://www.181.fm/winamp.pls?station=181-power&style=mp3" local radius = 150 local volume = 4.0 local radio = playSound3D( radioURL, posX, posY, posZ, false ) setSoundVolume( radio, volume) setSoundMaxDistance( radio, radius ) addEventHandler( "onClientColShapeLeave",RadioColshape, function( tplayer ) if getElementType( tplayer ) == "player" and tplayer == localPlayer then setTimer( outputChatBox, 800, 1, math.random( #message ), 255, 255, 255, true ) end end ) Link to comment
sckatchof Posted February 11, 2012 Author Share Posted February 11, 2012 thanx guys for help but i have some problem when i leave the area again : this is my client side : local posX, posY, posZ = 269.70001220703, -1895.0999755859, 0.69999998807907 local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) local radioURL = "http://www.181.fm/winamp.pls?station=181-power&style=mp3" local radius = 150 local volume = 4.0 addEventHandler("onClientResourceStart",resourceRoot, function() local radio = playSound3D(radioURL, posX, posY, posZ, false) setSoundVolume(radio, volume) setSoundMaxDistance(radio, radius) end ) message = { "#ffff00RADIO: #ffffffStream stopped" } addEventHandler("onClientColShapeLeave",RadioColshape, function(tplayer) if (getElementType(tplayer) == "player" and tplayer == localPlayer) then local msg = math.random(#message) setTimer(outputChatBox, 800, 1, msg, tplayer, 255, 255, 255, true) end end ) and this is mta.xml Link to comment
Kenix Posted February 11, 2012 Share Posted February 11, 2012 If you leave colshape then it output. Link to comment
sckatchof Posted February 11, 2012 Author Share Posted February 11, 2012 If you leave colshape then it output. Yes when i leave it show like this picture. Link to comment
Evil-Cod3r Posted February 11, 2012 Share Posted February 11, 2012 lol he want the msg output 1 time only not spaming in the chat Link to comment
Kenix Posted February 11, 2012 Share Posted February 11, 2012 local message = { "#ffff00RADIO: #ffffffStream stopped" } local posX, posY, posZ = 269.70001220703, -1895.0999755859, 0.69999998807907 local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) local radioURL = "http://www.181.fm/winamp.pls?station=181-power&style=mp3" local radius = 150 local volume = 4.0 local bSpam local radio = playSound3D( radioURL, posX, posY, posZ, false ) setSoundVolume( radio, volume) setSoundMaxDistance( radio, radius ) addEventHandler( "onClientColShapeLeave",RadioColshape, function( tplayer ) if getElementType( tplayer ) == "player" and tplayer == localPlayer then if not bSpam then setTimer( outputChatBox, 800, 1, math.random( #message ), 255, 255, 255, true ) bSpam = true setTimer( function( ) bSpam = false end, 50000, 1 ) end end end ) Link to comment
sckatchof Posted February 11, 2012 Author Share Posted February 11, 2012 local message = { "#ffff00RADIO: #ffffffStream stopped" } local posX, posY, posZ = 269.70001220703, -1895.0999755859, 0.69999998807907 local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) local radioURL = "http://www.181.fm/winamp.pls?station=181-power&style=mp3" local radius = 150 local volume = 4.0 local bSpam local radio = playSound3D( radioURL, posX, posY, posZ, false ) setSoundVolume( radio, volume) setSoundMaxDistance( radio, radius ) addEventHandler( "onClientColShapeLeave",RadioColshape, function( tplayer ) if getElementType( tplayer ) == "player" and tplayer == localPlayer then if not bSpam then setTimer( outputChatBox, 800, 1, math.random( #message ), 255, 255, 255, true ) bSpam = true setTimer( function( ) bSpam = false end, 50000, 1 ) end end end ) thank guys and kenix for help but some problem when i leave. I want when i leave the area nothing nothing shows in chatbox or show one time Link to comment
Kenix Posted February 11, 2012 Share Posted February 11, 2012 Tested. Lol, If somebody leave it output only 1 time in 50 sec( So if you leave and again leave it not output , but if leave and timer not have it output ). You can remove timer. 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